#TonyS
1 messages ยท Page 1 of 1 (latest)
The thread was https://discord.com/channels/841573134531821608/841573134531821616/threads/1092428667092746250
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Hello ๐
How can I help?
Hello Hanzo, as I Mentionned I have an issue with subscription schedule and end_date. it does not seem to work.
To sum up, we want to create a schedule for a customer with : 1. A monthly subscription
- At the end of this subscription switch to a yearly subscription but with a specific end date (less than 1 year, could be 3 month as it could be 7 month)
are we doing the right thing?
I am trying to load up the previous discord thread but the UI is not loading it for me.
Can you give me a short description of what you've tried already?
I can you the req_id maybe it will be clearer
Sure
req_SUwhCyHzmN9B1m with the sub_schedule sub_sched_1MsmiODhXwH3fVpP0H8SoyGX
{
"phases": {
"0": {
"items": {
"0": {
"tax_rates": {
"0": "txr_1LFG8TDhXwH3fVpP7QeJxpVw"
},
"price": "price_1Mk4ubDhXwH3fVpPum3WDxJd"
}
},
"iterations": "1"
},
"1": {
"end_date": "1707692400",
"items": {
"0": {
"tax_rates": {
"0": "txr_1LFG8TDhXwH3fVpP7QeJxpVw"
},
"price": "price_1Mk4sZDhXwH3fVpPOVfA1ihV"
}
},
"coupon": "SWITCH-BASIC-PRO"
}
},
"start_date": "now",
"customer": "cus_N9mvKlzl2fWHJF"
}
hmm I see that you're creating two phases with the timestamp calculated accordingly
As you see in this example we specified a end_date in the second phase
"end_date": "1707692400",
which means we want this specific subscription to end the 11 of february
but it does not work as intended, the subscription last a full year
and does not end at the specific date
your colleague advised us to try the strip clock to check if it was an UI issue or a real issue
I confirm to you that this is a real issue, the clock does not renew the second subscription at the correct time
I think you also need to define end_behavior too
Set it to cancel
https://stripe.com/docs/api/subscription_schedules/object#subscription_schedule_object-end_behavior
This is not our issue
our issue is the following
We want to have a monthly subscription and then a defined yearly subscription that does not last a year
But the subscription should still be "renewed"
we just want to decide "when"
The question is what is end_date used for usually? Are we understing this field the right way?
end_date specifies the end date of a phase (not a subscription)
It tries to move on to the next phase once the phase reaches the date specified
Not sure what happens if there are no next phases to move on to..
It seems it does nothing
how can we say that the next subscription linked a specific phase will last X Days? Is there a way of properly doing this?
The example that you shared above for the subscription schedule is not linked to a test clock as such, can you share the ID that you tested with the test clocks?
With the test clock, the subscription did move to the yearly price
yes
but it sould have "renews" in march 2024
we try to "shorten" the subscription time
of the yearly subscription
but the end date timestamp you've mentioned calculates to 2024-05-02
end_date: "1714687200"
You may want to double check how you're calculating the end date
Ok I'll do a double check since we did a lot of testing all our customers for this case are a little bit around the place
But we did several testing to be sure it wasn't an issue on our end and it was always the same
Do you know if specifiying end_date should work or not?
It should
I'll check right now and come back to you in 1 sec
NP! ๐ Take your time
could you please check this customer
cus_Ne7Fx52FuUTbs8
we provided the end_date : 1683724037
which is 10 may 2023
I see the end_date is set correctly on the phase..
Can you forward the clock to May 11th 2023?
I think this is def a dashboard bug. If you look at this event
https://dashboard.stripe.com/test/events/evt_1Msp5RDhXwH3fVpPhFJOcWNL
The subscription did get released from the schedule once the phase ended.
I think you probably need to add a third-phase that renews the subscription on a given price. The schedule end date only ends the phase. I don't think it modifies/ends the subscription cycle as such
Your usecase is quite niche so there aren't any best practices for this as such ๐ As long as it works, its the best option.
np have a great day
You too, good luck ๐