#PyroFiire
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Can you provide more information about your usecase? What exactly are you updating when the customer arrives on the payment page?
I update this shopping cart, it can contain products (PaymentIntent) or a subscription or a subscription and purchases (I use the "add_invoice_items" key to add additional purchases). It often happens that the customer leaves the payment page to return later. In the case of a PaymentIntent, I update the items and the total with the shopping cart in session. But for subscriptions this isn't possible, so I create a new one. I was wondering if this was a problem.
I believe the deferred PaymentIntent/subscription creation flow can help with this
https://stripe.com/docs/payments/accept-a-payment-deferred
You'd create the PaymentIntent/Subscription once the customer confirms that they want to checkout. The above flow allows you to render PaymentElement without having an Intent attached.
Have you looked into that already?
lmk if that helps or if you have follow ups @next scarab
Ok I see how to do it thanks
Awesome! Glad I could help ๐
Can I ask you another question about subscriptions?
Sure
I did some tests and was able to create a 1-month subscription, then another 3-month subscription for the same product. This creates two subscriptions in Stripe.
Should I check whether the user already has an active subscription in Stripe and tell them to update their subscription, rather than having them check out again and create a new subscription? Are there any other solutions?
So I think I should block the checkout on my site if the customer already has an active subscription that corresponds to a product in the cart. Correct?
And then use this code : https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#change-price
Should I check whether the user already has an active subscription in Stripe and tell them to update their subscription, rather than having them check out again and create a new subscription? Are there any other solutions?
So I think I should block the checkout on my site if the customer already has an active subscription that corresponds to a product in the cart. Correct?
Correct. You'd need to track this yourself and prevent users from creating duplicate subscriptions
You can use this API endpoint to retrieve customer's existing subscriptions
https://stripe.com/docs/api/subscriptions/list