#lola_cleo-default
1 messages · Page 1 of 1 (latest)
Hi! You want to set it as a default payment method for what exactly? To automatically use that payment method for next invoices?
yep exactly
Then you should use invoice_settings.default_payment_method https://stripe.com/docs/api/customers/update?lang=node#update_customer-invoice_settings-default_payment_method
So I would listen to a webhook event to know when the customer has set their payment method, and update the invoice_settings.default_payment_method of the customer.
What event you should listen to exactly depend on your Stripe integration. How are you collecting payment information now?
ok perfect thank you! I have an webhook listening to invoice.paid already
I am not storing any payment information, just redirecting users to the stripe payment page
the invoice.paid event return the invoice object, but im not sure how to get the payment details used from that object. - where can I find this so I can set invoice_settings.default_payment_method?
For subscriptions, we have a guide on how to set the default payment method: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#default-payment-method
In this case it's updating the default_payment_method of the subscription instead of the customer. But it's the same idea.