Repository navigation
fix(payment): map phone, carrier, and trackingNumber in shippingDetails - #2752
reginaldalfret wants to merge 2 commits into
Conversation
When confirming a PaymentIntent with shipping details, only the name and address fields were being mapped to the native payment intent shipping parameters on Android and iOS. This caused carrier, phone, and tracking number to be silently dropped from the request payload sent to Stripe. Update mapToShippingDetails on Android (Mappers.kt) and iOS (Mappers.swift) to extract phone, carrier, and trackingNumber, update the TypeScript ShippingDetails definition to include these optional fields, and add unit tests for both platforms. Fixes stripe#1959 Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
- Use safe calls on nullable result in mapToShippingDetails test in MappersTest.kt - Update etc/stripe-react-native.api.md with new ShippingDetails properties (carrier, trackingNumber) Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
ratomirjovanovic
left a comment
There was a problem hiding this comment.
In case it helps get this unblocked: in the latest run of "Check public API surface", the only remaining difference is not in your change. The regenerated report drops one // (undocumented) line above style?: StyleProp<ViewStyle>; in the platform pay button props (around line 3568 of etc/stripe-react-native.api.md), while the new ShippingDetails_3 entry already matches. So rebasing on main and regenerating the report (yarn api-extractor run --local, or copying temp/stripe-react-native.api.md over the committed file as the warning suggests) should clear that check.
One small thing on the type: ShippingDetails is now BillingDetails & { carrier?; trackingNumber? }, so it still accepts email, which neither ConfirmPaymentIntentParams.Shipping nor STPPaymentIntentShippingDetailsParams has, and it is dropped without a warning. Omit<BillingDetails, 'email'> would make that visible at compile time, though it is arguably out of scope here.

Summary
Fixes #1959.
When confirming a PaymentIntent with \shippingDetails, only the recipient
ame\ and \�ddress\ were being mapped to the native payment intent shipping parameters on both Android and iOS. As reported in #1959, any provided \phone, \carrier, or \ rackingNumber\ fields were omitted from the Stripe API request.
Changes
Test Plan