#bachir2921

1 messages ยท Page 1 of 1 (latest)

glossy moatBOT
sullen wren
#

Hi ๐Ÿ‘‹

What is the outcome you are trying to achieve?

lofty fossil
#

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.

sullen wren
#

Are you using Stripe Checkout to create the Subscriptions? Or something else?

lofty fossil
#

no, the subscription API

quartz topaz
#

๐Ÿ‘‹ hopping in here since snufkin has to head out

lofty fossil
#

hey

quartz topaz
#

Instead of creating a new subscription on every submit can you check if there's an existing one and use that to complete payment?

lofty fossil
#

aah ! so I can update the price easily in case it changed ?

#

(between both submits)

quartz topaz
#

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

lofty fossil
#

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

quartz topaz
#

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