I'm implementing payment system one of the features is an ability to upgrade account subscription (updating the quantity of the subscription). So my flow is:
- Update quantity of the subscription (with proration)
- Create invoice
- Trying to trigger invoice payment (so the user will pay the proration payment right now).
It works when payment is successful. But what if the payment will fail? I can manually update subscription (to rollback previous quantity value), but I have a problem. I will still have an invoice and two invoice items on the stripe side.
Can I drop this invoice somehow (including invoice items)? Or can I somehow rollback subscription upgrade?
PS: one of the options is to add invoice item with the negative amount so the sum of all invoice items will be zero, but is there a better approach?
PPS: or I can implement this additional charge just as a charge + update subscription w\o proration