stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.29k stars 262 forks source link

[ApplePay]: onShippingContactSelected method #1120

Closed tgensol closed 2 years ago

tgensol commented 2 years ago

Describe the bug

Hi there,

I am trying to use Apple Pay and the onShippingContactSelected callback, but I always getting a weir shippingContact :

{
  phoneNumber: '',
  postalAddress: {
    country: 'France',
    city: 'Paris',
    subLocality: '',
    isoCountryCode: 'FR',
    subAdministrativeArea: '',
    street: '',
    postalCode: '75008',
    state: '',
  },
  name: {
    nameSuffix: '',
    middleName: '',
    nickname: '',
    familyName: '',
    givenName: '',
    namePrefix: '',
  },
  emailAddress: '',
}

Excepting postalCode, or the countryCode, everything else is an empty string... Even if I am trying to ask for any fields in the requiredShippingAddressFields or/and requiredBillingContactFields.

It is happening on a real device or on a simulator. What am I missing ?

To Reproduce Steps to reproduce the behavior: Use Apple Pay and check the shippingContact you will get

Expected behavior

I wanted all the fields to be non empty

tgensol commented 2 years ago

https://developer.apple.com/documentation/passkit/pkpaymentauthorizationcontrollerdelegate/2867956-paymentauthorizationcontroller It is a normal behavior

tgensol commented 2 years ago

A contact object that represents the new shipping address. To maintain privacy, the shipping information is anonymized. For example, in the United States it only includes the city, state, and zip code. This provides enough information to calculate shipping costs, without revealing sensitive information until the user actually approves the purchase.

tgensol commented 2 years ago

I will reopen it, because I still do not find how to get the FULL shippingContact once the user validated the payment :

const { error, paymentMethod } = await presentApplePay({}), why the shippingContact is not in the paymentMethod ? We have the billing

Thank you

tgensol commented 2 years ago

After digging :

aurelien-robineau commented 2 years ago

Hi @tgensol, I am facing the same issue right now. How does the data end up into the payment intent if we can't access the shipping address when we create it ?

  1. I present ApplePay using
  2. I can't get the shipping address from the response
  3. I create the payment intent (without the shipping data because I don't have it yet)
  4. I confirm the ApplePay payment
  5. I still don't have any shipping data