Order Emails

Sends a transactional email when a Payload order is created and on each status change, routed through your configured email adapter.

Community 0 MIT v1.0.0

Installation

pnpm add payload-order-emails

About

Payload's official ecommerce plugin writes an order but never sends mail to anyone who pays. This package closes that gap by attaching one `afterChange` hook to the orders collection and firing a transactional email through `payload.sendEmail`, so whatever adapter you already configured under `email` (nodemailer, Resend, and so on) is the one used. Events key off the four statuses the ecommerce plugin declares, `processing`, `completed`, `cancelled` and `refunded`, plus a `created` event on first write. `created`, `completed`, `cancelled` and `refunded` are enabled by default; `processing` only fires when an order moves back to it. A status the plugin does not recognize falls through to a `defaultEvent` you opt into, so a status added by another plugin will not surprise you. Recipients are configurable per event as `customer`, `admin`, `both` or `none`. When the order carries no `customerEmail`, which happens for logged-in customers in the official Stripe flow, the hook reads the customer record on the same `req` to find the address. Amounts are formatted from the minor unit, so `2500` becomes `25.00 EUR`, with `currencyDecimals` settable globally or per currency code. Templates are plain text by default and carry no shop name or markup. Each event accepts a string template with `{{placeholder}}` tokens or a function receiving the full context, and a separate `adminTemplate` for the admin copy. The defaults export is importable so you can extend rather than rewrite. The plugin adds no collection, field, or migration; it only appends a hook. Sending is awaited inside the request, so a slow SMTP server slows the triggering write, and a failed send is caught and logged without retry rather than blocking the order save. A `dryRun` option resolves and logs every message without handing it to the adapter, intended for staging.

Package info

Package name
payload-order-emails
Latest version
1.0.0
Unpacked size
31 kB
License
MIT
Last publish
Aug 20, 2026

More from Poseidonas

View profile