stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

Retrieve PaymentMethod before calling confirmPaymentSheetPayment

Open g-cappai opened this issue 1 year ago • 6 comments
trafficstars

Is your feature request related to a problem? Please describe.

I'm currently using the Mobile Payment Element with customFlow and confirmHandler, following the documentation. However, I'm encountering difficulty retrieving the PaymentMethod before calling confirmPaymentSheetPayment, which is necessary for updating the UI.

Currently, I'm retrieving the PaymentMethod from confirmHandler's parameters. However, this requires delaying the call to intentCreationCallback until after the UI is updated and the user confirms to proceed.

Describe the solution you'd like

I’d like to have a way to obtain the PaymentMethod object after the PaymentSheet is closed, potentially as part of PresentPaymentSheetResult. This would allow for acquiring the PaymentMethod before calling confirmPaymentSheetPayment, simplifying UI updates and user confirmation processes.

g-cappai avatar Apr 16 '24 14:04 g-cappai

Hi @g-cappai The PaymentOption returned from presentPaymentSheet contains label and image that you can use to update your UI. Can you tell me what other information you need for your UI update?

seanzhang-stripe avatar Apr 18 '24 08:04 seanzhang-stripe

Hi @seanzhang-stripe, I need the PaymentMethod id. We use it to calculate fees and show the updated price to our customers after they fill the PaymentSheet.

g-cappai avatar Apr 18 '24 10:04 g-cappai

Hi @g-cappai The SDK won't create a PaymentMethod until confirmPaymentSheetPayment is called, and that's why the PaymentMethod is not available in PaymentOption object. There's a similar discussion here. Will adding paymentMethodType in PaymentOption object solve your problem?

seanzhang-stripe avatar Apr 18 '24 13:04 seanzhang-stripe

Hi @seanzhang-stripe, that would be helpful, but I need more data. Essentially, we use the PaymentMethod.id on the server to retrieve the type, Brand (if it's a card) and Country. So if I could get this data within PaymentOption, that would be fine as well.

g-cappai avatar Apr 19 '24 09:04 g-cappai

Hi @seanzhang-stripe, any news?

g-cappai avatar Jun 12 '24 09:06 g-cappai

+1

Adding paymentMethodType would solve our problem

FredrikErikJohansson avatar Jun 19 '24 07:06 FredrikErikJohansson