#luisfmanzanoa

1 messages · Page 1 of 1 (latest)

foggy fableBOT
outer edge
#

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

Learn how to handle payment failures when updating subscriptions.

#

Then the update will not be applied unless payment is successful

jade whale
#

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:

outer edge
#

But why disabling prorations could create this bug?
Can you explain more about this?

jade whale
#

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

outer edge
#

There's a lot of complex logic in the above and i can't really speak to that.

jade whale
#

update to an existing one

outer edge
outer edge
#

these are seprate concepts

#

If you want the subscription update to fail if payment fails, thats what those other payment_behavior options are for

foggy fableBOT
jade whale
#

I tried setting payment_behaviour but the issue still happens

outer edge
#

Can you show an example?

jade whale
#

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

outer edge
#

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

outer edge
jade whale
#

I see