'create stripe invoice with specific invoice items, excluding pending invoice items
I am trying to create manual stripe invoices but don't want it to create the invoice from pending invoice items. For example, I have 3 pending invoice items that I do not want include on this manual invoice.
Pending Line Items:
Item 1
Item 2
New Invoice:
Item 3
How do I create a blank invoice, then manually assign Item 3 to it, with out adding 1 and 2?
Solution 1:[1]
For anyone looking, I am using Stripe's API to delete all pending invoice items from the customer before creating the new invoice items and creating the invoice. Best solution I could think of.
Solution 2:[2]
I am not sure when it was added, but Invoices now can set the pending_invoice_items_behavior
to define the behavior.
How to handle pending invoice items on invoice creation. One of include, exclude, or include_and_require. include will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. include_and_require will include any pending invoice items, if no pending invoice items exist then the request will fail. exclude will always create an empty invoice draft regardless if there are pending invoice items or not. Defaults to include_and_require if the parameter is omitted.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Stein Christensen |
Solution 2 | jimp |