#wellgordon
1 messages · Page 1 of 1 (latest)
Hello! Do you want to create the line items first, then the Invoice, or do you want to create the Invoice first, then add line items to it?
Either way is fine - essentially, I want to ensure that the invoice for any given customer through this flow includes only the specific line items I am adding for the purchase they are requesting, rather than anything else that might be currently due on their "account"
Okay, you should create the Invoice first then. Create an Invoice via the API and set pending_invoice_items_behavior to exclude: https://stripe.com/docs/api/invoices/create#create_invoice-pending_invoice_items_behavior
Then, when you create the Invoice Items, specify the ID of the empty Invoice you created in the invoice property: https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-invoice