> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fusioncore.us/llms.txt
> Use this file to discover all available pages before exploring further.

# Email Flows

> Pre-built flows that email a payment receipt or a failed auto-charge alert to a customer's billing contact.

## Overview

The **Email Flows** accelerator ships two pre-configured, record-triggered Flows that automatically email a fusionCore order's billing contact when a payment succeeds or an auto-charge attempt fails — no Apex required. Both flows watch the Commerce Financial Event object and send through a Visualforce email template branded with your Business Unit's logo and details.

* **Payment Receipt** — fires when a payment on an Order or installment succeeds.
* **Failed Auto-Charge** — fires when an auto-charge attempt against a saved payment method (a Wallet Item) fails on a non-cancelled installment.

This accelerator is layered on top of core fusionCore (Platform, Commerce, and Portal) — it's an optional add-on, not part of the base install.

## Prerequisites

* Salesforce Emails enabled and your sending domain verified.
* An Organization-Wide Email Address created and verified in your org.

## How to Configure

<Steps>
  <Step title="Set up your Organization-Wide Email Address">
    In **Setup → Organization-Wide Addresses**, create and verify the address you want these emails to send from. If you're testing in a scratch org or sandbox, also turn on **Use a substitute email address for unverified domains**.
  </Step>

  <Step title="Point the accelerator at that address">
    Go to **Setup → Custom Metadata Types → Constant → Manage Records**, and edit the record labeled **Sender Org-Wide Email Address Name**. Set its value field to the exact email address you verified in the previous step, replacing the shipped placeholder.
  </Step>

  <Step title="Confirm billing contacts have a valid email">
    The Payment Receipt flow only fires when the Financial Event's billing contact has an email address on file — confirm that's populated for the orders you expect this to cover.
  </Step>
</Steps>

Both flows are Active as soon as the package is installed and the sender address is configured correctly — there's nothing else to turn on.

## Limitations and Common Pitfalls

* **A failed send doesn't raise an error.** If the configured sender address doesn't exactly match a verified Organization-Wide Email Address, the send fails quietly by design — no email goes out, and no error surfaces in the flow. If a recipient reports a missing email, check the sender address configuration first.
* **Recipient is always the billing contact.** There's no CC, BCC, or alternate-recipient option — if the Financial Event's billing contact lookup is empty, no email is sent.
* **The failed auto-charge alert only fires for installments tied to a saved payment method (a Wallet Item).** A failed charge with no saved payment method won't trigger this email.
* **No retry logic.** The flow sends one notification when its criteria are met; it doesn't retry the charge or track how many attempts have failed.
* **Branding needs a Business Unit.** The email's logo and footer only render when the order's Business Unit is populated — an order without one gets a plain email.
* **A few Visualforce email templates ship but aren't wired to either flow** — they're available for your team to use in a custom flow, but don't assume every template included in the package sends automatically.
