#Vasil

1 messages · Page 1 of 1 (latest)

sleek tulipBOT
snow crescent
#

Can you explain what exactly you mean by 'upgrading user subscription' and which data you require in your webhook?

river rain
snow crescent
#

Sure! Then a customer.subscription.updated event would fire to reflect those changes made

river rain
#

But should we make sure that it's paid by waiting for invoice.paid? Or customer.subscription.updated - is the correct point when all required actions (user paid etc.) accomplished?

snow crescent
#

This is why I asked it depends on what data you need and what action you're taking from the event

#

If you're awaiting payment confirmation following an immediate upgrade, then yes invoice.paid

#

invoice.paid will always fire, even for zero amount invoices (trials, discounts, etc)

#

(don't use invoice.payment_succeeded)

river rain
#

ok, now I understand, thank you
one more question: how can I upgrade (not cancel) user subscription in the end of period and not immediately?

snow crescent
#

I think you can set the billing_cycle_anchor to the timestamp you want duration the update, and also pass proration_behavior: 'none'

river rain
#

and in this case if I request user subscription thru API how can I understand (which fields to examine) which is current price/plan and which one is next month?

snow crescent
#

Well assuming that update call is successful the items would reflect the new plan(s) and there'd be no reference to the old/current plan(s)

river rain
#

but in this case when I receive customer.subscription.updated? once new plan started?

snow crescent
#

No, immediately after your API call to update

#

With a schedule the actual update wouldn't happen until the scheduled start date of that phase

#

And you can better manage/track which plans a user is on or is going to be on

river rain
#

and in this case what plans will I see if request user subscription thru API ?

#

let's say user will be switched to new plan in 2 days, but now he is still on old plan

snow crescent
#

You'd see their current plan. You'd want to query the schedule to see their future upgrades you have schedules

river rain
#

ok, thank you