#ilamathi

1 messages · Page 1 of 1 (latest)

grim siloBOT
mighty torrent
#

hello! i'm afraid i don't quite understand - do you mean you want to be informed when the subscription price is updated?

spare helm
#

Basically before charging customer during subscription renewal, i want to validate is there any price got changed for that particular subscription plan recently if so i want to charge that new amount instead of old amount..

mighty torrent
#

can you give an example of any price got changed for that particular subscription plan lately?

spare helm
#

For example user bought one premium plan and current price for that plan is 5USD... 2 months Later merchant decided to increase the price to 7USD.. This change already updated in the merchant db ... During the next billing cycle renewal before charging cuctomer i want to validate the invoice amount against this merchant db amount, if it different i need to charge this amount

mighty torrent
#

if you want to validate the invoice amount, you can listen for the invoice.created webhook

spare helm
#

When this event exactly will be triggered? before subscription renewal day?

mighty torrent
#

invoice.created will be triggered when the invoice itself is created i.e. on the subscription renewal day

#

if you want to validate before the subscription is renewed, you can listen for the invoice.upcoming event

spare helm
#

Also there invoice.upcoming event as well, which can be configured to trigger 3/5/7/15 days before renewal.. For example

#

yes.. that what i am thinkinh..

sharp cosmos
#

Hi @spare helm I'm taking over this thread

spare helm
#

for example if i configure this for 3 days before, then i can check any change in the amount.. if no change i will leave as it it.. so it start continue to charge customer as usual

#

incase if the amount is different, i want to inform the customer on the price change then i need to charge that amount after 10 days from this...

#

For this use case schedule subscription will suit..

sharp cosmos
#

@spare helm is your latest question related to subscription schedule?

spare helm
#

yes invoice.upcoming & subscription schedule

sharp cosmos
#

What's your exact question?

spare helm
#

Basically before charging customer during subscription renewal, i want to validate is there any price got changed for that particular subscription plan against my local db recently if so i want to charge that new amount instead of old amount..

#

so i am planning to use invoice.upcoming event 3 days before renewal... on this event i will check price change.. if there is a change i will notify customer on the price change and want to charge customer only after 10 days of this notification...

sharp cosmos
#

So basically you don't want to automatically charge the user, instead you'd like to programmatically charge the user when you think the time is right?

spare helm
#

when the price is changed i need to charge new price... Even automatically also fine, just need to charge new price

sharp cosmos
#

Hmm, I don't understand what you mean by when the price is changed i need to charge new price ?

spare helm
#

For example user bought one premium plan and current price for that plan is 5USD... 2 months Later merchant decided to increase the price to 7USD.. This change already updated in the merchant db ... During the next billing cycle renewal before charging cuctomer i want to validate the invoice amount against this merchant db amount, if it different i need to charge this amount

sharp cosmos
#

You can't change the unit_amount of a existing price object, so this use case doesn't exist.

spare helm
#

Yes i was seeing that option only.. But is there a option to reflect the new price changes after 10 days like that?

#

This will update the subscription with new price immediately,
stripe.subscriptions.update('sub_49ty4767H20z6a', {
cancel_at_period_end: false,
proration_behavior: 'create_prorations',
items: [{
id: subscription.items.data[0].id,
price: 'price_CBb6IXqvTLXp3f',
}]
});

#

But i want to activate this only after some days, so that in the mean time i will inform the customer and all

sharp cosmos
#

You can use subscription schedule to automate it.

spare helm
#

ok let me look.. Now i want to confirm for this subscription price got changed or not... for that i can listen for invoice.upcoming right?

#

so with this event i will get existing plan price and compare with my local db to identify the price change..

#

But it looks like this event won't trigger for Daily plan

sharp cosmos
spare helm
#

Ok when i go with subscription scheduling for the existing subscription, first i need to create schedule for the existing subscription, then have to update?

#

Actually i am trying to create sub schedule for the existing subscription to apply new price after some time.. it throws i can not set both subscription & start_Date

sharp cosmos
#

Can you share with me the request ID?

spare helm
#

I am trying in postman -

#

in my case right, i already have subscription.. If there is price change i will create priceID and have to create subscription schedule for the existing subscription to apply the new price id from the start_date (after some days)

sharp cosmos
#

OK, you should just use from_subscription param to create a subscription schedule first, and later update this subscription schedule with phases.

spare helm
#

yes, after that also i couldn't update the start date

sharp cosmos
#

You can't update the start date because you care creating a schedule from an existing subscription, which is already started

spare helm
#

yes for example i have subscription which end in 3 days... in the schedule that was given in end_date and start_date actual start date of that plan... Now i need to update the new price after 10 days right... As i can not modify start_date, what i can do?

sharp cosmos
#

You should update the subscription with an additional phase for the new plan, and you don't need to specify the start_date for the new phase if you already have the end_state for the 1st phase.

#

When updating a subscription schedule, remember to include all phases (current and new ones) in the phases array.

spare helm
#

Sorry to ask too many question... If i don't provide the start_date for my new phase, then it will take the end_date of current phase fas start_date.. But i don't want right.. May be my current phase end_date after 1 month, but i want to apply this new price after 10 days itself or vice-versa

sharp cosmos
#

Don't worry about the questions.

Just want to correctly understand the requirement, so you want to start the new phase one month after the end_date of the existing subscription ?

spare helm
#

just after the 10 days of price change.. irrespective of currentphase end_date

#

Seems i could able to update the current_phase end_date..

sharp cosmos
#

Yes, you've found the answer yourself