#Sudarshanan G
1 messages · Page 1 of 1 (latest)
Are you creating the invoice item before or after creating the invoice?
before creating invoice
Gotcha. I believe you'd need to set pending_invoice_items_behavior to include when you create the invoice
https://stripe.com/docs/api/invoices/create#create_invoice-pending_invoice_items_behavior
thanks this works. but I just wanna know is there any drawback using 'pending_invoice_items_behavior' => 'include'
also I wanna to know how to clear pending_invoice_items if some error occurs while invoice creation
thanks this works. but I just wanna know is there any drawback using 'pending_invoice_items_behavior' => 'include'
It will pull in any pending invoice items that have been created. You can't pick and choose which ones to include and so on.
The other option is to create the invoice first and then create the invoice item referencing that invoice
https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-invoice
also I wanna to know how to clear pending_invoice_items if some error occurs while invoice creation
You can just delete the invoice item
https://stripe.com/docs/api/invoiceitems/delete
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok thanks