laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.39k stars 680 forks source link

Payment Failure During Plan Swap Does Not Revert to Previous Plan in Stripe #1722

Closed AbhishekDangol14 closed 2 weeks ago

AbhishekDangol14 commented 2 weeks ago

Cashier Stripe Version

15.3.2

Laravel Version

11.7.0

PHP Version

8.2

Database Driver & Version

No response

Description

When swapping a user’s subscription plan, if the payment fails (e.g., due to an invalid card), the subscription plan in Stripe is updated to the new plan regardless of the failed payment. This results in the subscription entering a past_due state rather than reverting back to the previous, active plan.

Steps To Reproduce

  1. Set up a subscription plan with a valid payment method.
  2. Update the user's card with 4000000000000341 which declines after attaching.
  3. Attempt to switch to another plan.
  4. Observe that the subscription plan updates to the new plan and the status becomes past_due.
driesvints commented 2 weeks ago

This is the expected behaviour. If you don't want this then you need to call errorIfPaymentFails before doing the swap.