#nadia-subscription-updated-event
1 messages Β· Page 1 of 1 (latest)
Hi π that event is triggered whenever the Subscription object for a Customer is updated. It won't trigger based on actions on an associated Invoice.
hi @ebon valley thanks for reaching out !
& thanks for your confirmation
do you have some idea in mind regarding this event please ?
is it sent on a cycle ?
To clarify, you're asking if the customer.subscription.updated event will be triggered when a subscription moves to a new billing period/cycle?
yes please
for that i use the invoice.paid event with the billing_reason = subscription_cycle
i just want to know which event should i use to be notified of a plan update (upgrade downgrade) effective at the moment of the event
i'm using subscription schedule to perform an update at the end of the current period
& i'd like to be notify when the update is done
i've seen that the customer.subscription.updated is sent
& i would like to be sure that no other event triggers it
Yes that event will trigger when a subscription moves to the next billing period, as this updates the current_period_end and current_period_start values on the Subscription object.
thanks for your response.
what workflow do you advise my to detect a plan update (upgrade / downgrade) please ?
If your Subscription Schedules are only making a single change, then you can look into using subscription_schedule.completed or subscription_schedule.released (depending on the how you're creating your schedules) to be notified when the Subscription Schedule has come to its end. But if you're Subscription Schedules are set up to make multiple changes over the life of a Subscription, then customer.subscription.updated is going to be the best event. You can check the previous_attributes parameter of the event to see what data on the object was changed, and then build filter logic around that to only trigger your flow when the values you care about change.
https://stripe.com/docs/api/events/object#event_object-data-previous_attributes
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thanks for your explications. I'm using subscription schedule for plan update (upgrade downgrade) & closing the subscription
does it mean that i cant apply your method ?
i was thinking of catching the customer.subscription.updated event
- check if the subscription status = active
- retrieve the current price & make the update if it's different that in my db
is it good to you ?
It's really hard to say because these scenarios are so specific to the business logic that you're trying to implement. That approach sounds alright though.
Any time!
The channel is busy today so I'm going to go ahead and archive this thread, if additional questions arise please let us know in #dev-help. π
hi @empty frigate
hi @hard rapids
hope you're doing well
i don't know if you had the time to catch up the conversation but i listened to customer.subscription.updated to know if a plan update has been made
OK, and whats the issue you're having now?
the thing is that the status is always active
even if i use a payment method with insufficient funds
i remember using invoice.paid event with the billing_reason = subscription_update to perform my customer plan update on my database
to be sure that everything is up to date
the solution i described (invoice.paid) is no longer working (i dont know why)
i don't receive the invoice.paid - billing_reason = subscription_update anymore
i dont know why
:/
any idea please ?
sorry, its busy right now, give me a moment
no problem ! thanks for your help
yes, the subscription status will remain active unless you use billing setting to update that based on payment failure
https://dashboard.stripe.com/settings/billing/automatic > Manage failed payments
i've selected mark the sub as unpaid after a payment attempt failed
but i think that's because the event is sent before the invoice payment attempt no ?
the customer.subscription.update event *
Yes thats possible -- but the subscription is eventually being updated to what you expect, yes?
You cna use the event you get as a signal to retrieve the subscription form the API to get the latest status -- that might solve your issue here
i think that the status will remain the same
i'm testing it right now !
thanks
i let you know
please keep the thread open π
NP!
i received a past_due status
but after the customer.subscription.update status = active (after launching the upgrade / downgrade process)
is in it possible to not receive the first event
until the payment is confirmed please ?
what is the best way to be sure of a plan update please (payment confirmed) ?
i asked around but unfortunately nobody has the same response
i can't upgrade my customer plan if his payment isnt up to date
so i added the get stripe subscription step after catching the customer.subscription.update
it seems to work but isnt there a better way to do it please ?
is the invoice.paid event with the subscription_update billing_reason not fired anymore ?
ah !
So when multiple stripe events relate to a single real world event, the order is not guaranteed -0- they can arrive in non-strict order
what is the best way to be sure of a plan update please (payment confirmed)
this depends what you mean, but likely you need to combine invoice.paid with a subscription update event, or retrieve the subscription
The subscription update is successful unless the api call returns an error, but it might still be unpaid
i already have the invoice.paid implemented
but it's not sent anymore after the sub update
i remember talking about it with you last year & the invoice.paid billing_reason = subscription_update was the solution to be sure of a plan update
but the event isnt sent
it's directly a subscription_cycle
perhaps i should add my check on the subscription_cycle ?
if the plan is different from the current one in my database, i should do the update on my side ?
& remove the customer.subscription.update catch ?
if there is an invoice created & paid, you should get that event
not getting one suggests there is no invoice created & paid
What is an example update where you don't see an invoice paid event? Can you share the update request id?
i dont have the event id but i can share the subscription id
sub_JTG6vIOmNCpuTN
as you can see on the events no subscription_update
what change are you referring to here?
i can see the subscription
the price change on april 12 from the schedule?
yes but no invoice.paid with subscription_update was sent
so i didnt update my customer plan on my side
but on stripe the update is effective
The associated invoice.paid event is here: https://dashboard.stripe.com/events/evt_1KnmGYFxsE4pn4oa3yRW6Msj
It fired as expected after 1 hr (the draft period of the invoice)
And was delivered to your endpoint we_1IQtGNFxsE4pn4oaTtZtZFeT
yes but have a look at the "billing_reason": "subscription_cycle",
its not what i was expected
on the process after an update the billing_reason should be "subscription_update"
Why not? That's what it was
i dont understand sorry
No, the schedule updated the price which was used for the normal renewal invoice
prorations are disabled for the phase change
proration_behavior: "none",
should i add proration_behavior to always invoice
even if i dont want proration & i set the start & end of the period ?
If that's what you want to happen, though that miight produce unexpected results when used around the period end times
Are you trying to change only at the period end?
yes !
if so, use the end_date as the current period end when creating the schedule
and then what you have works
but you won't see subscription_update in the paid event -- that's not happening from an update reuqest
You should listen to the subscription update events instead if thats what you need, and examine the item/price details
i'm actually using the end_date as the start of the new phase
sure, either way
i dont understand why i wont see the subscription_update in the billing_reason ?
what do you think of using the invoice.paid event billing_reason = subscription_cycle to check the plan & make the plan update on my db if it's different please ?
I mean you wont see that because you're not updating the subscription via an api request
That's fine if its what you want to do -- I think the subscription update event is likely to be easier because that's where the context for the price change is, but its up to you
I was receiving it last year
The subscription_update billing_reason, but all of a sudden itβs not triggered
I was using the subscription schedule as Today
No code update on my side
Thatβs why Iβm confused
If you have a specific example of that I can try to compare to see what differences might exist, but my suspicion is that this is because of the way the update is happening at the period end/cycle
Unfortunately I have not π your colleague told me that there are no history after 1 month
Hello. I reopened the thread
π
@empty frigate
thanks a lot
What's your question?
i had some issue regarding subscription plan update
here is my workflow
i update my customer plan (on my app) when i receive a invoice.paid event
with the following billing_reason : subscription_update
to be sure that he paid
the thing is that a client of mine updated his plan, he was charged, i received the invoice.paid event with another billing_reason : subscription_cycle
so, i've implemented a method on my side to check if his plan changed (if his plan on my db is different than the invoice paid plan)
your colleagues told my that i'm not supposed to receive the invoice.paid billing_reason : subscription_update on a plan update
& asked me for an example
i have 2 differents billing_reason for the same situation (same event : invoice.paid) :
- evt_1Kw5PfFxsE4pn4oaByIHFVhC (subscription_update)
- evt_1KnmGYFxsE4pn4oa3yRW6Msj (subscription_cycle)
hey @hard rapids here are the example you asked for last time
π
anybody please ?
Hello apologies for the delay
Discord is extremely busy this morning
Looking at your events
no problem thanks for your help !
So it looks like evt_1Kw5PfFxsE4pn4oaByIHFVhC (the subscription update) has that value because that event is a result of the invoice being paid from the dashboard
Whereas the other event is part of the schedule's flow
ahh okay
so when there is no payment from the dashboard the billing_reason will always subscription_cycle
?
If it's a result of the transition in your sub schedule, yes
my plan updates will always be triggered by subscription schedule
i also use subscription schedule for closing a sub
Gotcha, then yes
No problem! Same to you!