init static method

void init(
  1. String publishableKey, {
  2. String apiVersion = defaultApiVersion,
  3. String? stripeAccount,
  4. String? returnUrlForSca,
})

Initializes the singleton instance of Stripe. Afterwards you can use Stripe.instance to access the created 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. This parameter must match your "android/app/src/main/AndroidManifest.xml" and "ios/Runner/Info.plist" configuration.

Implementation

static void init(String publishableKey,
    {String apiVersion = defaultApiVersion,
    String? stripeAccount,
    String? returnUrlForSca}) {
  if (_instance == null) {
    _instance = Stripe(publishableKey,
        apiVersion: apiVersion,
        stripeAccount: stripeAccount,
        returnUrlForSca: returnUrlForSca);
  }
}