Microsoft Power Pages added Stripe payments integration last year, and I wrote a post about the anatomy of this integration and suggested improvements. Since then, the Power Pages team have implemented many good changes, including handling security keys, and the solution now looks solid.
One question remained unanswered: How do you send an email receipt from Stripe to the customer using Power Pages Stripe?
Stripe documentation explains how to send email receipts automatically when payments are completed. However, we have no control over creating the PaymentIntent object as it’s done by the Power Pages Stripe solution on the “server” side. On the Power Pages Studio side, there is no way to specify an email address value for Stripe (like there is for the payment amount) or another configuration to specify the email to initiate sending a receipt.
The good news is that there is a way to update the PaymentIntent already created and specify the receipt_email property. Once set, this is used to send the receipt when payment is complete. Moreover, updating this value would trigger a new email event after payment completion!
This is great, you may say, but how do we access the PaymentIntent created by Power Pages? And where to get the required identifier of it to make such an API call?
This is where the Payment table comes in handy with the column “Payment Identifier” (pp_paymentidentifier). When a user navigates to the payment step where the Stripe form is displayed, the following happens:
So, we need a simple Power Automate Cloud Flow triggered by a new Payment record and calling Stripe API to update the PaymentIntent with the required email address. Once the payment is successful, the email receipt will be sent by Stripe to the specified email upon successful payment.
Two complications, though.
Firstly, where do I get the required email in that flow? The Payment table has no email column. Well, it has the “Regarding” column value. While it may not be well documented (is it?), this column points to the record on which Multistep Form you added the Payment form. Depending on your case, this table or tables related to it will eventually give you the email value – you’ll need just to navigate to get it.
The other complication is that Stripe sends email receipts only in “live” (production) mode keys, according to the Stripe documentation on Email receipts and paid invoices. So, technically, you cannot test this solution end to end with an emailed receipt sent without an actual payment.
Regarding the secret key, don’t forget that the updated Power Pages integration requires you to store the live key in an Azure Key Vault. So you need to set one up first. After that, in the cloud flow actions, you can access it via a secure environment variable backed by the Azure Key Vault. See here on how to set up such a variable: https://learn.microsoft.com/en-us/power-apps/maker/data-platform/environmentvariables-azure-key-vault-secrets
With all the above, let’s implement this into a working solution now.
Assumptions for the steps below that you have:
The rest should be straightforward.
1. Create a new automated cloud flow with the Dataverse trigger “When a new record is created”:
2. Use the value of the Regarding column to get the record of the table for which the payment is for, assuming that one contains the email address to send the receipt to:
3. The next block extracts the secret value from the Azure Key Vault. It’s needed in production only for the live key. See more on how to extract secrets from Azure Key Vault here. Note:
4. And now we’re ready to call the Stripe API to update Payment intent. Note:
if(parameters('PORTAL Is Production (tec_PORTALIsProduction)'), outputs('Retrieve_Stripe_Secret')?['body/EnvironmentVariableSecretValue'], parameters('PORTAL Stripe Test Key (tec_PORTALStripeTestKey)'))
5. Now, in your Power Pages portal, complete your multistep form with a payment. You will receive the Stripe email receipt if you are in live mode with the production live secret; otherwise, the flow should succeed anyway.
This is it, folks! I hope this helps and let me know if you have questions or improvements to this solution. All the best!
Original Post https://cloudminded.blog/2025/01/18/how-to-send-email-receipt-from-stripe-in-power-pages-payments/