#jstawski - API Invoice

1 messages · Page 1 of 1 (latest)

frozen geode
#

You need to create line items and the invoice in separate API calls. It's up to you whether you create the items first or the invoice first

rough plume
#

how do I make sure the Invoice is in draft mode?

frozen geode
#

When you first create an invoice it is in Draft mode by default. If you run into an issue where it auto-advances you can set auto_advance to false

rough plume
#

perfect, thanks

#

will try it

frozen geode
#

Sure thing 🙂

rough plume
#

so i'm creating the invoice first, but i'm getting the exception: "Stripe.StripeException: Nothing to invoice for customer"

#

Invoice Create Options have AutoAdvance = false

#

and a Customer

sage venture
rough plume
#

testing now

#

worked! thanks

rough plume
#

almost there

#

I now get, "This property cannot be expanded (PaymentIntent)."

#

after trying to Pay an invoice

sage venture
rough plume
#

anyway I can review a log on the dashboard?

#

I don't have the request available anymore

sage venture
#

Yeah, if you go into the Developer section of the Dashboard you'll find Logs there.

rough plume
#

found it

#

req_ofCwezWoGQAnY5

sage venture
#

Ah, okay, so PaymentIntent is not a valid value for expansion. Try payment_intent instead.

rough plume
#

trying...

#

and it worked

#

thank you!

rough plume
#

Does paying the invoice generate a receipt/invoice email automatically?

sage venture
#

If you have Stripe configured to do that, yes.

rough plume
#

it didn't do it on test mode

#

is that expected?

sage venture
#

That's expected, we do not send emails in test mode.

rough plume
#

ok, good to know

#

the settings within the portal says "Email finalized invoices to customers"

#

I am not finalizing, instead i'm paying... in other words I'm using the Pay API

#

I assume it is the same thing

silver gull
#

Those are two seperate things but test mode won't send emails for either.

#

Finalizing an invoice is when the invoice moves from a draft state to an open state where your users can pay it

#

Paying the invoice is, well, paying the invoice

#

Test mode mostly does not send emails. Are you just confirming that this is the expected behavior? Or are you trying to see something about this email.

rough plume
#

I want to make sure that in production, when my system automatically pays for the invoice (through stripe API), the customer will receive an email to the email on file

#
  1. I create a draft invoice
  2. I add Invoice Items to the Invoice
  3. I pay the invoice
#

Will the customer receive an email with a receipt/invoice if we do the above?

silver gull
rough plume
#

when I say "I Pay the invoice" I mean the code calls PayInvoice

silver gull
#

Sadly the email itself is not testable in test mode right now