Reputation: 113
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:
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
Upvotes: 1
Views: 2098
Reputation: 113
My bad. I cannot delete an invoice, but I can close it like:
stripe.invoices.update(invoiceId, { closed: true });
Upvotes: 0