I'm having a problem to adding invoice item in monthly invoice. Here is my billing implementation.
After getting an invoice.created
webhook from the Stripe, I calculate the extra payment amount and trying to update the current invoice, by adding invoice item. Here is the code:
stripe.invoiceItems.create({
'customer': 'cus_00000000',
'amount': 2000,
'currency': 'usd',
'description': 'additional fee'
}, function (error, invoice) {
if (error) {
throw new Error('Error creating invoice item');
}
return Promise.resolve(invoice);
});
As the result Stripe creates an Invoice item, and adds it to the next upcoming invoice. The issue is, that I need to add the extra payment line to the current created invoice. My question is, is there any way to update pending invoice, not the upcoming.