#sergixel04

1 messages · Page 1 of 1 (latest)

subtle ploverBOT
#

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.

olive basin
unique hedge
olive basin
#

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.

unique hedge
#

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?

olive basin
#

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.

unique hedge
#

Aightt will test it, thank you

#

What parameter I have to use to update priceId subscription?

olive basin
unique hedge
#

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

olive basin
#

The error message is correct. The value you're providing for billing_cycle_anchor is not now and is not unchanged.

unique hedge
#

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?

olive basin
#

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.

unique hedge
#

Thank you!

#

I have try it, but now I got this error :(:

Changing plan intervals. There's no way to leave billing cycle unchanged.

olive basin
#

Yeah, if you're changing intervals you are, by definition, changing the billing cycle.

#

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.

unique hedge
#

Thank you so much!