#trueicecold-invoices-node

1 messages ยท Page 1 of 1 (latest)

tepid kelp
#

hello, I assume you're creating a one off Invoice?

sharp breach
#

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

tepid kelp
sharp breach
#

Oh wow so... I need to create a "price" in the example you sent me

#

And then an invoice item based on that price

tepid kelp
#

you don't have to create a Price first, you can use price_data

#

that creates a Price inline for you in the same InvoiceItem API request

sharp breach
#

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?

tepid kelp
#

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.

sharp breach
#

But I could want to create several invoices using different prices to the same customer

tepid kelp
#

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

sharp breach
#

Oh invoice items are auto archived once an invoice are created for that customer?

#

So next invoice will start a clean slate?

tepid kelp
#

yep

sharp breach
#

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?

tepid kelp
#

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.

sharp breach
#

But if my logic is:

  1. Create an invoice item for 5$
  2. 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

tepid kelp
#

yeah you could or handle errors on step 2 and re-do 2 so the Invoice is created correctly

sharp breach
#

Gotcha!

#

Well if I have more questions should I open a new thread?

tepid kelp
#

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

sharp breach
#

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?

tepid kelp
#

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 email on Customer to send the Invoice to them

sharp breach
#

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...

tepid kelp
#

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 the hosted_invoice_url field on the Invoice object: https://stripe.com/docs/api/invoices/object#invoice_object-hosted_invoice_url

sharp breach
#

Ohhh I'll try that right now :)

#

Thank you!