#mateusz-kuda_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/1227210985455226921
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
yes
and by acitve i mean everything like end date and usage
Do you want to said that active = true means is valid?
actually the easiest way to check whether the promotion code will apply or not is to use the preview upcoming invoices https://docs.stripe.com/api/invoices/upcoming#upcoming_invoice-discounts-promotion_code
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so basically if it's a new subscription you would pass in everything that you would normally pass to a subscription (customer and subscription_... fields)
Yes i know this
and for new subscritpion we can use during create subscription
and if it's an existing subscription you would pass the subscription ID
Ok, great then
in both cases if you want to make sure that the discount will apply is to retrieve the upcoming invoice before creating/updating the subscription
So if promo code will not be valid, then I will go and error yes? Or I will get full price?
no you would have to check the https://docs.stripe.com/api/invoices/object#invoice_object-discounts on the returned invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and see if it was applied or not
sure let me know if you need any more help