#seagull4real
1 messages · Page 1 of 1 (latest)
Do you have the ID of an invoice that you created like this? Having a bit of trouble picturing this
Here is how I try to create an invoice
and here is the id
in_1OEYe0H3o7SpP8ziNx2kf8fW
Ah I see, so the issue is that your invoice items are not showing up on your invoices
There is a parameter that you can set when creating the invoice, finding that now
Thank you
Though keep in mind that means that it will include all open invoice items. Depending on your usecase that can be exactly what you want to do or exactly what you don't want to do
If you want to ensure that the invoice has just the one invoice item, the easiest way that I know of is to create the invoice first and then create the invoice item while specifying the invoice's ID on the call's invoice param https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-invoice
Let me try real quick
When I try to do that, it returns {
"error": {
"message": "No upcoming invoices for customer: xxx",
Can you show me the code for the call that you made?
The text of the code please, pictures are harder to work with
Of course sorry about that
Can you send me the request ID of the request that got that error (req_123) https://dashboard.stripe.com/test/logs
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
req_llcG8csan3Upos
That call is not either of the calls on your screenshot
Ah, so you created this invoice with that pending_invoice_items_behavior thing https://dashboard.stripe.com/test/invoices/in_1OEYuPH3o7SpP8zi4NI5aw1O
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I just comment it out
That invoice is considered "Open" not "Upcoming", upcoming would be invoice items on the customer but not on an actual invoice object I believe
Hmm, then how can I move in with that?
Cause I want to include only that invoice item not all previous ones.
With the code that I send, the upcoming invoice call will not work if you do the calls in that order
Before it may have been picking up invoice items that weren't attached to any invoice, but with this one you will have an actual draft invoice
Like with invoice.create and then InvoiceItems.create (including invoice: invoiceId)
So if you want to retrieve the invoice, you can just use its ID with the normal retrieve invoice call https://stripe.com/docs/api/invoices/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Right, after you have called invoice.create that creates an invoice in draft state. That is not an "upcoming" invoice by our API's definition. Draft invoices are just invoices