Payment cancelled exception whenever I call paymentRequestWithNativePay
I'm trying to make use of the native pay functionality for ApplePay only. When I call the function it throws an exception that says cancelled by User but I didn't cancel the payment. In fact it never shows the payment sheet.
I'm on flutter 1.22.5 using version 1.0.9
Here's all the relevant code
// Setup called when the service is initialised
StripePayment.setOptions(StripeOptions(
publishableKey: FlavorConfig.instance.values.stripePublishableKey,
merchantId: FlavorConfig.instance.values.stripePublishableKey,
androidPayMode: 'test',
));
Call made when we need to get the charge token from ApplePay
final token = await StripePayment.paymentRequestWithNativePay(
// not supplied properly because not relevant
androidPayOptions: AndroidPayPaymentRequest(
totalPrice: "1.20",
currencyCode: "USD",
),
applePayOptions: ApplePayPaymentOptions(
countryCode: 'US',
currencyCode: 'USD',
items: [
ApplePayItem(
label: merchant,
amount: (subtotal + tip + tax).toString(),
)
],
),
);
The function above throws an exception with code cancelled. It never even shows the sheet for me to cancel. I've ensured everything is setup correctly.
- Stripe payment has the cert and merchant id
- identifier has the correct capabilities
- The capabilities has been added to the runner and the correct merchant id is set
- All associated certs and everything is correct
- The strip publishable key works because I use it for card payments
Same here, i just ran the example code in the docs, and i got the same error using the method paymentRequestWithCardForm.
Version 1.0.10 still crash
This or something similar is happening across at least 3 different Stripe plugins when attempting to use Apple Pay. Although stripe_native works in debug but then fails in release mode.
Seeing the same is there any update on this issue?
I think this is some issue to do with when the lib calls the native PKPaymentAuthorizationViewController.canMakePayments as it always seems to return false on a real iOS device.
Perhaps the Stripe SDK version needs to be updated?
After lots of looking my issue was that I did not have the merchant id in the entitlements file and I was using the string 'master_card' not 'mastercard' in the array for the method StripePayment.canMakeNativePayPayments. Fixing those issues it now works well.
Same issue here. Are there any solutions?
What should be the next steps in Apple Pay after a successful call for paymentRequestWithNativePay?