#icurrytheteam
1 messages · Page 1 of 1 (latest)
Hi there!
No you'll need an extra API call to udpate the customer object: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
If a user has no saved payment methods, and they want to add a default payment method, how would they do that then?
Step 1: create a new PaymentMethod a SetupIntent and attach it on the customer
Step 2: set the customer.invoice_settings.default_payment_method with the new payment method
How will I get the payment method id?
It will be in the SetupIntent: https://stripe.com/docs/api/setup_intents/object#setup_intent_object-payment_method
Let me check, sorry. I didn't see it the first time.
No worries.
So will it be an id of a payment method object, right?
For some reason, I keep thinking that it shows the id of a source
Aren't payment method id's in the form of "pm_123456789" and not "card_123456789"?
Yes PaymentMethods are pm_xxx. But I think if you need a PaymentMethod ID and provide a card_xxx it should also work.
May I have a second to test it out?
Sure
I'm asking this because my subscription flow has to account for two cases.
- The user has entered a default payment method and the subscription will automatically bill the default payment method.
- There are no saved payment methods and the user will have to enter their payment details during the purchase of the subscription.
Oh you are using subscriptions? Then in this case you can set the PaymentMethod as default directly with this: https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_settings-save_default_payment_method
Right, so this helps cover the case when users don't have any paymentmethods attached for they can enter their payment details and it'll automatically be saved as their default method.
May I ask another question?
Sure!
This is a totally unrelated question, but my api key just stopped working while testing. It was working literally a couple minutes ago. Any ideas?
What do you mean by "stopped working"? What's the error message you see?
It's working now, oh
Ok so when I created the SetupIntent, I see that my payment_method field is set to null in the response.
👋 taking over for my colleague. Let me catch up.
Sure
Any questions you might have for me? I can better explain my situation if you'd like.
sorry I'm just reading through
yes this is normal since a SetupIntent is by default meant to help you create/attach a Payment Method to a customer
This is what I expected, hence why I am not understanding what soma said.
If I want to extract the payment method id from the setupintent, then would that only be possible after the payment method is created?
Hmm, sorry if this looks bad but unfortunately I have to run. Should anything come up, I'll ask again later.
yes that's correct
no worries