#adityalystlocdeveloper_33428
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.
- adityalystlocdeveloper_33428, 20 hours ago, 30 messages
- adityalystlocdeveloper_33428, 1 day ago, 38 messages
- adityalystlocdeveloper_33428, 4 days ago, 7 messages
- adityalystlocdeveloper_33428, 4 days ago, 23 messages
- adityalystlocdeveloper_33428, 5 days ago, 5 messages
- adityalystlocdeveloper_33428, 5 days ago, 19 messages
and 1 more
Hi there!
await stripe.subscriptions.update(subscription.stripe_subscription_id, {
trial_end: "now",
billing_cycle_anchor: "unchanged",
});
it's difficult to understand the issue. can you share a concrete example of Subscription ID (sub_xxx) with this issue?
sub_1OMRd5ARWDrZZuiftOGWWCci CHEACK THIS SUBSCRIPTION ID
subscription created 12 dec but i have usage limit in trial if user crosses that limit i want to set trial end now but billing anchor should be same first day of month
well that concept is not something that's built into the Stripe API by default(ending a trial when a certain usage is reported) unfortunately, it would need a custom integration on your side.
We have thesholds (https://stripe.com/docs/billing/subscriptions/usage-based#thresholds) which is similiar but now what you want
you'd need to track the usage you are reporting from your side and then manually call the API to end the trial when your system decides it's time to do so.
if (subscription.trial_trans_count + 1 > subscription.PlansFeature.trial_trans) {
const currentSubscription = await stripe.subscriptions.retrieve(stripe.stripe_subscription_id);
await stripe.subscriptions.update(stripe.stripe_subscription_id, {
trial_end: "now",
billing_cycle_anchor: currentSubscription.current_period_end,
});
i am doing that only
but it resets billing anchor thats the only issue
ending a trial will always reset the billing cycle to the current time yes
there is not really a way to avoid that
you could make a separate API call that sets billing_cycle_anchor, after the API call that sets trial_end:now
make sure to use proration_behavior:none to avoid possible issues
so two api calls first ends the trial and second billing anchor?
yes
hen updating an existing subscription, billing_cycle_anchor must be either unset, 'now', or 'unchanged'?
ah yeah, I forgot you can't do that. The only way to change the billing cycle is with a trial.
how to achive this behaviour not getting
sorry, I didn't understand that sentence.
what to do now?
ultimately this is not behaviour that's really possible to have. Ending the trial will reset the billing cycle anchor. Using a trial is also how you set the billing cycle anchor. So either don't end the trial, or just set trial_end to your current_period_end directly.
actully i have limit in trial so i have to make use of active plan so that one is needed
sorry, I didn't understand that sentence.
can we set start date and end date manually after trial end?
no; The only way to change the billing cycle is with a trial.
: https://stripe.com/docs/billing/subscriptions/billing-cycle#add-a-trial-to-change-the-billing-cycle
can you help me if customer exceed the limit will charge that customer is this possible in metred
i will give the no of api hits done by the user
maybe have a look at https://stripe.com/docs/billing/subscriptions/usage-based#thresholds from earlier and see if that works for your use case.
will create this while creating subscription
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
is it possible to add this threshold only for trial period
no.
@gusty fern I've just open it
so we can add threshold in trial then how can we solve this issue basically i want to set usages limit in trial
@tulip meadow ?
You need to track the usage in your integration in that case
i have usages track
basically i want to do when limit exceed trial end now
that one is working but not able to set billing anchor
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
yes please, could you share more details/ concrete example on this ?
I have my application in which i am charging user according to number of api hits done by the user.
So my plan is flat rate+metered volume usages.
I have billing anchor at starting of every month.
e.g i have one plan in which $99 is fixed and 0.02 per api hit.
So if user subscribed to plan i am taking 99 upfront then 0.02 * no of hits.
In every plan i am giving 14 days trial with 25000 free hits.
So if user cross this 25000 hit before trial end i want to end the trial.
So user can use actual plan and will charge accordingly.
But when i am ending my trial my billing anchor gets effected.
eg DATE -1 user subscribed to plan till date-14 user have trial but user cross this limit on day 7 so i want to end trial and user plan will be from day 7 to next month 1st
When i am ending trial it behaves trial end date + 30 days
just issue with billing anchor
i want billing anchor for every month first day when i am ending trial early
Thanks for sharing these details
now could you create a concrete test using Stripe test clock
But when i am ending my trial my billing anchor gets effected.
and share the requestId that is affecting the billing anchor and what are you expecting.
req_YLpX1rA3q3AHmx this this id
i ended trial but billing goes to 12 jan but i want 1 jan
You can update the billing cycle anchor when updating the Subscirption
But you can update it only to now the datetime on which you made the request
you can't update it to a feature date
is it possible to billing should 12 - 1 jan when trial end
This is a custom period, while you are using a monthlt prices
Try using subscription scheduler