question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApplePay not working on real device: Payment not completed @0.2.3

See original GitHub issue

Describe the bug ApplePay is working on Simulator, but on a real device is not. I had a valid credit card in my wallet and Test Mode on Stripe Dashboard. I already checked that the amount value is a string on carItems.

I got this error:

{
  "code": "Failed",
  "message": "Payment not completed",
  "domain": "RCTErrorDomain",
  "userInfo": null,
  "nativeStackIOS": [
    "0   app_name_dev                      0x0000000104e8dd2c RCTJSErrorFromCodeMessageAndNSError + 116",
    "1   app_name_dev                      0x0000000104e2a1b4 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.129 + 144",
    "2   app_name_dev                      0x00000001055249b4 $sSo8NSStringCSgACSo7NSErrorCSgIeyByyy_SSSgAGs5Error_pSgIegggg_TR + 320",
    "3   app_name_dev                      0x000000010552e694 $s19stripe_react_native9StripeSdkC15applePayContext_15didCompleteWith5errory0D008STPApplegH0C_AG16STPPaymentStatusOs5Error_pSgtF + 740",
    "4   app_name_dev                      0x000000010552eb68 $s19stripe_react_native9StripeSdkC15applePayContext_15didCompleteWith5errory0D008STPApplegH0C_AG16STPPaymentStatusOs5Error_pSgtFTo + 116",
    "5   app_name_dev                      0x000000010517ca10 $s6Stripe18STPApplePayContextC39paymentAuthorizationControllerDidFinishyySo09PKPaymentfG0CFyycfU0_yycfU_ + 204",
    "6   app_name_dev                      0x00000001050bd664 $sIeg_IeyB_TR + 48",
    "7   libdispatch.dylib                   0x000000010838c6d4 _dispatch_call_block_and_release + 32",
    "8   libdispatch.dylib                   0x000000010838e3b4 _dispatch_client_callout + 20",
    "9   libdispatch.dylib                   0x000000010839e898 _dispatch_main_queue_callback_4CF + 1224",
    "10  CoreFoundation                      0x0000000180e95d84 16FAA70C-278C-3561-859E-CEC407C2DC7C + 335236",
    "11  CoreFoundation                      0x0000000180e4ff5c 16FAA70C-278C-3561-859E-CEC407C2DC7C + 48988",
    "12  CoreFoundation                      0x0000000180e63468 CFRunLoopRunSpecific + 600",
    "13  GraphicsServices                    0x000000019c9ee38c GSEventRunModal + 164",
    "14  UIKitCore                           0x0000000183805088 CD7F7BA2-A2C6-3727-AFF6-9BAAB60CC6AB + 5349512",
    "15  UIKitCore                           0x0000000183583958 UIApplicationMain + 2092",
    "16  app_name_dev                      0x0000000104c4d414 main + 104",
    "17  dyld                                0x0000000108189aa4 start + 520"
  ]
}

To Reproduce Steps to reproduce the behavior:

const { error, paymentMethod } = await presentApplePay({
	cartItems: [{ label: 'Example item name', amount: '14.00' }],
	country: 'US',
	currency: 'USD',
	shippingMethods: [
		{
			amount: '20.00',
			identifier: 'DPS',
			label: 'Courier',
			detail: 'Delivery',
			type: 'final',
		},
	],
	requiredShippingAddressFields: ['emailAddress', 'phoneNumber'],
	requiredBillingContactFields: ['phoneNumber', 'name'],
});
if (error) {
	console.log("ERROR APPLE PAY 1: ", JSON.stringify(error));
	console.log("ERROR APPLE PAY 1: ", JSON.stringify(paymentMethod, null, 2));
	SimpleToast.show(error.message);
}

OR

const { error, paymentMethod } = await presentApplePay({
	cartItems: [{amount: "10.65", label: "Americano"}, {amount: "3.55", label: "Americano"}, {amount: "14.20", "label": "Store Name"}],
	country: 'US',
	currency: 'USD',
	requiredBillingContactFields: ['phoneNumber', 'name'],
});
if (error) {
	console.log("ERROR APPLE PAY 1: ", JSON.stringify(error));
	console.log("ERROR APPLE PAY 1: ", JSON.stringify(paymentMethod, null, 2));
	SimpleToast.show(error.message);
}

Expected behavior Payment status “succeeded”

Screenshots If applicable, add screenshots to help explain your problem. IMG_2891

Desktop (please complete the following information):

  • OS: macOS 12.1
  • Browser: -
  • Version: -

Smartphone (please complete the following information):

  • Device: iPhone 11 Pro
  • OS: iOS 15.2.1
  • Browser: -
  • Version: -

Additional context My Credit Card is from Mexico. I tried to change the Currency and Country to MXN-MX, but still is not working

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

4reactions
karlr-stripecommented, Feb 28, 2022

That error from the sample request ID would indicate that you haven’t set up your Stripe account by uploading your Apple Pay processing certificate(created through your Apple Developer account), rather than any particular issue with the SDK itself I believe.

https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#register-for-an-apple-merchant-id https://stripe.com/docs/apple-pay?platform=react-native#merchantid

At a high level, the iOS SDK(which this ReactNative library bridges to) interacts with Apple’s libraries to obtain a native PkPayment object, which contains the encrypted card details. To decrypt it, it’s passed to Stripe’s API for your account that has set up certs as documented above. If you haven’t set that up or your app is using a different Apple Pay Processing Certificate than uploaded to your Stripe account then you’d get that error.

The simulator doesn’t need this, and the web integration works entirely differently(no requirement to upload your own certs) and has no connection here. For mobile/React Native, it’s required to set things up as described there.

2reactions
charliecruzan-stripecommented, Mar 16, 2022

added a note to the troubleshooting guide, turns out we can’t super-easily catch this. Although a pretty helpful alert is thrown already

Read more comments on GitHub >

github_iconTop Results From Across the Web

Payment Not Completed Apple Pay
Every time I try and purchase something within an app, I receive a red exclamation mark after typing in my password that says...
Read more >
Payment not completed error with A… | Apple Developer Forums
Hi, i was integrating apple pay on my application for which I have setup all the required certificated and domain mapping.
Read more >
"Payment not completed" error every time … - Apple Community
"Payment not completed" error every time I try to use Apple Pay in Safari with TouchID. I have an Apple Card set up...
Read more >
Payment not completed - Apple Support Communities
Payment not completed. whenever i download some apps from appstore i found error like payment not completed.i update all payment method too ...
Read more >
Problems and their solutions for Apple Pay, Apple Card, and ...
If you are getting a message to contact the card issuer, call the bank or credit card company who issued you the card...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found