#nickdnk_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/1405198357365788752
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
My plan was to have it check if I have a coupon (or discount object?) that matches the percent I want (by fetching them and iterating them), then applying that coupon ID to the sub
if not, create the coupon, then do it
It doesn't seem like a very good solution though
These are metered subscriptions, so I can't just calculate the discount amount as a line item at that time
We have https://docs.stripe.com/api/discounts/subscription_delete to delete a discount from a Subscription
To add you can update the Subscription directly
Yea I just found that. So I would just if discount == 0 and subscription.coupon != null then delete discount, else create/apply coupon
but is it correct that I would/should fetch coupons and iterate to find one that matches, or am I just expected to create a new one every time? Both seem kind of clumsy