#bachir2921
1 messages ยท Page 1 of 1 (latest)
Hi ๐
What is the outcome you are trying to achieve?
I want to implement the "one payment intent per checkout flow" idea for subscriptions, but I don't know how. Today, we create a new subscription on every submit, so if the first fails and the second succeeds, we end up with two subscription objects on Stripe.
Are you using Stripe Checkout to create the Subscriptions? Or something else?
no, the subscription API
๐ hopping in here since snufkin has to head out
hey
Instead of creating a new subscription on every submit can you check if there's an existing one and use that to complete payment?
Ah, that changes things a bit - if you have a subscription where the first payment wasn't successful (so status: incomplete) then you can only make minor modifications to it (you wouldn't be able to change the price). If you want to change the price it'd be better to cancel the existing incomplete subscripton and just create a new one
Ok we'd still need to create a new subscription on every submit in this case. But how do I protect against "double payments" in the subscription case ?
For one-time payments, reusing the payment intent guarantees that I won't confirm it twice by mistake and take double the money
As soon as you create a new subscription, I'd recommend canceling the old one - that'll guarantee you only have one sub in place to accept payment for