#briana_invoice-email

1 messages ¡ Page 1 of 1 (latest)

main ermineBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1234575852486922357

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

fiery joltBOT
tawdry fable
#

Are you testing things in Test mode? We don't send emails in Test mode

#

briana_invoice-email

surreal heath
#

.< well how can i test that it's automatically sending an email? Because it wasn't working in live mode either.

fiery joltBOT
ruby flame
#

That aspect should just work in live mode. Do you have an example of an ID for an invoice where it didn't send an email in live mode (in_1234)?

surreal heath
#

I'm going to try again in live mode, and just reduce the price of the product.

#

Do I need this little snippet, or should it just send automatically? await stripe.invoices.sendInvoice(data.id, { email: data.customer_details.email, });

ruby flame
surreal heath
#

this is what we have in our code.

ruby flame
#

I am confused. That code does not create an Invoice or Subscription, so there is no reason for Stripe to send an invoice there

#

Oh are you looking for an invoice receipt after the checkout session completes?

surreal heath
#

yes

ruby flame
#

Is this for a one-off payment or are you creating a subscription?

surreal heath
#

No this is a one off payment

ruby flame
#

Can you show me your code for creating your Checkout Session?

surreal heath
ruby flame
#

I need your server-side code for creating the session

surreal heath
ruby flame
#

Yep, that looks to be missing from the create call in your code.

surreal heath
#

okkk so i just add that to the screenshot I just sent you?

ruby flame
#

Yep yep

surreal heath
#

ok amazing, thank you.

#

& i can only test this in live mode?

ruby flame
#

As far as I know, yes. In test mode we do sometimes send emails if the test email is the exact same as the invoice that you log in to the dashboard as. You can try that first in test mode if you want, I forget if this specific test case works like that.

surreal heath
#

okay, and i noticed that when i do a test purchase, in stripe it says that customer_email is null, but customer_details.email is the correct email. do i need to specify customer_email?

#

this is under event details for the test purchase

ruby flame
#

Not as far as I know. Checkout should populate the proper field with what your customer inputs and send out an email. Is that a checkout.session.succeeded event that you are seeing that field on?

surreal heath
#

yes

ruby flame
#

It looks like you can pass a value in to that field when creating the session if you already know the customer's email. If it isn't passed in Checkout will use the one that your customer provides and I think it will even prevent them from entering a different one https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-customer_email

surreal heath
#

Hm, ok so then I dont need to change anything? I think currently it does ask for a customer email when I checkout. So it should send an email to that email.

ruby flame
#

Yep, you should be good as long as you are setting invoice_creation.enabled to true here

surreal heath
#

ok let me test on the live page then.

#

okay, amazing I received the invoice.

#

Thank you for that!