stripe-react-native
stripe-react-native copied to clipboard
Error: Apple Pay request type `nil` is not supported. Can't use apple merchant tokens
Describe the bug
Can't use merchant tokens by setting the request with its type set to PaymentRequestType.Recurring as describe here : https://docs.stripe.com/payments/accept-a-payment?platform=react-native&mobile-ui=payment-element#add-apple-pay
It is throwing the error:
Error: {
message = "Apple Pay request type `nil` is not supported.";
}
I have provided the PaymentRequestType.Recurring type.
Also it is not showing the details like this:
To Reproduce Steps to reproduce the behavior:
const initializePaymentSheet = async () => {
const recurringSummaryItem = {
label: 'My Subscription',
amount: '59.99',
paymentType: 'Recurring',
intervalCount: 1,
intervalUnit: 'month',
// Payment starts today
startDate: new Date().getTime() / 1000,
// Payment ends in one year
endDate: new Date().getTime() / 1000 + 60 * 60 * 24 * 365,
};
const {error} = await initPaymentSheet({
// ...
applePay: {
merchantCountryCode: 'US',
cartItems: [recurringSummaryItem],
request: {
type: PaymentRequestType.Recurring,
description: 'Recurring',
managementUrl: 'https://my-backend.example.com/customer-portal',
billing: recurringSummaryItem,
billingAgreement:
"You'll be billed $59.99 every month for the next 12 months. To cancel at any time, go to Account and click 'Cancel Membership.'",
},
},
});
};
Expected behavior It shouldn't throw the error and it should show proper details on the Apple Payment Sheet.
Screenshots
Desktop (please complete the following information):
- OS: iOS/Mac
- Browser [e.g. chrome, safari]
- Version 0.28.0 and 0.37.3
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context Add any other context about the problem here.
i have the same issue
Same issue too.
stripe/stripe-react-native: v. 0.37.2 Device: iPhone 15 with iOS 17.4
Error: { message = "Apple Pay request type "nil' is not supported."; }
I cannot find i way to show all infos on iOS 16+. Plus i cannot find a way to customize the currency (setup intent with secret created server-side).
But at least I found a way to fix the error.
There is a problem on the try request.configureRequestType(requestParams: applePayParams) inside /ios/StripeSdk+PaymentSheet.swift.
I think it should pass the applePayParams["request"] property instead.
I'll attach a patch-package patch to this comment.
Version 0.37.2
For now, you can use confirmPlatformPaySetupIntent and confirmPlatformPayPayment.. It works!
https://docs.stripe.com/apple-pay?platform=react-native#present-payment-sheet
const { confirmPlatformPayPayment, confirmPlatformPaySetupIntent } = useStripe();
const payWithApple = (recurringItem, billingAgreement)=> {
if (recurringItem && billingAgreement) {
const { error } = await confirmPlatformPayPayment(
data?.paymentIntentClientSecret,
{
applePay: {
currencyCode: "EUR",
merchantCountryCode: "FR",
cartItems: [recurringItem],
request: {
billingAgreement,
billing: recurringItem,
description: "Recurring",
managementUrl: "https://www.domain.com",
type: PlatformPay.PaymentRequestType.Recurring,
trialBilling: existingUser ? undefined : getTrialBilling(),
},
},
}
);
}
}
@projectnatz @mk1020 @3molee @cpytel
+1 This is currently blocking us from allowing Apple Pay
For now, you can try my above solution @zacherygentry
Currenlty Blocking me as well. Is this fixed yet
Any updates? Blocked as well.
const applePayRequest = {
type: PaymentRequestType.Recurring,
description: 'Recurring',
managementUrl: 'https://my-backend.example.com/customer-portal',
billing: recurringSummaryItem,
billingAgreement:
"You'll be billed $59.99 every month for the next 12 months. To cancel at any time, go to Account and click 'Cancel Membership.'",
}
const {error} = await initPaymentSheet({
// ...
applePay: {
merchantCountryCode: 'US',
cartItems: [recurringSummaryItem],
...applePayRequest
request: applePayRequest,
},
});
Quick solution: This will help resolve the error. @delandchen @NooryA @zacherygentry