rubyruby-on-rails-3stripe-payments

Update a monthly payment subscription to a single payment after a failed payment? Or allowing the customer to do so or not


Let say my customer has to pay 10$ every month for 12 month. But the first payment, or second or any other payment among the 12, will fail for x reason.

I'd like to offer the possibility to pay the full subscription (or what's left to pay) as a single payment.

Unfortunately when i update my line_item with a single payment price object, Stripe raise this error:

Stripe::InvalidRequestError - You cannot update a subscription in incomplete status in a way that results in a new invoice or invoice items. Only minor attributes, like metadata or default_payment_method, can be updated on such subscriptions.:

The status of a subscription can't be access or changed via the API. I guess I'd have to create a new one and offer the possibility to keep monthly payments or single payment ?

Any idea or good practice in this case ?


Solution

  • I suspect this error was returned after you created a brand-new subscription and the first payment failed. It's expected that the subscription's status would be incomplete if you follow Stripe's guidance on payment behavior for handling the first payment.

    For cases where the first payment fails, you should probably create a brand-new subscription to offer the annual payment. For cases where some monthly payment fails while the subscription is active, I think your line item approach works. However, you'd probably have to work with trials to reset the billing cycle anchor so no new monthly invoices are created and attempted to be paid.

    You could also re-think your approach and use Subscription Schedules to give the customer an option of switching to a new price.