#bruce-zhang_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1217539805915648141
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, yes you can pass in the return_url, https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-return_url when you create the Customer Portal Session. Is that what you're looking for?
yes it is. Thanks.
Yes, you will need to pass a customer ID there
Also I deleted that message because your test mode secret key is sensitive and sometimes bots scrape servers like this looking for exposed API keys. There isn't a ton of harm anyone can do with your test mode secret key but it would probably be a good idea to roll it anyways
is there a way to get the customer id of the current user using code?
I am using next.js
The code I sent you is what I copied from the api reference, not my actual test key
As in the user currenty on your webpage? Or something else
yes, we will redirect the first time user to buy a product on stripe checkout page, and they will become a customer and have a plan. We need an id for each user to open the corresponding portal for the user on stripe, like using an unique email, and each email can have a customer portal once they have subscribed
Ah gotcha, so after the first time they check out there will be a customer property on the Checkout Session after it has completed. You can store that and assosciate it with the user on your site
Keep in mind you do need to set customer creation to always to make sure Checkout makes a Customer https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-customer_creation
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.