createPlatformPayPaymentMethod method

Future<PlatformPayPaymentMethod> createPlatformPayPaymentMethod({
  1. required PlatformPayPaymentMethodParams params,
  2. bool usesDeprecatedTokenFlow = false,
})

Launches the relevant native wallsheet (Apple Pay on iOS and Google Pay on Android) in order to create a payment intent

Argument params is describing the the Apple Pay or Google pay configuration. Creating payment method does not return a token by default. Use usesDeprecatedTokenFlow instead.

throws StripeError in case creating payment method is failing.

Implementation

Future<PlatformPayPaymentMethod> createPlatformPayPaymentMethod({
  required PlatformPayPaymentMethodParams params,
  bool usesDeprecatedTokenFlow = false,
}) async {
  try {
    await _awaitForSettings();
    return await _platform.platformPayCreatePaymentMethod(
      params: params,
      usesDeprecatedTokenFlow: usesDeprecatedTokenFlow,
    );
  } on StripeError {
    rethrow;
  }
}