Biba
Biba

Reputation: 113

Can I delete an invoice or rollback subscription update on stripe?

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:

  1. Update quantity of the subscription (with proration)
  2. Create invoice
  3. 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

Upvotes: 1

Views: 2098

Answers (1)

Biba
Biba

Reputation: 113

My bad. I cannot delete an invoice, but I can close it like:

stripe.invoices.update(invoiceId, { closed: true });

Upvotes: 0

Related Questions