initialise method

  1. @override
Future<void> initialise({
  1. required String publishableKey,
  2. String? stripeAccountId,
  3. ThreeDSecureConfigurationParams? threeDSecureParams,
  4. String? merchantIdentifier,
  5. String? urlScheme,
  6. bool? setReturnUrlSchemeOnAndroid,
})
override

Implementation

@override
Future<void> initialise({
  required String publishableKey,
  String? stripeAccountId,
  ThreeDSecureConfigurationParams? threeDSecureParams,
  String? merchantIdentifier,
  String? urlScheme,
  bool? setReturnUrlSchemeOnAndroid,
}) async {
  this._urlScheme = urlScheme;

  if (__stripe != null) {
    // Check if the new stripeAccountId is different
    if (__stripe!.stripeAccount != stripeAccountId) {
      // Re-initialize with new stripeAccountId
      await stripe_js.loadStripe();
      var stripeOption = stripe_js.StripeOptions();
      stripeOption.stripeAccount = stripeAccountId;
      __stripe = stripe_js.Stripe(publishableKey, stripeOption);
    }
    return;
  }

  await stripe_js.loadStripe();
  var stripeOption = stripe_js.StripeOptions();
  if (stripeAccountId != null) {
    stripeOption.stripeAccount = stripeAccountId;
  }
  __stripe = stripe_js.Stripe(publishableKey, stripeOption);
}