What it does
Listens for invoice.paid, invoice.payment_succeeded, invoice.finalized, and invoice.payment_failed. For each:
- Renders a Mercury-style invoice PDF on the fly.
- Sends an HTML email with the PDF attached, branded with your company name + logo + colors.
- Subject + body adapt to the event type (paid → "Receipt for invoice…", finalized → "Invoice…", payment_failed → "Payment failed for invoice…").
Setup
- Brand → Integrations → Connect Stripe. Maillayer mints an integration row + a webhook URL.
- Stripe dashboard → Developers → Webhooks → Add endpoint. Paste:
Subscribe tohttps://<your-app>/api/hooks/stripe/<integrationId>invoice.paid,invoice.payment_succeeded,invoice.finalized,invoice.payment_failed. - Copy Stripe's signing secret (
whsec_…) and paste it into the Maillayer integration's Webhook signing secret field. - Stripe → Developers → API keys. Copy your secret key (
sk_live_…) and paste it into the integration's Stripe secret key field — encrypted at rest with yourAUTH_SECRET. - Fill in From email, Company name, address, and email for the PDF header.
- Save. Stripe will start firing events on the next invoice.
What gets sent
The email body is a clean Mercury-style card: large amount panel, "Paid on" / "Due by" line, attached PDF, optional "View on Stripe" button (if hosted_invoice_url is present in the event).
Skipped invoices
Zero-amount invoices and drafts are skipped (recipients don't need an empty receipt). Stripe occasionally fires
finalized for $0 invoices — Maillayer no-ops cleanly.