#trueicecold-invoices-node
1 messages ยท Page 1 of 1 (latest)
yep
and I would like the line item to be a one off as well if possible, like the "add new item" in the web dashboard
although I did notice it auto-created a product and archived it backstage
tried several logical properties like "items" "line_items" but got parameter_unknown error ๐
haven't found anything in the docs as well, which is strange. The nodejs example shows only customer as the only parameter and it's not in the other parameters list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
gotcha, so with the API, you first create InvoiceItems, then you create the Invoice, for which the InvoiceItems are pulled into that Invoice: https://stripe.com/docs/invoicing/integration#create-invoice-code
Learn how to create an invoice and bill a customer with code.
Oh wow so... I need to create a "price" in the example you sent me
And then an invoice item based on that price
you don't have to create a Price first, you can use price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
that creates a Price inline for you in the same InvoiceItem API request
Ah I see... And there's no way of creating an invoice while attaching custom price and description and let it auto create it?
Since I'm going to create lots of invoices in a short period of time, meaning I'd have to create an invoice item for every invoice?
Or alternatively save the invoice item ID somewhere for reuse
How do I associate that invoice item to invoice? Using what parameter in the json?
And why does invoice item need a customer ID as parameter?
think of it this way
you create InvoiceItems on a Customer, so say I created InvoiceItems ii_1 for $5 and ii_2 for $10 on cus_123.
Then you create an Invoice on cus_123. That Invoice pulls in any InvoiceItems on the Customer, so you get an Invoice with two separate Invoice line items, for $5 and $10 respectively.
But I could want to create several invoices using different prices to the same customer
so you create InvoiceItems for the first Invoice, then create that Invoice, then InvoiceItems for the second Invoice, then create that Invoice, and so on
Oh invoice items are auto archived once an invoice are created for that customer?
So next invoice will start a clean slate?
yep
Ahh I see
Well, since the process is multi staged, what happens if I create an invoice item but fail to create an invoice?
How do I make sure on retry, I don't end up with two invoice items?
what happens if I create an invoice item but fail to create an invoice?
InvoiceItems stay on a Customer until pulled into the next Invoice.
So if you fail to create an Invoice, whenever you next create an Invoice on the Customer, that InvoiceItem will be pulled into that next Invoice.
But if my logic is:
- Create an invoice item for 5$
- Create an invoice
And it failed on 2
Next time, I'll create another invoice item and invoice will contain 2 invoice items now...
I could try a list invoice item api first...
And if none exists create one
yeah you could or handle errors on step 2 and re-do 2 so the Invoice is created correctly
yes!
if you have them now, feel free to keep them here
but if it is after like 30-60 mins and this thread has been archived, then feel free to create a new #dev-help msg and we'll thread there
OK then :)
So I understand an email isn't required to create a customer
But when the invoice link is sent manually to the customer he'll be required to enter his email?
So I understand an email isn't required to create a customer
yep
But when the invoice link is sent manually to the customer he'll be required to enter his email?
yep you'll need to set
Well that leads to my next question lol
Inside the invoice page in the Dashboard I can see the invoice payment link
But the invst_id is not the same as invoice id
And I would like to get a payment link using the api...
that invst_id isn't the Invoice ID
the invoices.stripe.com/i/acc_id/invst_id
the i part before /acct_id would be the Invoice ID
And I would like to get a payment link using the api...
you want thehosted_invoice_urlfield on the Invoice object: https://stripe.com/docs/api/invoices/object#invoice_object-hosted_invoice_url
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.