Stripe constructor

Stripe(
  1. String publishableKey, {
  2. String apiVersion = defaultApiVersion,
  3. SupportLocale locale = SupportLocale.auto,
  4. String? stripeAccount,
  5. String? returnUrlForSca,
})

Creates a new Stripe object. Use this constructor if you wish to handle the instance of this class by yourself. Alternatively, use Stripe.init to create a singleton and access it through Stripe.instance.

publishableKey is your publishable key, beginning with "sk_". Your can copy your key from https://dashboard.stripe.com/account/apikeys

stripeAccount is the id of a stripe customer and stats with "cus_". This is a optional parameter.

returnUrlForSca can be used to use your own return url for Strong Customer Authentication (SCA) such as 3DS, 3DS2, BankID and others. It is recommended to use your own app specific url scheme and host.

Implementation

Stripe(this.publishableKey,
    {this.apiVersion = defaultApiVersion,
    this.locale = SupportLocale.auto,
    String? stripeAccount,
    String? returnUrlForSca})
    : _apiHandler =
          StripeApiHandler(stripeAccount: stripeAccount, locale: locale) {
  _validateKey(publishableKey, stripeAccount);
  _returnUrlForSca = returnUrlForSca ?? "stripesdk://3ds.stripesdk.io";
  _apiHandler.apiVersion = apiVersion;
  paymentIntents = PaymentIntents(this);
  paymentMethods = PaymentMethods(this);
  setupIntents = SetupIntents(this);
}