#ethan_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/1451047399245090856
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hey there, why don't you include the discount upon subscription creation?
is there a reason the discount is added after the subscription is already created?
There is a reason yes but it's admittedly a bit of a weird case. Basically we have a fully custom checkout UI, and the order of operations in that flow means that the subscription needs to exist before we know whether the customer is going to apply a discount or not.
Because the discount code input is adjacent to the address/card inputs (using <Elements> for those), which we can't render without the client_secret from the subscription's latest_invoice.
If there's no other way for me to do it, then I suppose I could move the discount code input to an earlier point
I see, give me a moment, let me run a test
Sure, thank you
thanks for waiting, I tested with default_incomplete and looks the promo code added after subscription creation will not apply to the subscription first invoice. It will only apply to the subscription's next invoice
So I recommend to move the discount application earlier, so that the subcription can be created with the discount
Okay, and there's no way to delay the finalisation of that first invoice?
Nope, you can't delay finalization of the first invoice if your subscription charges automatically. You can only delay finalization of the first invoice if you set collection_method: "send_invoice" on the subscription, which means Stripe won't attempt to charge the customer immediately โ this scenario then gives you time to edit the first invoice
Okay, which I'm guessing doesn't make sense for us to do if we want the payment to be processed when they hit confirm
yup