#hritik-9_webhooks
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/1351894326728196198
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Not sure I understand what outcome you want. You want to offer a trial period in the middle of a cycle of an existing subscription?
yes Its a referral module for one of my project.
Clients paid the 2.99 subscription amount for a month and in middle period he refers to someone , and that person has taken a subscription .. now this user has to get 30 days trial period. ....
I have added 30 days on that subscription , now their next recurring subscription amount is proration amount i.e 1.09 something.
And the requirement is it should be 0 because we have to give 30 days free for next recurring subscription
Can you share an example sub_xxx you're adding the trial to?
sub_1R3wxKI1LleRJFLRFlPE6dK5
for this i have added the 30 days trial perios
and its saying next invoice is 0.01
Now i want to add 30 days for sub_1R172TI1LleRJFLR1xnaF2WC subscription,
its end date is 10 april...
the 30 days should be from 10 april.. and on 10 april recurring amount should be 0 right
So you want to schedule the trial to start at a specific date/end of the period, as opposed to now?
yes,, trial need to start at their next payment date
Got it. When you use the update endpoint/method the changes are applied now. If you want to schedule a trial start then you have two options:
- Use a schedule
- Manually delay the update to the subscription until the end of the period and apply the trial then
help me with query
$updateSubscription = $stripe->subscriptions->update(
"Sub_id"
['trial_end' => $timestamp]
);
Hi, can you add more context here? When you try making the request, do you see an error?
No,I havent tried
So let me know if this works or not,
1)my client "Smith" had taken a subscripion of 10th March, 2.99 paid sub_1R172TI1LleRJFLR1xnaF2WC
2)Now they has referred to someone, and suppose that user takes subscription, i want to add 30 days free trial to "Smith's" subscription.
what should i do ?
my current code is take next_payment_date of subscription , and add +30 days in it and add that timestamp to his subscription. trial_end key
will this works?
Yes, that works if you know the details upfront to calculate the trial_end date.
There are a couple of other ways to achieve this. You can either update the existing subscription and pass in a discount for that 30-day trial: https://docs.stripe.com/api/subscriptions/update#update_subscription-discounts
Or, you could use subscription schedules: https://docs.stripe.com/billing/subscriptions/subscription-schedules and phases
check for id sub_1R172TI1LleRJFLR1xnaF2WC
he took subscription on 10 march, and i added 30 days trial period after next payment date i,e 10thApril it comes 10 May,,
and i added 10th May's timestamp as trial_end and updated the subscription,
not its showing next invoice is
$0.87 on May 10 How???
That is due to a customer invoice balance from this invoice, https://dashboard.stripe.com/test/invoices/in_1R4MpwI1LleRJFLR3ZYFB3Si
You can read more about it here: https://docs.stripe.com/billing/customer/balance
what if i want to add 30 days started at 10april to 30 days
so on 10th march it should charge 2.99
I highly recommend that you test these on your end and review the documents I shared above. This gets easier as you play around and we have this Test Clocks function, https://docs.stripe.com/billing/testing/test-clocks that allows you to advance time to make testing easier
yes but i need solution
I provided the solutions above, and you'd want to test your specific business use case from it using your test api key
what is proration_behavior none?
It disables prorations, https://docs.stripe.com/billing/subscriptions/prorations
can i used this with trial_end
$updateSubscription = $stripe->subscriptions->update(
$referralUserSubscriptionData->subscription_id,
['trial_end' => $timestampForReferralUser, 'proration_behavior'=>'none']
);
Are you able to try please?
trying now
Sounds good