# `Accrue.Emails.PaymentSucceeded`
[🔗](https://github.com/szTheory/accrue/blob/accrue-v0.3.1/lib/accrue/emails/payment_succeeded.ex#L1)

Reference email template for the `payment_succeeded` receipt email.

## mjml_eex integration (CORRECTED pattern — RESEARCH.md Pitfall #3)

This module uses the idiomatic `use MjmlEEx, mjml_template:` pattern,
NOT the broken `use Phoenix.Swoosh, formats: %{"mjml" => :html_body}`
shape that CONTEXT.md D-22 originally sketched. MjmlEEx's `__using__/1`
compiles the MJML template at build time (via the Rustler NIF backend)
and generates a `render/1` function that returns rendered HTML.

The `:mjml_template` option is resolved relative to the calling
module's source file — so the template lives at
`priv/accrue/templates/emails/payment_succeeded.mjml.eex` and is
referenced here with a relative path from `lib/accrue/emails/`.

## Assigns

- `:customer_name` — string, shown in the greeting
- `:amount` — pre-formatted string (e.g., `"$10.00"`); formatting
  happens at render-call time via `Accrue.Money.to_string/1`
- `:invoice_number` — string
- `:receipt_url` — absolute URL to the hosted receipt

# `debug_mjml_template`

Returns the raw MJML template. Useful for debugging rendering issues.

# `render`

Safely render the MJML template using Phoenix.HTML

# `render_text`

```elixir
@spec render_text(map()) :: String.t()
```

Plain-text body rendered from the sibling `.text.eex` template.

# `subject`

```elixir
@spec subject(map()) :: String.t()
```

Subject line for the receipt email.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
