#andrea-skuola - subscription
1 messages · Page 1 of 1 (latest)
sub_1LKehGK6jaF9EpCmydFO84Kp
now is in past due, I only put forward the test clock
then if i retry charge it will succeed
It looks like the subscription and the customer don't have a default payment method set, so it's expected that the payment fails.
A simple fix is to use payment_settings.save_default_payment_method when creating the subscription to automatically save the default payment method: https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_settings-save_default_payment_method
the value needs to be on_subscription?
Yes, this way the payment method is saved on the subscription, and then will be used for all future invoices.
Another option would be to manually set the default payment method on the customer with: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
But that requires a little more work.
I have already set the latter
In the subscription you shared, the customer does have a payment method attached, but it's not set as a default, so it won't work.
To be a default payment method, it needs to be set in invoice_settings.default_payment_method (see link I shared previously)
One quick way to check this: if you look at the customer in the dashboard, do you see a "default" label on the Payment Method? Something like this: