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

Libraries

address
android_pay_payment_request
androidPayLineItem
androidPayOpts
apple_pay_payment_request
applePayLineItem
applePayOpts
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
appstitch_stripe
attachPaymentMethodOpts
bankAccount
base
cancellationReason
cancelPaymentIntentOpts
capturePaymentIntentOpts
card
card_form_payment_request
cardFormPaymentRequest
confirmPaymentIntentOpts
connectOptions
createCardOpts
createPaymentMethodOpts
createSourceOpts
customer
discount
error_codes
interval
invoiceItem
method
native_stripe
payment_intent
paymentBehaviour
paymentIntent
paymentMethod
paymentMethodData
paymentMethodResult
price
shippingMethod
source
stripeOptions
token
transferData
types
updatePaymentIntentOpts
updateSubscriptionOpts