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

# Stripe

> Trigger Brew automations from Stripe events, new subscriptions, failed payments, cancellations, and more.

Connect Stripe to Brew so subscription and payment events trigger automations. Send onboarding when a customer subscribes, recover failed payments with dunning sequences, win back churned users.

## What You Can Do

* **Trigger automations from Stripe events.** Kick off email flows when subscriptions are created, payments fail, customers cancel
* **Auto-sync customers into your audience.** Every `customer.*` and subscription event upserts the customer into Brew with `stripe_*` custom fields (`stripe_customer_id`, `stripe_subscription_status`, `stripe_subscription_plan`, `stripe_lifetime_value_cents`, `stripe_renews_at`, etc.) you can filter and segment on
* **Backfill historical customers with one click.** After connecting, use the **Sync customers** button to import every Stripe customer in the background
* **Personalize with billing context.** Reference plan, amount, and customer details inside emails
* **Recover revenue.** Dunning and win-back automations fire automatically without you wiring up webhooks

## How It Works

1. You click **Connect with Stripe** in Brew, a one-click OAuth flow ("Stripe Apps OAuth"). Brew never sees your Stripe API keys.
2. Brew automatically registers a Connect webhook in your Stripe account on completion. No manual webhook setup, no URL to paste.
3. Stripe signs every webhook with its signing secret. Brew verifies the signature with the official Stripe SDK on receipt.
4. For each verified event Brew (a) starts every **Live** automation whose trigger matches, (b) upserts the Stripe customer into your [audience](/audience/add-contacts) with `stripe_*` custom fields, and (c) optionally syncs the customer's first/last name (toggle per-event in **Manage → Settings → Sync customer name** if you'd rather keep contact names you own).

See [How event triggers work](/integrations/integrations#how-event-triggers-work) for the conceptual flow shared by every event-source integration.

## Setup

<Steps>
  <Step title="Click Connect with Stripe in Brew">
    Open **Integrations** in Brew, click the **Stripe** card, and click **Connect**. You'll be redirected to Stripe to authorize the connection.
  </Step>

  <Step title="Approve the OAuth scopes">
    Brew requests read access to customers, subscriptions, invoices, charges, refunds, payment intents, quotes, prices, and checkout sessions. You can revoke access at any time from your Stripe Dashboard.
  </Step>

  <Step title="Brew provisions everything else">
    Once Stripe redirects you back, Brew automatically registers the Connect webhook and provisions the 22 supported event rows on this brand. There is no manual webhook setup and no per-event toggle to flip. Whether any individual event actually fires emails is gated by the bound automation being **Live**.
  </Step>

  <Step title="Explore the Manage tab">
    The **Manage** tab has four sub-tabs:

    * **Sync**: backfill every historical Stripe customer into your Brew audience in the background.
    * **Events**: live feed of every Stripe webhook this brand has received, useful for confirming the integration is wired up.
    * **Settings**: read-only event catalogue plus a per-event **Sync customer name** Switch (lets you opt OUT of letting Stripe overwrite contact first/last names you may have authored elsewhere). Triggers don't have an enable/disable toggle. They fire as long as a **Live** automation is wired to them.
    * **Templates**: one-click starter automations (welcome, trial-end, failed-payment recovery, win-back) preloaded into chat.
  </Step>

  <Step title="Build + publish your first automation">
    Open the canvas, create an automation, pick a Stripe event as the trigger, and click **Publish**. The moment Stripe fires that event for any of your customers, Brew runs the automation.
  </Step>

  <Step title="Verify it's working">
    Trigger a test event (in Stripe test mode: create a `100% off` coupon, place a subscription on yourself, or use **Send test webhook** from the Stripe Dashboard's webhook page). Within a few seconds it should appear in **Manage → Events** on the Stripe integration page in Brew, and any **Live** automation bound to that event runs against the test payload.
  </Step>
</Steps>

<Note>
  Brew only listens for events. It can't create charges, refund payments, or modify subscriptions.
</Note>

## Triggering Automations

Connecting Stripe provisions all 22 supported events as triggers in one step. There's no per-event opt-in. Each event row sits dormant until you publish an automation bound to it.

To start firing emails from a Stripe event:

1. Open the [automation builder](/create-emails/automations) and create a new automation.
2. Pick the Stripe event you want from the trigger picker (e.g. `customer.subscription.created`).
3. Build the flow: filters, delays, sendEmail nodes, and any branching.
4. Hit **Publish**. The next matching event will fire the automation.

Saving an automation as a Draft is fine for iteration: Brew records the matching events under the integration's **Manage → Events** sub-tab but won't run any nodes. Hitting **Unpublish** later pauses every flow bound to that trigger without losing your work.

> **Why no per-event toggle?** Triggers in Brew are always-on, the fire decision lives entirely on the automation's **Live** state. This way "I want to pause one specific email" stays in the automation builder where the rest of the flow logic lives, instead of being split across two tabs. See [How event triggers work](/integrations/integrations#how-event-triggers-work).

### Supported Events

Brew supports 22 Stripe events as automation triggers, across 6 categories:

**Checkout**

* `checkout.session.completed`
* `checkout.session.async_payment_succeeded`
* `checkout.session.async_payment_failed`

**Customer**

* `customer.created`
* `customer.updated`
* `customer.deleted`

**Subscription**

* `customer.subscription.created`
* `customer.subscription.updated`
* `customer.subscription.paused`
* `customer.subscription.resumed`
* `customer.subscription.trial_will_end`
* `customer.subscription.deleted`

**Invoice**

* `invoice.created`
* `invoice.paid`
* `invoice.payment_failed`
* `invoice.upcoming`

**Quote**

* `quote.finalized`
* `quote.accepted`
* `quote.canceled`

**Payment**

* `charge.refunded`
* `refund.created`
* `payment_intent.payment_failed`

<Tip>
  In chat, say *"Send this email when a subscription is canceled"* and Brew will scaffold the automation with `customer.subscription.deleted` pre-selected.
</Tip>

## Common Patterns

| Goal                        | Stripe event                                          |
| --------------------------- | ----------------------------------------------------- |
| Welcome new subscriber      | `customer.subscription.created`                       |
| Plan-change confirmation    | `customer.subscription.updated`                       |
| Dunning for failed payments | `invoice.payment_failed`                              |
| Pre-renewal reminder        | `invoice.upcoming`                                    |
| Notify before trial ends    | `customer.subscription.trial_will_end`                |
| Win-back on cancel          | `customer.subscription.deleted`                       |
| Receipt                     | `invoice.paid`                                        |
| Refund confirmation         | `charge.refunded` or `refund.created`                 |
| Post-purchase confirmation  | `checkout.session.completed`                          |
| Quote follow-up             | `quote.finalized`, `quote.accepted`, `quote.canceled` |

## Personalization

| Variable                                     | Example                              |
| -------------------------------------------- | ------------------------------------ |
| `{{@trigger:output.payload.firstName}}`      | `Alex`                               |
| `{{@trigger:output.payload.lastName}}`       | `Morgan`                             |
| `{{@trigger:output.payload.amount}}`         | `2999` (cents)                       |
| `{{@trigger:output.payload.currency}}`       | `usd`                                |
| `{{@trigger:output.payload.status}}`         | `paid`, `past_due`, `canceled`, etc. |
| `{{@trigger:output.payload.invoiceNumber}}`  | `B23B89B0-0001`                      |
| `{{@trigger:output.payload.subscriptionId}}` | `sub_1A2B3C`                         |

## Bulk-Import Existing Customers

After connecting, click **Sync customers** in the Stripe integration panel to import every existing Stripe customer into your Brew audience in the background. Brew pages through Stripe's customer list so the dialog renders live progress, and the job is resumable from the last cursor if anything fails. Imported customers land with the same `stripe_*` custom fields the webhook contact-sync writes, so they're immediately filterable and ready to receive automation emails.

## Troubleshooting

<AccordionGroup>
  <Accordion title="An event arrived but no automation fired" icon="circle-question">
    Open the canvas and confirm at least one automation bound to this event is set to **Live** (not Draft). The Brew integration's **Manage → Events** sub-tab confirms the webhook is arriving, if it isn't there, disconnect + reconnect Stripe (resets the Connect webhook secret). If the event is there but no email sent, the only remaining gate is `automation.published`.
  </Accordion>

  <Accordion title="Stripe shows 400 'Invalid signature' on every delivery" icon="triangle-exclamation">
    Disconnect and reconnect the Stripe integration in Brew. The webhook secret is managed by Brew automatically, if it's out of sync, reconnecting re-registers a fresh signing secret.
  </Accordion>

  <Accordion title="Refund automation doesn't fire on charge.refunded" icon="rotate-left">
    Use `refund.created`. It ships with richer refund-specific details (reason, status, partial vs full). `charge.refunded` is also supported but only carries charge-level totals.
  </Accordion>

  <Accordion title="Brew is overwriting customer names I already had" icon="user-pen">
    In the Stripe integration's **Manage → Settings** sub-tab, every event has a separate **Sync customer name** toggle. Turn it off for events where you'd rather keep the names already in your audience.
  </Accordion>

  <Accordion title="I want to test before going live" icon="flask">
    Connect Brew to your Stripe **test mode** first. Create a test customer and subscription, watch them appear in **Manage → Events**, pre-publish your automations as Drafts, run test sends, then connect production once you're happy.
  </Accordion>
</AccordionGroup>

## Requirements

* A Stripe account with admin access (needed to authorize OAuth)
* Live mode connected for production automations; test mode is supported for testing

## Need help?

Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:

<Tabs>
  <Tab title="Self-Service Tools">
    <CardGroup cols="2">
      <Card title="Search Documentation" icon="magnifying-glass" color="#c44925">
        Type in the "Ask any question" search bar at the top left to instantly find relevant documentation pages.
      </Card>

      <Card title="ChatGPT/Claude Integration" icon="robot" color="#c44925">
        Click "Open in ChatGPT" at the top right of any page to analyze documentation with ChatGPT or Claude for deeper insights.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Talk to Our Team">
    <CardGroup cols="2">
      <Card title="Schedule a Call" icon="calendar" color="#c44925" href="https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ1iYoRUG1J792XQpbuQLjSRRDupr7MwraFK-HQRCtTYdBmrQi8nZu2qXfzKQigb8gbKJK3KN3-R">
        Book time with our founders for personalized guidance on strategy, best practices, or complex implementation questions.
      </Card>

      <Card title="Call Us Directly" icon="phone" color="#c44925">
        Need immediate assistance? Reach us at **+1-(332)-203-2145** for urgent issues or time-sensitive questions.
      </Card>

      <Card title="Slack Channel" icon="slack" color="#c44925">
        Our preferred support channel. You'll receive an invite after signup for direct founder support and fast responses.
      </Card>

      <Card title="Email Support" icon="envelope" color="#c44925" href="mailto:support@brew.new">
        Contact us at **[support@brew.new](mailto:support@brew.new)** for detailed inquiries or if you prefer not to use Slack.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
