#code-subscription-schedule
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Hi Snufkin_stripe hope you are doing well!
so basically I explain you what I try to do but I would love some confirmation about what I do
The objective is in a referral program to give some "free time" to my users. After discussing here it seems that the best option is to add phases to the subscription with trial periods
So my first question is: If a phase is planned with a start_day equal to the subscription collecting day am I sure that the update will be done BEFORE Stripe try to collect the money or I have no guarantee?
example:
Subscription every month collect 20$ the 15th of the month, I add a phase starting the 15th of may adding a 10$ item, am I sure that the 15th of may bill will be 30$ or it's not sure?
That would dependo n how you structure the Subscription Schedule.
If you end the phase that has the $20 charge and start a new phase that totals $30 at the time the next invoice is generated then that should work as expected
That being said, Subscription Schedules are rather complex so I would HIGHLY recommend testing them thoroughly using Test Clocks
https://stripe.com/docs/billing/testing/test-clocks
Yeah I plan to test it ๐
Ok so if I have this subscription at 20$ per month:
{
"id": "sub_1NNI9GLNSqtKef5aXLBG8JXs",
"billing_cycle_anchor": 1687796264, # 15th of january 2024
"billing_thresholds": null,
"cancel_at": null,
"cancel_at_period_end": false,
"canceled_at": null,
}```
And modify it like this:
stripe.SubscriptionSchedule.create(
customer="cus_GBHHxuvBvO26Ea",
phases=[
{
'start_date': 1577865600, 15th of march 2024
'end_date': 1580544000, # 25th of march 2024
'trial_end': 1580544000 # 25th of march 2024
},
],
)
Do we agree that the behaviour will be:
15th of january: customer pay 20$
15th of february: customer pay 20$
15th of march: customer pay 0$
25th of march: customer pay 20$
25th of april: customer pay 20$
And so on
which basically gave him 10 days free
Hi koopajah ๐
(I edited my example I was modifying a schedule in place of creating it
code-subscription-schedule
@tardy dirge the best approach really is to just try it
https://stripe.com/docs/billing/testing/test-clocks will let you advance time and confirm the behaviour you expect
Yeah I tried it but it's not possible to make a schedule with trial through the dashboard but I just realised that there is the WebCLI I will try through that
sounds good!