#Jacob-subscription
1 messages ยท Page 1 of 1 (latest)
Hi there, is this question about billing portal or checkout? for context, the customer can't perform checkout from billing portal.
Sorry, mistake. Checkout sessions
I only want to let the customer purchase one subscription per organization. I have a unique org ID in the metadata
No worries, once the checkout session is completed, the customer can't use the same checkout session URL for repeated subscription purchase.
My fear is they generate two checkout session URLs, which has happened before
Do I need to make sure the previous session ended then?
You can also set an expiration for your checkout session https://stripe.com/docs/api/checkout/sessions/create?lang=node#create_checkout_session-expires_at
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thanks, so just store whether they have an active session before generating a new link?
Yes you can do that, and you can also listen to customer.subscription.created event and then expire other pending checkout sessions if any.
Oh neat, that's the best solution
Thank you! Not sure where you are but didn't expect to get help at 10 pm EST ๐
Welcome, feel free to drop by when you need help!