#anndonnelly
1 messages · Page 1 of 1 (latest)
Hi there. Just catching up on the earlier thread!
Let me know if there is any further information that would help
Sorry for the delay!
I see you use an environment variable for your success URL
Do you know if the value of that variable includes {CHECKOUT_SESSION_ID}? https://stripe.com/docs/payments/checkout/custom-success-page#modify-success-url
FRONTEND_URL=https://tekniverse-dev.teknikio.com
Got it, that makes sense. This matches what's happening in the video and what I see in your code: customers are being redirected to https://tekniverse-dev.teknikio.com/profile/settings; see line 3
Yes correct
I see in the documentation how to create the success url, i am just trying to couple this with the redirect to that page
I assume this is possible?
You can adjust the success URL to include the session ID
For example, if you adjust line 3 to:
...'/profile/settings?session_id={CHECKOUT_SESSION_ID}';
hold on, let me backtrack. redirecting users to /profile/settings means they will always be redirected to the settings page
If you want to display a success page with information about their payment, you should create a separate success page at https://tekniverse-dev.teknikio.com and adjust line 3 to something like ...'/success?session_id={CHECKOUT_SESSION_ID}';
Step 2 corresponds to creating that custom success page: https://stripe.com/docs/payments/checkout/custom-success-page#create-success-page
I wasn't going to create a success page
got it, okay
potentially a modal based on tier change
I just want to redirect but need access to stripeSubscriptionId
got it
If you retrieve the Session object using the Session ID, this should include the subscription ID: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-subscription
The subscription is expandable so, if you need to see the full subscription object, you can: https://stripe.com/docs/expand
So if I append this it will still redirect appropriately?
Customers should still be redirected to https://tekniverse-dev.teknikio.com/profile/settings, yes
Following product comes from the frontend, where is CHECKOUT_SESSION_ID coming from in order for me to have access to it on line 23
👋 stepping in as roadrunner needed to step away
You won't have the Session ID ahead of creating the session. However, by appending {CHECKOUT_SESSION_ID} to the end of your Success URL, the session ID will be included on the actual redirect URL after the Session is completed
Your code looks good to see that Session as a URL param. Recommend trying it out