#mochi-subscription-upgrade
1 messages · Page 1 of 1 (latest)
does it automatically prorate the change or is there an additional parameter that i need to pass
also is that proration charged now or on the next invoice. I want it to be now. thanks!
@spiral fern it's all explained in details in that one doc
it would also take you a few minutes to test this in Test mode with your own code!
yea Im just lazy and figured I'd ask lol
thanks
Stripe immediately attempts payment for these subscription changes:
From a subscription that doesn’t require payment (for example, due to a trial or free subscription) to a paid subscription
When the billing period changes
When billing is performed immediately, but the required payment fails, the subscription change request succeeds and the subscription transitions to past_due.
To bill a customer immediately for a change to a subscription on the same billing cycle, set proration_behavior to always_invoice. This calculates the proration, then immediately generates an invoice after making the switch. Combine this setting with pending updates so the subscription doesn’t update unless payment succeeds on the new invoice.
👍
and yeah sorry but we help hundreds of people a week here, we can't just act like chatgpt :p
this is from the docs but my question is if a payment fails for when I'm upgrading the subscription (which creates a new billing cycle) how can i ensure that the update doesnt happen unless payment succeeds
it's in the docs too, did you look?
it's literally a few pixels below the current doc on the left bar
Sorry I'm quite particular with this, we get a lot of developers lately just expecting answers without even looking. I get there are a lot of docs, but we can't really do that for you
for the customer.subscription.pending_update_applied webhook endpoint is triggered only when you update a subscription or does it also trigger with subscription schedules
only Subscriptions that use the "pending update" mode
ok thanks now the reason I'm asking all this is becuase when a customer wants to purchase a certain subscription they need to have a different subscription of a certain period to match the one they want to purchase. so lets say if they have a 1 month subscription for a certain price (A) and they want to purchase a 3 month subscription to another price (B) we would need to upgrade their first subscription (A) to a 3 month subscription. now I'm not sure that the stripe api has any concept of transactions but how would you suggest I handle this case because I would want to only charge subscription B is the upgrade for subscription A was successful
👋 hopping in here
ok
If what you're looking for is a way to only update the subscription to price B only if payment succeeds you want pending updates - https://stripe.com/docs/billing/subscriptions/pending-updates
^ definitely read through all of that and see if it fits what you need
This will only work if you're working with subscriptions directly though - if you need this with subscription schedules then this won't work
no we have two seperate subscriptions which are dependent on eachother I currently have subscription A and want to additionally subscribe to subscription B however I only want to subscribe to subscription B after the successful upgrade to subscription A. I know I cant wrap this in a transaction but how would you suggest I handle this. should I listen to the pending updates success webhook for subscription A and then make the subscription call to subscription B there?
yup - you'd listen for the webhook event to know that the update was successful and then create subscription B from there