#inderjeet-subscriptions

1 messages · Page 1 of 1 (latest)

glossy peak
silk smelt
#

Hello

#

I want to downgrade the plan at the end of the period so what i have to do for this.

glossy peak
silk smelt
#

$subSchedule = $stripe->subscriptionSchedules->update(
$subscription->id,
[
'end_behavior' => 'release',
'phases' => [
[
'items' => [
[
'price' => $currentPriceId,
'quantity' => 1,
],
],
'start_date' => $startPeriodDate,
'end_date' => $endPeriodDate,
],
[
'items' => [
[
'price' => $priceId,
'quantity' => 1,
],
],
'start_date' => $endPeriodDate
],
],
]
);

#

I am using the above code let me clear one thing i 'm passing the downgrade plan price id and startdate then how it will take subscription billing cycle ?

glossy peak
#

that would change from $currentPriceId to $priceId at the time $endPeriodDate , so yes, that seems correct for what you want

silk smelt
#

I have one more question suppose i have click on downgrade plan button today. but i want to downgrade the plan at the billing cycle then how i will update the downgrade plan in database. i think in this situation i have to use** Webhook** for update downgrade plan in the database. Am i right?

#

@glossy peak Are you there ?

glossy peak
#

yes

#

so yes, you would listen to webhooks I think

#

you can listen to the customer.subscription.updated event

#

that happens when the subscription cycles and switches to the new plan, at that point you can sync your database

silk smelt
#

What webhook event, i have to use for cancel subscription time therefore i have to sync with database.

glossy peak
#

customer.subscription.deleted

silk smelt
#

Thank you, @glossy peak Is it possible to access webhook at localhost ?

glossy peak