stripe-react-native
stripe-react-native copied to clipboard
Billing details are not saved on stripe when using Apple Pay
I am using PlatformPayButton for apple pay for charging recurring payments (monthly). I have added address as compulsory field as I have automatic tax collection enabled. Now even though I have entered all the address details but the address is not saved in user's details on stripe.
Steps to reproduce the behavior:
- Create paymentIntent on server-side to get client secret using paymentIntents
` const intent = await stripe.paymentIntents.create({
customer: customerId,
amount: amount * 100,
currency: "USD",
setup_future_usage: "off_session",
});`
- Pass the client secret and other applePay details to confirmPlatformPayPayment, so far payment is made successfully.
const { error, paymentIntent } = await confirmPlatformPayPayment(clientSecret, {
applePay: {
cartItems: [
{
label: 'name',
amount: '100',
paymentType: PlatformPay.PaymentType.Immediate,
},
],
merchantCountryCode: 'US',
currencyCode: 'USD',
requiredShippingAddressFields: [PlatformPay.ContactField.PostalAddress],
requiredBillingContactFields: [PlatformPay.ContactField.PhoneNumber],
request: {
type: PlatformPay.PaymentRequestType.Recurring,
description: 'Thank you for subscribing to premium package',
managementUrl: '',
billing: {
paymentType: PlatformPay.PaymentType.Recurring,
intervalUnit: PlatformPay.IntervalUnit.Month,
intervalCount: 1,
label: 'Total Amount',
amount: totalAmount?.toString(),
},
},
},
});
- After this, I create a subscription on server-side on stripe and at that point I get the error
` const subscription = await stripe.subscriptions.create({
customer: user.stripeCustomerId!,
items: [
{
price: priceId,
},
],
default_payment_method: paymentMethodId,
payment_behavior: "default_incomplete",
payment_settings: { save_default_payment_method: "on_subscription" },
expand: ["latest_invoice.payment_intent"],
...(promotionCodeId ? { promotion_code: promotionCodeId } : {}),
automatic_tax: {
enabled: true,
},
});`
{
"message": "The customer's location isn't recognized. Set a valid customer address in order to automatically calculate tax."
}
Expected behavior User's address from ApplePay payment sheet should be saved in customer's billing details on stripe.
Desktop:
- OS: iOS
- React native "0.74.2"
- stripe sdk version "^0.38.3"
Smartphone:
- Device: Emulator iphone 15 pro max
Additional context It works fine for credit card added using CardField and created using createPaymentMethod.