#dulatello08
1 messages · Page 1 of 1 (latest)
Hey, sorry that's long and I haven't been able to follow. Can you put it down in bullet points and describe a bit more clearly?
yeah sorry i might have been confusing, ill try again
I am currently migrating to the Elements API in my React application. As part of the migration, I want users to subscribe while they sign up. So, when users enter their email, password, and billing address, I need to send this data to the server to create a Stripe customer. However, the challenge lies in allowing users to choose their subscription when entering their credit card details.
To achieve this, I understand that I have to fetch a new payment intent for each subscription option. But here's where it gets confusing: Would I need to request a new payment intent every time the user selects another subscription from the drop-down menu? Additionally, I'm unsure about creating a default payment intent for the initial setup.
Have you taken a look at the subscription integration guide? https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Yes
This doc provides guide about creating the prices, creating subscription to get payment intent and pass client secret to the Payment Element to collect the payment.
Which step are you facing issue?
How should I handle this dynamic thingy when user changes subscription they want?
Like from drop down
So payment intent is already created for default subscription but then it kinda needs to be updated
How would I do that
How should I handle this dynamic thingy when user changes subscription they want?
This should be handled by your own system to provide the dropdown option.
Alternatively, Stripe offers pricing table for easy integration: https://stripe.com/docs/payments/checkout/pricing-table
Yeah, I have no problem with that. How should I update payment intent?
Thats like already created
If you wish to update the subscription, you may use update subscription API: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
Hmm, I'm not sure we're on same page. I want user to be able to change what subscription they are subscribing to just right before entering their credit card details. And to render paymentelement I should provide clientSecret which comes from payment intent.
And also to confirm payment I need payment intent
Why don't you only create subscription when the customer confirms his/her selection and right before entering the card details?
Hmm, I think you got a point there... So like I will display drop down to select subscription and then after user chooses request server for payment intent and show credit card form. That works. BUT.. What if user wants to change subscription they chose after choosing it. So I will have to update payment intent anyway, and I have not a idea of how would I do that
For initial subscription creation, it's not possible to update the subscription or its payment intent. Subscription can't be updated when it's in incomplete status. You can only cancel the old one and create new one.
Subscription can only be updated to new price when the customer makes the initial payment
Hmm thats not really convinent But i think i might have thought of a work around, I will create new subscription and on server side, delete subscription that didnt get completed, I really think that will work, and thanks for your support, it was helpful, i think this can be marked as solved now. thanks again