#Aditya-invoicing
1 messages · Page 1 of 1 (latest)
Hi there, creating an invoice requires at least one invoice item, the item can be an existing or ad-hoc.
I see that it’s possible on the stripe dashboard - https://www.loom.com/share/3df71b9193c9480c9a70165ada542a60
This video shows the way to create a draft invoice object, and you will need to call invoiceItems.create API to add items to the draft invoice https://stripe.com/docs/api/invoiceitems/create?lang=node
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yeah. I want to reverse it a little bit and create invoice(draft) without invoice items first. As it happens in the dashboard.
Sure, that's totally possible.
Can you help out with that, because I’m getting an error while creating a draft invoice which doesn’t have invoice items, “Nothing to invoice for customer”
Sure thing, can you give me invoice ID?
I can give you a customer id, because the invoice didn’t get created.
Customer id: cus_L1O8znGBXqukmi
OK, give me a sec, let me read the logs
From this log, the invoice object is created successfully https://dashboard.stripe.com/test/logs/req_oeVLOqgSpk8vfR
Hey jack this seems to be some other invoice, because the customer is not the same as I shared.
Can you send me the request ID then?
I tried again, it gave me this error, although I’m not able to see it in the logs (Request req_XNGNHyu7LIXHSG) No upcoming invoices for customer: cus_L1OC0UKknM8WZc>>
Can you find the request to create an invoice object for customer cus_L1O8znGBXqukmi ?
I can’t seem to find it in the logs. I’m using stripe connect for each request.
The stripe account I’m using is - acct_1JzunAQ7Vcs0maxV
Hmm, if you don't have the log, where did you see the “Nothing to invoice for customer” error message?
The error comes in response to the failed invoice creation request.
Can you send me the request ID of that request?
Yeah sure, here you go - req_XNGNHyu7LIXHSG
Thanks, btw this request is to preview the upcoming invoice, not create a new invoice.
Btw, I'd like to make a correction. You need to have pending invoice items before creating an invoice. As per the doc mentions -> Returns the invoice object if there are pending invoice items to invoice. Returns an error if there are no pending invoice items or if the customer ID provided is invalid.
In another words, you need to use /v1/invoiceItems to create pending invoice items, and then use /v1/invoices to create a draft invoice, not the other way around.
Ah, okay. I was unsure if this happens that’s why this was the first thing I asked. No worries. Thanks for the help.
Is it possible that you help out with one more thing, I’m unable to view many of the recent stripe api requests in the logs.
req_XNGNHyu7LIXHSG like this one.
What's the problem with this request?
Unable to search for it in the logs for “req_XNGNHyu7LIXHSG”
You can find this request in the Connected account's log instead of your (Platform) logs
Okay. Thanks jack got it.