#briana_invoice-email
1 messages ¡ Page 1 of 1 (latest)
đ 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.
Are you testing things in Test mode? We don't send emails in Test mode
briana_invoice-email
.< well how can i test that it's automatically sending an email? Because it wasn't working in live mode either.
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)?
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, });
If the invoice's collection_method is set to send_invoice then the invoice will be sent automatically as soon as the invoice is finalized. https://docs.stripe.com/api/invoices/object#invoice_object-collection_method
Have you double checked your settings under "Manage invoices sent to customers" in live mode on this page? https://dashboard.stripe.com/settings/billing/automatic
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?
yes
Is this for a one-off payment or are you creating a subscription?
No this is a one off payment
Can you show me your code for creating your Checkout Session?
on this page: https://www.hikeclerb.org/products/members-only
I need your server-side code for creating the session
Actually I think I found it. You need to specifically set invoice_creation.enabled when creating the Checkout Session if you want us to send an email when the Checkout Session payment is complete https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-invoice_creation-enabled
Yep, that looks to be missing from the create call in your code.
okkk so i just add that to the screenshot I just sent you?
Yep yep
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.
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
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?
yes
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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.
Yep, you should be good as long as you are setting invoice_creation.enabled to true here