#gracine
1 messages · Page 1 of 1 (latest)
👋 Hi there, Happy to help!
You can upgrade and change the subscription item to another price of an other product:
https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
yeah i just realized that the product is not directly referenced by the sub object
Thx. I would have another question, is there a best way to handle an existing price change? If we change a price for existing subscriptions
Yes exactly
You are still there ?
"I would have another question, is there a best way to handle an existing price change? If we change a price for existing subscriptions"
Ah sorry, I missed that. Could you please share more details about what you want to achieve with an example? I don't understand you
ok
We have existing users in production who subscribed to Premium product with price 20$/month
We want to increase the price to 30$ / month for new users, and at renewal of existing users, switch to 30$
We want to increase the price to 30$ / month for new users
when new users subscribe, you pass the new priceId
, and at renewal of existing users, switch to 30$
You update the Subscription of the existing users with the new priceId without creating prorations, by passingproration_behiavior=none
https://stripe.com/docs/api/subscriptions/update#update_subscription-proration_behavior
So that the change will take effect in the new billing period
ok
should I use a subscription schedule
like i could create a script right now to change the new subscription price at the end of the billing period automatically
its a subscription so i need to hook up somewhere to change the price of existing subscription
You can also if you are using Subscription Schedule already, then you can update the next phase with the new priceId
or you can just update the existing Subscription and keep it simple
Yes for sure with all my pleasure!
I was debugging locally and I sync my subscriptions in my database based on the Stripe Webhook events
i subscribe to a product, I see that my customer has the subscription active in Stripe, but in my database the status is 'incomplete' instead of 'active'
Its the first time I see this, I receive the events in the wrong order
Greed is the customer.subscription.updated event with the status 'active'
latest in read, its the customer.subscription.created with the status 'incomplete' which comes after the customer.subscription.updated event and overwrites the status from active to incomplete
so I end up with a bad status compared to the Stripe dashboard
*Greed => Green, *read =>Â red
Stripe does not guarantee delivery of events in the order in which they are generated
In order to track active Subscription, you should instead track invoice.paidevent:
https://stripe.com/docs/billing/subscriptions/webhooks#active-subscriptions
Or you need to update your integration
ok...but still when the subscription becomes past_due, cancelled, etc i need to sync my db
so i need to listen to customer.subscription.updated
not sure how to properly handle this
yeah for sure you can keep listening to that event also
what you are saying is that i need a logic to discard some events
instead of updating my db from them
like, having some kind of invalid transitions logic
active =>Â incomplete cannot happen
some state machine logic
in that case I would simply skip the event
Yes exactly,
Here is the full subscription lifecycle:
https://stripe.com/docs/billing/subscriptions/overview#subscription-lifecycle
Np!
have a good day
Thanks! you too 🙂