#Benoît
1 messages · Page 1 of 1 (latest)
Yes
you can update the customer's invoice_settings.default_payment_method
https://stripe.com/docs/api/customers/update#customer_update-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
did it work?
Yes it worked !
Now i'm searching how i could set the card as default when i created it by a token from StripeJs
The only solution i found until now is to remove the elder ones before creating the new one
why are you still using tokens?
🤷♂️
This code has 4 years, maybe it was the only solution at this time ? I d'ont know
actually there is
you can use the Customer's default_source
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes i saw this, but it's said : "Provide the ID of a payment source already attached to this customer"
So i can't create the source AND set it as default in the same time, as i don't have the source ID yet
you'd have to first create the source from the token https://stripe.com/docs/api/sources/create#create_source-token
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
attach the source to the customer https://stripe.com/docs/api/sources/attach
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes that's what i do now, but i searched for a way to do this in a unique API call. That's not possible it seems
the first API call is necessary, so you transform the token to a source
you can combine the last two with one call https://stripe.com/docs/api/customers/update#update_customer-source
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.