#hritik-9_webhooks

1 messages ¡ Page 1 of 1 (latest)

junior thistleBOT
#

👋 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.

hearty mural
#

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?

fast badge
#

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

hearty mural
#

Can you share an example sub_xxx you're adding the trial to?

fast badge
#

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

hearty mural
#

So you want to schedule the trial to start at a specific date/end of the period, as opposed to now?

fast badge
#

yes,, trial need to start at their next payment date

hearty mural
#

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
junior thistleBOT
fast badge
#

help me with query
$updateSubscription = $stripe->subscriptions->update(
"Sub_id"
['trial_end' => $timestamp]
);

short tapir
#

Hi, can you add more context here? When you try making the request, do you see an error?

fast badge
#

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?

short tapir
fast badge
#

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???

short tapir
fast badge
#

what if i want to add 30 days started at 10april to 30 days

#

so on 10th march it should charge 2.99

short tapir
#

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

fast badge
#

yes but i need solution

short tapir
#

I provided the solutions above, and you'd want to test your specific business use case from it using your test api key

fast badge
#

what is proration_behavior none?

short tapir
fast badge
#

can i used this with trial_end
$updateSubscription = $stripe->subscriptions->update(
$referralUserSubscriptionData->subscription_id,
['trial_end' => $timestampForReferralUser, 'proration_behavior'=>'none']
);

short tapir
#

Are you able to try please?

fast badge
#

trying now

short tapir
#

Sounds good