#patrick_api
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/1217838425668059157
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Why are you creating both a payment intent and invoice?
You can collect payment with the invoice
When you create both, that's technically creating 2 payments
Invoices are build on top of payment intents, so the invoice is already creating one
I prepared this to share, here is what I did on both server and client sides
Creating both doesn't really make sense though
Unless you want to collect payment twice
Ok, no that was not my intention.
I'm quite a newbie with these things.
My intention was to send the invoice to the customer by email right after the payment is validated.
Do you need them to receive an actual invoice or just a receipt of the payment?
an actual invoice
So the only way to have stripe email your customer an invoice is if you want them to complete payment via the invoice link in the email
But if you want to collect payment on your site and them have them receive an invoice after payment, you'll need to use your own email service to send the invoice link
Ha ok.
The second option is more appropriate to my case.
Got it. So you can create the invoice and then use its underlying payment intent & client secret to accept payment on your site: https://docs.stripe.com/api/invoices/object#invoice_object-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Then once they complete payment you can send them an email with a link to the invoice's pdf: https://docs.stripe.com/api/invoices/object#invoice_object-invoice_pdf
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Sorry, this must be all done manually ?
I'm confused, I was thinking I could generate them on the fly, like sending a receipt, but perhaps I'm wrong
Yeah
You can generate your own pdf if you just want to use payment intents
But if the intent is to accept payments on your site and you want them to also receive an invoice via email, you need to handle that part yourself
Ok got it.
So then, coming back to your question (receipt vs invoice), if I want at least to send a receipt by email, is this possible via an endpoint ?
You can set it up so that after completing payment we automatically send the customer an email with the receipt.https://docs.stripe.com/receipts?payment-ui=direct-api
That can be used with the payment intents endpoint
Invoices wouldn't be necessary
ok I see. Will try that then, thank you!