#sergixel04
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.
- sergixel04, 1 day ago, 4 messages
- sergixel04, 1 day ago, 11 messages
Hello! We have detailed documentation about how billing cycle changes work here: https://stripe.com/docs/billing/subscriptions/billing-cycle
Alright https://stripe.com/docs/api/subscriptions/update
If I only have priceId can I update a subscrirption with that?
Yes, unless the Price isn't compatible and you get an error. Best way to know if it will work is to try it in test mode and see what happens.
Thank you! And if I understood how billing cycle work correctly.
I have to get the timestamp of next payment date when the subscriber has a monthly plan.
Then, update the subscription with the new priceId (yearly plan), and passing that timestamp to the billing_cycle?
In order to charge the user for the yearly plan, when the monthly one ends.
This should work?
I can't tell you what will or won't work, there are too many variables. The best way to know what will happen is to try in test mode.
Aightt will test it, thank you
What parameter I have to use to update priceId subscription?
You need to specify the Subscription Item you want to change: https://stripe.com/docs/api/subscriptions/update#update_subscription-items-id
And the Price ID you want to switch to: https://stripe.com/docs/api/subscriptions/update#update_subscription-items-price
Why I am getting this error?
When updating an existing subscription, billing_cycle_anchor must be either unset, 'now', or 'unchanged'
$stripe->subscriptions->update(
$subId,
[
'billing_cycle_anchor' => $date,
'items' => [
[
'id' => $subscription->items[0]->stripe_id,
'price' => config('app.yearly'),
],
],
]
);
$date contains timestamp which should be accepted
The error message is correct. The value you're providing for billing_cycle_anchor is not now and is not unchanged.
But I would need to change that value
Because I need to charge the user when the monthly plan ends
For example, like Netflix, you update your monthly subscription to yearly plan, but you will not be charged until next payment (when the monthly plan ends)
So If I'm not able to update billing_cycle_anchor, how could I reach that?
You can update it. You can update it to now to bill them immediately.
Or you can make it unchanged to not change it.
And bill them later.
Thank you!
I have try it, but now I got this error :(:
Changing plan intervals. There's no way to leave billing cycle unchanged.
Yeah, if you're changing intervals you are, by definition, changing the billing cycle.
You might want to look at Subscription Schedules: https://stripe.com/docs/billing/subscriptions/subscription-schedules
You can use a Subscription Schedule to schedule future changes to a Subscription. That will let you switch to the other interval later, like at the end of the current Subscription period.
Thank you so much!