#ivan-connect-emailreceipt
1 messages · Page 1 of 1 (latest)
@spark rampart First, are you using Standard accounts and creating a payment on the connected account using Direct Charges?
Yeah, I am using standard accounts and I am using checkout sessions for the payment
Okay so that's not possible for you to control directly. There are 4 options
- Let the individual Standard account(s) control this setting in their Dashboard
- Write your own email integration yourself as a platform
- After a successful payment, listen to
checkout.session.completed, look at the resulting PaymentIntent/Charge and check if it hasreceipt_emailset. If it does, then one was sent, if it doesn't, none was sent and you can call the Update Charge API https://stripe.com/docs/api/charges/update and passreceipt_emailto the email associated with the Checkout Session to force one - Collect an email upfront and set it on
payment_intent_data[receipt_email]when you create the Checkout Session
ivan-connect-emailreceipt
Got it, thank you.
I am going to focus in the point #3 for my next questions:
The checkout session form has a email field, so if an email is provided it means that a successful payment email is sent to the user, if not(I could verify it with the checkout.session.completed), I could update the Charge to pass the customer email to force successful payment email. Did I understand well?
👋
Stepping in as koopajah needed to step away
The customer_email field on the Checkout Session does not necessarily determine that a receipt email was sent... the email would only be sent if the Connected Account had the successful payment emails setting turned on in their Dashboard.
That is why you need to actually check the receipt_email property
Now I understand better, thank you.
I see that to update the charge I would need the charge_id, but I am checking the checkout.session.object and I don't see the charge_id there. Should I get the charge_id in the checkout.session.completed event?
You want to retrieve the PaymentIntent and expand the latest_charge: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-latest_charge
Are you familiar with expansion? If not take a look at https://stripe.com/docs/expand
Interesting, so in the call to retrieve the checkout session I would put something like this:
expand: ['payment_intent.latest_charge']. That would return me the charge_id to update the receipt_email property with the customer email to force that the Stripe sends an email to the customer that confirm the successful payment.
All this before is an option to the scenario where my connected account doesn't set Successful payments option?
Yep
Can I test that the email is sent in test env?
Ok, thank you very much.