#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.
- alle00, 5 days ago, 13 messages
Hi, let me help you with this.
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_9AT5ctflJ3x3tA
You have to wait until the test clock finishes updating basically.
but this is done via my webhook and an API, so there's no real way to test it with the test clock I assume?
I don't know what you're doing exactly so it's hard for me to tell.
You can set a delay before you're trying to apply the coupon.
I'm doing the following:
webhook listens to "invoice.upcoming"
when triggered I find the subscription associated with the upcoming subscription, check if it had a specific coupon for 25% off then I apply a new coupon to that subscription
req_9AT5ctflJ3x3tA
not sure if you can see what was sent via this request
but basically I just applied a coupon to the subscritpion
or at least tried to
but the endpoint responded with a 429
You can make this call but you need to wait for the test clock to stop advancing
Basically you can either:
- Keep retrieving the test clock until its status is
readyhttps://stripe.com/docs/api/test_clocks/retrieve - Just keep making your coupon update request until it succeeds
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 typically space my calls out by 1 second when I get that error
hmm so my best bet is to set the end time to be after invoice.upcoming and before invoice.created and then wait for the test clock to finish and call the endpoint again?
this obviously wouldn't happen in a real env. due to the fact that there is no test clock and the endpoint would probably return a 200 though?
Now that I've thought about it more, I think it may be better to wait for invoice.created
The invoice should start in a draft state at which point you can add the coupon directly to it
After invoice.upcoming there isn't an invoice yet, so you could add the discount to the customer that will get the invoice but that would be more indirect
well I just add the coupon to the subscription itself, the invoice.upcoming is set to be a month before the annual sub expires, so plenty of time for them to change their minds etc. Now that I think about it, maybe I can just use a setTimeout and set it to like 10s so that the test clock has time to finish
Ah gotcha, so I can see how invoice.upcoming would make more sense here
from what I understood it's in a draft state for a very short while?
yeah exactly, they don't really have to continue with the subscription, we just give them a loyalty coupon because they subbed for the first year
I also have one more question regarding this, in some scenarios we have a 100% off coupons on these subscriptions, and we'd like to extend them (subscriptions) for a year. What would be the best way to do it, I'm assuming changing the subscription end date still charges the customer?
Not immediately sure what you mean here. Can you tell me more about how you want this 100% off scenario to play out?
If you set the 100% off coupon directly on the customer, and the coupon's duration covers the time that the subscription will cycle, the user should immediately have their next invoice paid without any charge when the cycle happens.
I have a script that does the following:
- finds all the applicable 100% off subscriptions with the exact coupons
- extends them for a year from today (for free)
we don't really have good connections to customer objects due to the lack of understanding when first implemented so we can only rely on Subscription objects
I feel like it's 10x easier to extend it at the end of the current cycle by just adding a 100% off coupon, but I'm not sure yet if the "year from today" is a concrete requirement, if so I'm not sure what the best approach is, I've tinkered in the dashboard with it and I see it charges an X% of the total 100%
If they already have the coupon applied that may change things. Looking in to how
And you are applying this coupon by making an update customer call and passing a coupon ID to the coupon parameter?
so the coupon was a "once" coupon and was already applied
it's not applied anymore
but they get a subscription for free if they buy a service from our partner
which means we have to artificially generate a "free" subscription
and when they renew that service
we will need to renew on our side
the first time we gave them 100% off coupons but now that they are already in the system we are looking for an alternative that doesn't require them to do anything on their side
Have you tried applying it again the same way the original coupon was applied? For a once coupon we may remove it from the customer after that initial use so you may just be able to add it again the same way
no, haven't really done anything on the implementation side, was hoping to get an idea on what the best approach is. I could apply the coupon again, then extend it for X amount of time and it will still be 0$ right?
if the coupon is 100% it doesn't matter if the sub is extended for a month or a year
so probably something like:
billing_anchor: "now",
coupon: "id"