# Stripe billing emails with Groundmail

Send your Stripe customer emails from Groundmail: failed payments, trials ending, receipts, checkout recovery and win-back. They go out from your domain, in your templates, as automations you can change like any other. Stripe sends one email per moment; with Groundmail you can send a series (two dunning emails, three days apart) that stops as soon as the customer pays.

## Connect Stripe

In Groundmail, open **Integrations → Stripe** and click **Connect with Stripe**. In Stripe, pick your account and approve read-only access to the Groundmail app. You come back to **Automations → New** to choose your emails.

Groundmail can read events, customers, invoices, subscriptions, checkout sessions, and payments with the card used. It can't charge, refund, or change anything in Stripe, and it never sees your payouts or balance.

To disconnect, click **Disconnect** on **Integrations → Stripe**, and uninstall the Groundmail app in Stripe (**Apps**) to remove its access there too. Uninstalling the app in Stripe also disconnects it in Groundmail.

### Or use a restricted key

If you'd rather not install an app, click **Use a restricted key instead** on the same page:

1. In Stripe, open **Developers → API keys** and [create a restricted key](https://dashboard.stripe.com/apikeys/create) named "Groundmail".
2. Give it these permissions and leave the rest at **None**:
   - **Webhook Endpoints: Write** (Groundmail adds the webhook for you)
   - **Read** on Customers, Invoices, Subscriptions, Checkout Sessions and Payment Methods
3. Paste the key and click **Connect Stripe**.

Groundmail adds one webhook to your Stripe account and stores the key encrypted. Use a test-mode key (`rk_test_…`) first to try it with Stripe's test events. Connected with a key before `payment_intent.payment_failed` was added (November 2, 2026)? Paste it again to receive that event.

## Start an automation from a Stripe event

After you connect, **Automations → New** shows a **From Stripe** group:

| Template | Starts on | What it does |
|----------|-----------|--------------|
| Payment failed | `invoice.payment_failed` | Two emails, 3 days apart. Stops when `invoice.paid` arrives for the customer. |
| Payment didn't go through | `payment_intent.payment_failed` | For first and one-off payments: one email 30 minutes after a failed payment, saying why (for example, the bank didn't approve it). Stops if they pay; at most once a day per customer. |
| Trial ending | `customer.subscription.trial_will_end` | One email, 3 days before the trial ends. |
| Receipt | `invoice.paid` | One email with the amount and a link to the invoice. |
| Checkout recovery | `checkout.session.expired` | Two emails, a day apart. Stops on `checkout.session.completed`. |
| Win-back | `customer.subscription.deleted` | One email, 7 days after a subscription ends. |

Each one opens as a draft, so nothing sends until you turn it on. To start any automation on a Stripe event, open its **Starts when** step, choose **Stripe** as the source and pick the event.

`payment_intent.payment_failed` also fires when a renewal charge fails. If you run **Payment failed** for renewals, set the **Payment didn't go through** button to your own billing page and keep it for first payments, or turn on just one of the two, so a renewal doesn't send both.

Stripe events arrive with the `stripe.` prefix (for example `stripe.invoice.payment_failed`), keyed to the Stripe customer, so a stop event only stops that customer's run.

## Fields you can use in emails

| Field | Example |
|-------|---------|
| `{{event.data.customer.name}}` | Maria |
| `{{event.data.customer.email}}` | maria@example.com |
| `{{event.data.invoice.amount}}` | $29.00 |
| `{{event.data.invoice.number}}` | A1F2-0042 |
| `{{event.data.invoice.url}}` | Stripe's hosted invoice page, where the customer can update their card and pay |
| `{{event.data.invoice.pdf}}` | Invoice PDF link |
| `{{event.data.card.brand}}`, `{{event.data.card.last4}}` | Visa, 4242 (failed payments) |
| `{{event.data.plan.name}}` | The first line item on the invoice |
| `{{event.data.next_attempt}}` | Nov 9, 2026 (when Stripe retries) |
| `{{event.data.trial.ends}}` | Nov 5, 2026 |
| `{{event.data.checkout.amount}}`, `{{event.data.checkout.url}}` | Checkout total and the recovery link, when you turn on Stripe's checkout recovery |
| `{{event.data.payment.amount}}` | $15.00 (failed payments) |
| `{{event.data.payment.reason}}` | "your bank didn't approve the payment. Approve it in your banking app, or use another card" |

## Turn off Stripe's own email for the same moment

If an automation here sends failed-payment emails or receipts, turn off Stripe's matching email so customers don't get two:

- Failed payments: Stripe **Settings → Billing → Revenue recovery**, then turn off **Send emails when card payments fail**.
- Receipts: Stripe **Settings → Customer emails**, then turn off **Successful payments**.

The Stripe page in Groundmail reminds you until you mark it done.

## Disconnect

**Integrations → Stripe → Disconnect** stops Groundmail using your Stripe events. For a key connection it also removes the webhook from your Stripe account and deletes the key; for the app, uninstall it in Stripe to remove its access. Automations that start on Stripe events stop starting; their history stays. You can also revoke the restricted key in Stripe at any time.
