#crisscrosschris
1 messages · Page 1 of 1 (latest)
Ah gotcha
Can you summarize the issue you are experiencing?
yeah, basically stripe UI allows users to add multiple payment methods and select the one they want, but doesn't keep track of which one they selected
Unless I'm missing something, you should flag this internally bc it seems like a major oversight
What do you mean exactly by "doesn't keep track of which one they selected"?
Are you using the custom flow here?
No, I'm following the docs step by step and am stuck on step 5 https://stripe.com/docs/payments/mobile/save-and-reuse
Ah you are saving cards to set up for payment in the future.
Yeah so you are still going to need your customer to indicate which payment method they want you to charge.
So when you store them you assign some indicator on your end either through metadata or in your database.
How does the future charge come about here?
Like what is the use-case exactly?
When user clicks "set up" there's no response object or anything that tells me what PM they selected
It's a betting todo app where I'm bundling and charges fines at the end of the week
So they need to set up a credit card in order to bet money
The issue is the pre-built Stripe UI allows users to save multiple PMs & select a default one, but it doesn't give me any way to know which one they selected as the default one
I don't think it lets you set a default at all?
That really isn't a thing outside of Subscriptions/Invoices
And that isn't something that is handled on the client
Regardless, when your customer opens the sheet they have two choices -- they either select a PM they have already set up in which case no new card is added or they add a new one.
You will know after the promise resolves by listing PMs which of these is the case.
You would still show on your client which card is going to get charged.
So if they add a new one then you likely want to show the new one added as the one that will get charged in the future.
however, the UI has this little check at the bottom right and u can select between the different saved cards
when they switch to the 2nd visa and click set up, I can't detect that
Right, that is because this is the same UI that was built initially as a payment UI
I see your point -- it is a flow that can definitely be improved.
I'm happy to submit feedback on it.
That said, for now, you have a couple options.
First, you can just not pass an ephemeral key at all here and we won't show the already-saved PMs. You would just do this in your own UI instead
Actually... what happens to the SetupIntent if you choose one that has already been saved?
Does it not get confirmed again?
Here's the setup intent object. It doesn't appear to store the selected payment method?
"id": "seti_1Nk7RMCNzspyvGyf1KTmOKoP",
"object": "setup_intent",
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
"client_secret": "seti_1N**********************_******_***************************2fqn",
"created": 1693236800,
"customer": "cus_ORFsXyE09aqu6l",
"description": null,
"flow_directions": null,
"last_setup_error": null,
"latest_attempt": null,
"livemode": false,
"mandate": null,
"metadata": {
},
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_options": {
"card": {
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"single_use_mandate": null,
"status": "requires_payment_method",
"usage": "off_session"
}```
yeah
Whenever "Set up" is clicked there's never a default method stored in this object
Can you perform another test real quick where you select one of the already-saved PaymentMethods and click "set up" and then provide me the SetupIntent ID?
{
"id": "seti_1NkB4ZCNzspyvGyfsXmmqVtO",
"object": "setup_intent",
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
"client_secret": "seti_1N**********************_******_***************************F45D",
"created": 1693250763,
"customer": "cus_ORFsXyE09aqu6l",
"description": null,
"flow_directions": null,
"last_setup_error": null,
"latest_attempt": null,
"livemode": false,
"mandate": null,
"metadata": {
},
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_options": {
"card": {
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"single_use_mandate": null,
"status": "requires_payment_method",
"usage": "off_session"
}
Huh okay I'm surprised it doesn't re-confirm and pass the previous PaymentMethod. Like with your request here: https://dashboard.stripe.com/test/logs/req_7ZWUOvzU38sw5B
That re-confirmed a previously set up PaymentMethod
Are you sure you are looking at the correct SetupIntent?
The one associated to the client secret that you are using to initialize Payment Sheet?
I'm not sure why there's two versions
but that looks very promising
i'm noticing when i switch it the object's PM id changes
After presentPaymentSheet() resolves you should be able to retrieve the SetupIntent and know which PaymentMethod was selected.
You can do that right from the client using https://stripe.dev/stripe-react-native/api-reference/index.html#retrieveSetupIntent