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

Retrieve PaymentMethod before calling confirmPaymentSheetPayment #1640

Open
g-cappai opened this issue Apr 16, 2024 · 4 comments
Open

Retrieve PaymentMethod before calling confirmPaymentSheetPayment #1640

g-cappai opened this issue Apr 16, 2024 · 4 comments

Comments

@g-cappai
Copy link

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.

@seanzhang-stripe
Copy link
Collaborator

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?

@g-cappai
Copy link
Author

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.

@seanzhang-stripe
Copy link
Collaborator

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?

@g-cappai
Copy link
Author

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.

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

2 participants