appstitch_stripe 1.0.4 copy "appstitch_stripe: ^1.0.4" to clipboard
appstitch_stripe: ^1.0.4 copied to clipboard

Stripe Integrations for Appstitch.

Appstitch Stripe #

Serverless Stripe Integrations for Appstitch

Usage #

Create a customer #

final customerOpts = CreateCustomerOpts(email: "test@example.com");
final _customer = await stripe.createCustomer(customerOpts);

Create a Subscription #

final subscriptionItems = [SubscriptionItemOpts(price: "price_abc123")];

final subscriptionOpts = CreateSubscriptionOpts(customer: "cus_abc123", items: subscriptionItems);

subscription = await stripe.createSubscription(subscriptionOpts);

Create a PaymentIntent #

final paymentIntentOpts = CreatePaymentIntentOpts(
        currency: "usd",
        amount: 2500,
        confirm: true,
        customer: "customerID");

final paymentIntent = await stripe.createPaymentIntent(paymentIntentOpts);

With Apple Pay or Android Pay

final paymentIntentOpts = CreatePaymentIntentOpts(
      currency: "usd",
      amount: 2500,
      confirm: true,
      paymentMethodData: PaymentMethodData(
          card: CreateCardOpts(token: token.tokenId), type: "card"),
    );

final paymentIntent = await stripe.createPaymentIntent(paymentIntentOpts);


Blueprints #

Blueprints abstract literals away from client side code. Set up blueprints on the dashboard to avoid fetching master data (e.g. Stripe prices). All blueprint properties can overwritten by your flutter client.

It's easier to update blueprints oposed pushing new releases.

An example:

The "pro_tier_sale" blueprint sets the items and coupon for the subscription. The client side is cleaner since you just set the customerID

final subscriptionOpts = CreateSubscriptionOpts(customer: customerID);

subscriptionOpts.blueprintId = "pro_tier_sale";

subscription = await stripe.createSubscription(subscriptionOpts);

Best Practice : Start with very broad blueprints and refine them as you go.


Install #

appstitch_core:   ^1.0.0
appstitch_stripe: ^1.0.4

Initialize #

import 'package:appstitch_core/options.dart';
import 'package:appstitch_core/core.dart';


Core core = Core();

@override
void initState() {
  super.initState();

  final options = Options(appstitchKey, clientID: clientID);
  core.initialize(options);

}

Notes #

The foundations for this library is from flutter_stripe_payment and tipsi-stripe

Create a free Appstitch account here

0
likes
30
pub points
0%
popularity

Publisher

verified publisherappstitch.dev

Stripe Integrations for Appstitch.

Homepage

License

BSD-3-Clause (LICENSE)

Dependencies

appstitch_core, flutter, json_annotation

More

Packages that depend on appstitch_stripe