Expo SDK Version: 47
Platforms: iOS
React Native: 0.70.5
I’m having issues using useApplePay
, presentApplePay
and confirmApplePayPayment
.
I’m using "@stripe/stripe-react-native": "0.19.0",
however the latest is 0.25.0. I’ve tried both versions of the SDK/
My code, using Stripe SDK 0.19.0:
- the Apple pay dialogue opens
- after face authorization or passcode, the payment begins processing.
- processing never completed, "Payment The payment has been canceled" appears in BugSnag
- no JS error or detailed error message from
presentApplePay()
- No errors in Stripe’s logs
- createPaymentSecret() is the api request to Stripe’s servers for a payment secret. This appears on Stripe’s logs.
const { confirmApplePayPayment, presentApplePay } = useApplePay();
const handlePress = async () => {
const {
data: { response },
} = await createPaymentSecret({
amount: Number(amount) * 100, // bc this is in cents not dollars
});
const clientSecret = response;
const { paymentMethod, error } = await presentApplePay({
currency: 'usd',
country: 'US',
cartItems: [{ paymentType: 'Immediate', label: applePayLabel, amount }],
});
// The request fails here without details of what the issue is
if (!error) {
const { error: confirmApplePayError } = await confirmApplePayPayment(
clientSecret,
);
if (confirmApplePayError) {
Bugsnag.notify(confirmApplePayError.message);
} else {
console.log('Success', 'The payment was confirmed successfully!');
}
} else {
Bugsnag.notify(`Present Apple Pay Error: ${error}`);
}
};
“Latest” Stripe SDK 0.25.0 using confirmPlatformPayPayment()
:
References:
Results:
- Apple pay dialogue does not appear
- No errors. Nothing happens
const { confirmPlatformPayPayment } = usePlatformPay();
const handlePress = async () => {
const {
data: { response },
} = await createPaymentSecret({
amount: Number(amount) * 100,
});
const clientSecret = response;
const { paymentIntent, error } = await confirmPlatformPayPayment(
clientSecret,
{
applePay: {
merchantCountryCode: 'US',
currencyCode: 'usd',
cartItems: [
{
paymentType: PlatformPay.PaymentType.Immediate,
label: applePayLabel,
amount,
},
],
},
},
);
if (!error) {
console.log('Success', 'The payment was confirmed successfully!');
} else {
Bugsnag.notify(`Present Apple Pay Error: ${error}`);
}
};
Appears that Expo with Stripe, is not working as expected. Since Stripe’s API seems to have deprecated, does that make Expo’s implementation obsolete? If so, what alternative solutions are there to collecting Apple Pay payments?