#alle00
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
also, this one is a follow-up of: #1179018083944382516 message
๐ happy to help
Hello! Awesome to hear!
Also, what confuses me even more, is when I manually add it through stripe dashboard to the same subscription, eg req_HZkWVgZr1baxcW
it works
actually you can see the -$50 here https://dashboard.stripe.com/test/subscriptions/sub_1OFeRwBUxUDyk36hOoACgFaY
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I've manually added all of the -50$
the request you shared is from another subscription
the first one you shared applied the coupon correctly
am I missing something here?
am I? wait, let me check if I missed something with the subscriptions
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
will get back to you soon, let me just re-test everything, I might have missed something with my test clocks
okay so I've figured it out
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
when it's the SAME coupon it doesn't work
but when it's different it does
it returns 200: req_JdJAIunKLSgljG
but the price is still 300$ instead of 250$
Well you can't 'stack' coupons so that seems expected if you're trying to apply another coupon to a subscription with an already active coupon
but the coupon was a "once" coupon
My guess is we just don't error on those kind of requests
Let me have a look
the flow is
=> coupon lowers it by 50$ (type once, quantity is higher than required)
=> invoice created
=> after 11 months apply the same coupon to the upcoming invoice by adding it onto subscription
=> coupon lowers it by 50$ again instead of just leaving it at full price
Hmm, I think the issue is that the current coupon is still technically active as you're in the same billing period that it applied to
What you likely need to do is fast forward the clock the next billing cycle (2024-11-28 11:34:40) and await invoice.created event and then apply the coupon directly to the invoice: https://stripe.com/docs/api/invoices/update_line#update_lines-discounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I see, just to understand, these subscriptions I made in the test clock are from today => forever, and the real ones are annual subs, does this impact it?
Not sure I understand the difference. The example sub you shared me is subscribed to a yearly price
oh I think I misunderstood what you meant, so because it's been applied 11 months before it's considered "active" until the next invoice is created?
Yes because you're currently still in the same initial yearly billing period when you created the sub and applied the original coupon
ahhh okay
This should work!
understood, well my issue with invoice.created is that I can't test it then with the test clocks
because test clocks don't allow modifications while they are running
Hmm, really? Got an example?
there is no way to apply a future discount for the upcoming invoice right? ๐
if you check this one out
I've wrote about it yesterday
but basically you get a 429
Not until it's created no
That just links to this thread
Yeah you're making an API request to update the Subscription directly. You don't do that
Yeah as I said, that request is to update the sub directly. You don't do that
โ๏ธ
so just to understand, invoice.created does not mean the user has paid for it yet?
I'm just not clear on the invoice lifecycle events, I don't want to end up in a situation where the invoice is charged before updated with the discount
from what I understood the two happen almost immidiately one after the other
Correct yes, for recurring invoices like this we wait ~1 hour before finalising and attempting payments. That's the window in which you can apply the discount via the API from a webhook: https://stripe.com/docs/billing/subscriptions/webhooks#successful-invoice-finalization
Ah I see, do I need to call the finalize endpoint after I apply it for it to go through immidiately, or should I just wait for 3 days, the behavior would be the same I assume just spaced out differently?
It wouldn't be 3 days, it'd be finalised within ~1 hour assuming your webhook where you apply the discount responds with a 2xx:
Stripe waits an hour after receiving a successful response to the invoice.created event before attempting payment. If we donโt receive a successful response within 72 hours, we attempt to finalize and send the invoice.
Of course you can manually call /finalize and/or /pay yourself if you wish
Understood, awesome, thank you so much