Send branded Stripe payment receipts with Amazon SES

By General Input

Every time a Stripe payment succeeds, email your customer a clean, branded HTML receipt from your own verified Amazon SES address instead of the default Stripe template.

Integrations

  • Stripe
  • Amazon SES

Type

Deterministic Code

Categories

  • Finance
  • Operations

When Stripe fires a charge.succeeded webhook, retrieve the charge and its customer, format a clean branded HTML receipt, and send it through Amazon SES to the customer's email. Every field comes straight from the Stripe payload, so every run is deterministic; no drafting, no judgment.

Trigger: a Stripe webhook subscribed to the charge.succeeded event.

Step 1. Take the charge id from the webhook payload and call Stripe's Retrieve Charge operation to load the full charge, including amount, currency, description, receipt_url, receipt_email, and payment_method_details.card.last4. If the charge has no customer id, stop.

Step 2. Call Stripe's Retrieve Customer operation with that customer id to fetch name, email, and preferred_locales. If the customer has no email on file, stop and log.

Step 3. Decide whether to send. The workflow reads a config flag deferToStripeReceipt. If deferToStripeReceipt is true and the charge's receipt_email field is already populated, skip the send and log that Stripe is handling it. Otherwise proceed.

Step 4. Build the receipt content. Format the amount by dividing the Stripe amount by the currency's minor unit and rendering it with the currency code (e.g. 2599 with currency usd becomes $25.99). Compose an HTML body that includes: business name and logo (from workflow config), the formatted amount, the charge description, the last four digits of the card, a Stripe-hosted receipt link built from receipt_url, and a support link pulled from workflow config. Produce a plain-text fallback with the same information. If the customer's preferred_locales includes a language other than English and you have copy for it in the workflow config, use that language; otherwise fall back to English.

Step 5. Call Amazon SES's Send Email operation using the Simple content shape (Subject plus Html and Text bodies, not Raw MIME). Set FromEmailAddress to the verified SES identity configured on the workflow (e.g. billing@acme.com), Destination.ToAddresses to the customer's email, and ReplyToAddresses to the workflow's support address if configured. Subject should read like 'Your receipt from {business_name}'.

Config the workflow exposes: business_name, from_address (a verified SES identity), support_url, deferToStripeReceipt (boolean), and an optional locale_overrides map keyed by language code. All copy that appears in the email should be sourced from these config values, not hardcoded.

Related prompts

Explore more prompts
Let support send one-off Loops emails without an engineerCustomer lifecycle inspector for Loops, Stripe and PostHogMonth-end Stripe finance pack, stored and shared in SlackRank your Intercom queue by what each customer pays youCatch the trials quietly dying before the card gets chargedWork every open Stripe dispute from one chargeback war roomLook up any customer's support, billing and CRM in one pageInvestor update studio that builds your board deck monthlySell and invoice Ghost newsletter sponsor slots in one boardSupport console that pairs Gladly chats with orders and refunds