#mathankumar-plan

1 messages Β· Page 1 of 1 (latest)

severe beacon
#

What plan are you referring to exactly?

unkempt jasper
#

I mean subscription plan!

severe beacon
#

You mean updating the Subscription billing cycle? I am asking because plan is a term used for Plan API vs Price API which is slightly different

unkempt jasper
#

No, not updating the subscription plan, its upgrading (changing plan)!

severe beacon
#

Yes then the old setup will be discarded. You can easily confirm it by the Upcoming Invoice API

unkempt jasper
#

discarded ?? Okay, that current will be expired?

severe beacon
#

I meant the previous setup. Not sure if I am following. Could you give a detail example? What subscription id, what change do you make? And what's the expectation?

unkempt jasper
#

for example, I subscribed to one plan and I need to change to another plan so In this scenerio, do I need to cancel that previous subscription plan or expire that current_period_end date from my product?

severe beacon
#

So, just upgrading would work. Stripe will calculate the proration if any

unkempt jasper
#

It's okay but I used usage-based billing with a flat_amount?

severe beacon
#

So it will be proration between old-new usage-based plan.

#

Hmm I am not sure what would be the result. Can you try in test mode?

unkempt jasper
#

No how can try this scenario from my product for example do I send proration_behavior with my next plan?

severe beacon
#

You simply simulate your use case, no? Create Sub with usage-based + flat fee, then advance the time into middle of billing cycle, then make the change, then observe the result

#

If you wish to not do proration at all, you can pass proration_behavior = none and forget all the headache

#

I am stepping down but my colleague @idle gazelle will take over!

unkempt jasper
#

okay I will try and let you know !

#

but its shows two subscriptions??

idle gazelle
#

πŸ‘‹ Taking over from Orakaro, catching up now

unkempt jasper
#

Request ID => req_oflae5GghGjiOy

idle gazelle
#

From this request, you created a new subscription instead of updating one

unkempt jasper
#

okay, but I need to change my subscription what I do in this scenario?

idle gazelle
#

You'll need to use \Stripe\Subscription::update(...) with the new price ID on the existing LineItem ID, and update proration_behavior accordingly

unkempt jasper
#

yes, it's working, that previous plan invoice will create?

idle gazelle
#

it should if there's any unpaid balance

unkempt jasper
#

i did not understand from doc for using this code 'id' => $subscription->items->data[0]->id in subscription update, i need good explanation ?

idle gazelle
#

Stripe supports multiple items (each item contains a price) in a subscription. When you update a subscription, this 'id' => $subscription->items->data[0]->id indicates which Item ID that you would like to update

unkempt jasper
#

okay I understood.

#

when a subscription is auto-renowned which contents will be changed like current_period_start,current_period_end?? and also I need to update this change to my database how can I do that?

idle gazelle
#

When you update a plan, it will still be the same billing cycle and only the field you update will change

unkempt jasper
#

but in auto renowned?

silver pollen
#

Hi! I'm taking over this thread.

#

Can you clarify your question?

unkempt jasper
#

if the customer renewed or auto-renowed what are the column changes happening (like current_period_start, current_period_end) ? and also i need to change that update in my product DB?

silver pollen
#

So you have a subscription, and you want to know which properties of the subscription will change when it is renewed?

unkempt jasper
#

yes that's my question,which properties i need change my local db?

silver pollen
#

The three main changes are current_period_end, current_period_start, and latest_invoice.

#

which properties i need change my local db?
That's completely up to you.

unkempt jasper
#

okay I use the "customer.subscription.update" webhook to update my local DB? how do I know it's renowned from the webhook data(its shows a general update object)?

silver pollen
#

When you receive the customer.subscription.update, you can check the status of the subscription to know if it's active, past_due, canceled, unpaid, etc.

unkempt jasper
#

yes good, but how can I confirm that's renowned from the update webhook (customer.subscription.update)?. is there any key to check that?

silver pollen
#

What do you mean by "renvewed"? That the customer paid, or that a new billing cycle started?

unkempt jasper
#

i mean "subscription renowned " that a new billing cycle started

silver pollen
#

Then you can check that any of these fields changed: current_period_end, current_period_start, and latest_invoice.

unkempt jasper
#

okay, that's good. if I need to change my plan i just use this code \Stripe\Subscription::update(...) but customer upgrade the plan in the Customer portal its also the same process in stripe?

silver pollen
#

okay, that's good. if I need to change my plan i just use this code \Stripe\Subscription::update(...)
Yes
but customer upgrade the plan in the Customer portal its also the same process in stripe?
what do you mean by "same process"?

unkempt jasper
#

what do you mean by "same process"?
updating in previous subscription and item id!

vale forge
#

πŸ‘‹ taking over for my colleague. Let me catch up.

unkempt jasper
#

Okay I am tired your fourth πŸ˜… bro

#

okay, that's good. if I need to change my plan i just use this code \Stripe\Subscription::update(...) but customer upgrade the plan in the Customer portal its also the same process in stripe?

vale forge
unkempt jasper
#

Yes its funπŸ˜‡

vale forge
#

but customer upgrade the plan in the Customer portal its also the same process in stripe?
should be. but could you be more precise the question is a bit vague

unkempt jasper
#

when customer upgrade their subscription in the customer portal what will happen is that same API process (like... "\Stripe\Subscription::update(...)" )?

vale forge
#

yes under the hood it is updating the subscription

unkempt jasper
#

Can I get these changes from webhook (customer.subscription.update) with the change of subscription ID?

vale forge
#

yes

unkempt jasper
#

Okay great ! thanks

vale forge
#

let me know if you need any more help

unkempt jasper
#

Not now bro...

#

one question !

#

when update subscription, can i check this keys "current_period_end, current_period_start" in "previous_attributes" => ??

vale forge
#

I'm pretty sure you can since these values change

#

let me double check

unkempt jasper
#

Okay i am waiting..

vale forge
#

yes they are present in the case where there's a new cycle

#

either through upgrade or normal cycle iteration

unkempt jasper
#

okay, that's great... I can easily check that to know the action

vale forge
#

yes πŸ™‚

#

let me know if you need any more help

unkempt jasper
#

OKay bro, i will

vale forge
#

sorry but I have to ask you to refrain from using gender-specific and familiar language such as bro it's not really appropriate for this channel