#parameter666_payment-link-restrictions
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/1234841894337642507
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, let me help you with this.
There's no built in functionality for this, unfortunately. One idea is to check if a non-expired Checkout Session exists with a given product, and prevent a new Checkout Session from being created.
Ok. So I was thinking that I need to create a product to achieve this.
I can handle some locking on my side but I think the product probably solves it better.
I haven't tested this yet though.
Maybe I can set the products "active" value.
I would say, if the products are unique, it's best to keep track of them on your side. Then when you create a Checkout Session, you can use price_data.product_data to create one-time Products and Prices on the fly: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data
You can save your own product ID for locking purposes in Checkout Sessions metadata
Hi there ๐ jumping in as my teammate needs to step away soon.
I'd recommend taking a look at using a Payment Link. When creating them you can now specify the number of completed sessions that they're allowed to lead to:
https://docs.stripe.com/api/payment_links/payment_links/create#create_payment_link-restrictions-completed_sessions-limit
I'd suggest setting that to 1 and test if that behaves the way you're hoping.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.