Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Billing details are not saved on stripe when using Apple Pay #1724

Open
sanaf1333 opened this issue Sep 4, 2024 · 0 comments
Open

Billing details are not saved on stripe when using Apple Pay #1724

sanaf1333 opened this issue Sep 4, 2024 · 0 comments

Comments

@sanaf1333
Copy link

sanaf1333 commented Sep 4, 2024

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:

  1. 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",
  });`
  1. 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(),
            },
          },
        },
      });
  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant