#janeh - subscriptions
1 messages ยท Page 1 of 1 (latest)
Hi there!
Can you give me more context on how you are creating subscriptions? And when are you updating the payment method (for the first invoice or later)?
This is for the first invoice, i.e. when the subscription is initially set up
And how do you create the subscription? With the Subscription endpoint and the Payment Element?
We're using the checkout page
You mean Stripe Checkout Sessions?
yes
Can you share a subscription ID where the card failed?
sub_1LdBNhKDwC0O9XQyAZCvKKIE
Thanks! Give me a few minutes to look into this.
Can you clarify your flow?
- You created a Checkout Session for a subscription
- In the Checkout form, you used this test card 4000 0000 0000 0002
- And this created a subscription with a failed payment on the first invoice
?
When I try this, the subscription is not created and I stay on the Checkout page
yes that is the flow we followed. When payment failed we then clicked the back button on the page (not the browser back button). When we click this back button it gives a browser message confirming whether we wanted to leave the page, we clicked "leave now" and we were taken back to our application
So I don't understand how you managed to create the subscription, since it shouldn't be possible with Checkout Session unless the payment actually succeeds.
Speaking with the dev - she says she is creating the stripe customer first and passing the customer id to the checkout session - don't know if that information is helpful
Trying to reproduce this on my end...
we are looking to see if the subscription gets created on failure if we don't click the back button...
dev has confirmed that subscription is created on payment failure even if we don't click back (so it is unrelated)
Thanks, still looking into this, but this is odd.
Hi there ๐ apologies for the delay. My teammate needed to step away so I'm jumping in. I'll continue looking into this. Thank you for your patience.
Thank you for your patience while I dug into this.
It is expected that failed payments still result in a Subscription being created, as we need the underlying objects to attempt the payment.
The Subscription that gets created though will remain in an incomplete state until a payment is completed, or it will move to a canceled state if no payment is completed within 23 hours.
You could route your customers to a new Checkout Session, and ignore the Subscription that was created from the failed payment.
so the only way forward to manually re-attempt the payment with a new payment method is to create a new subscription and to ignore the old one?
also - WRT the 23 hour window - how would/could a payment be made on the original subscription within that window?
It's an option, but there are others.
You could also retrieve the hosted_invoice_url from the Invoice associated with the Subscription, and then direct your customer there:
https://stripe.com/docs/api/invoices/object#invoice_object-hosted_invoice_url
Or if you wanted to build your own flow, then you could retrieve the Payment Intent associated with that Invoice and use it in conjunction with the Payment Element to collect payment.
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements (instead of creating a new Payment Intent as this guide suggests, you'd instead pass the client secret from the existing Payment Intent)
ok thanks, we will take a look into this and get back to you if we need any more help