#luisfmanzanoa
1 messages · Page 1 of 1 (latest)
Aside from disabling prorations as was previously suggested, your other options are to see whether pending updates or errors on failure are more appropriate for you use case:
https://stripe.com/docs/api/subscriptions/update#update_subscription-payment_behavior
https://stripe.com/docs/billing/subscriptions/pending-updates
pending_if_incomplete or error_if_incomplete
Then the update will not be applied unless payment is successful
But why disabling prorations could create this bug? Why does stripe set the status of the new subscription as active if the card used is: 4000000000000341
That card is meant to always be declined
This is my complete function, so you can have an Idea of what I'm trying to do:
But why disabling prorations could create this bug?
Can you explain more about this?
The feature i'm trying to do is simple, if a card is declined, the subscription's status should be 'incomplete' or past due, right?
If either of those statuses happen, I rollback the update to the previous plan
However, for some reason, if proration is set to none, and the user in a premium monthly plan, decides to upgrade to a business monthly plan with a declined card. The status of the updated subscription with this new plan is set to 'active' when it should be set to 'past_due' or 'incomplete'
Since it's setting the status to active I cannot rollback the upgrade, so it's letting an user upgrade without a successful payment
Is this a new subscription, or an update to an existing one?
There's a lot of complex logic in the above and i can't really speak to that.
update to an existing one
I'd suggest not making the update in the first place using the approach I noted, but if you do want to make it and rollback, then disabling prorations is how to avoid this credit line complexity
Yes, because the subscription update happens, and the invoice payment fails
these are seprate concepts
If you want the subscription update to fail if payment fails, thats what those other payment_behavior options are for
I tried setting payment_behaviour but the issue still happens
Can you show an example?
sure
sub_1NSmbzKNOllJIMsdFZUGvqaR
That's a subcription ID where the behaviour happens
You'll see that they tried to upgrade to premium yearly, and it did not go through (as expected) then tried to upgrade to business and the upgrade was set to active with the declined card
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
This didn't fail because there was no payment to fail at the time of the upgrade
The failure would happen later at renewal
This is normal/expected
If you want to prorate the changes and charge the different right away, use proration_behavior=always_invoice instead
Yes, because there was no payment, nothing failed.
I see