Open olivierlesnicki opened 6 years ago
OK, so I've identified the root of the issue.
Apple Pay obfuscate some of the shipping address information to keep the data anonymous until the actual payment acceptance. It then provides the complete shipping address against the PaymentResponse.
react-native-payments
on iOS provides the obfuscated shipping address in the PaymentResponse - it doesn't update it with the full one.
@olivierlesnicki I'm having the same issue. Were you able to get the shipping address? I'm using stripe as my gateway
@dancalifornia I'm now using https://github.com/tipsi/tipsi-stripe which works out of the box
@olivierlesnicki thanks, i just ran across this earlier today and was going to try it out.
Saved me some time, here @olivierlesnicki ! Thank you.
Though... for me, it's still truncating the information/returning null values for fields (notably addressLine) per the OP here even after the payment acceptance. Simulator and physical device, alike.
Anyone else experiencing this issue?
Anyone found a solution for this?
@preko96 I'm successfully using a fork:
@wkoutre I dunno if you're still active or not, but I'm having this exact issue, and I've tried using your fork to no avail. Is there something specific you modified?
@Zyphxion I'm active!
Well to first note, I took out the Stripe capability, as it wasn't implemented properly to be used in tandem with Braintree, and I didn't need Stripe, only Braintree.
Other than that, briefly sifting through my fork's commit history, I can't recall exactly what I did. in the app I currently maintain, though, I do know I pass these options in:
{
requestShipping: true,
requestPayerEmail: true,
requestPayerPhone: true,
requestPayerName: true,
requestBilling: true,
}
as the third argument to PaymentRequest
like:
new PaymentRequest(methodData, detailsData, PAYMENT_OPTIONS)
Edit: Also, to reiterate, it's expected that the full address details are hidden until after the user accepts the Apple Pay UI (using FaceID, TouchID, PIN). So, before verifying, zip/postal, city, state
are the only accessible data.
@wkoutre thanks for the fast response. I tried adding those additional parameters but they didn't seem to change the resulting data. I'm aware of the restriction on the full address details, but am I right to assume that they should be available in the paymentResponse object as a result from
paymentRequest.show().then((paymentResponse) => { // address details should be available here })
Because my payment response object still contains the truncated address data, with just the City/State/ZIP available
Any further light you could shed would be amazing, thanks
@Zyphxion Sure thing, and thanks for clarifying. I'm also assuming you're trying this on a physical device, and not a simulator.
Given that assumption, yes, it should be accessible via:
const { shippingContact, billingContact } = paymentResponse.details;
Happy to help out, but at this point, I would need code + a small runnable sample project to get into the weeds of what you're facing.
In Apple Pay, I've entered the following shipping address:
Yet, when I print
PaymentResponse.shippingAddress
I get:Is it normal? The postalCode is truncated and the addressLine is empty.
And what should I do to obtain the full shipping address?