> ## 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.

# RevenueCat

> Trigger Brew automations from RevenueCat purchase, renewal, cancellation, and billing-issue events across App Store, Play Store, Stripe, and Web Billing.

Connect [RevenueCat](https://www.revenuecat.com) so in-app purchase and subscription events fire Brew automations across every billing platform. The same lifecycle email flow can serve Apple App Store, Google Play, Amazon, Stripe, and Web Billing subscribers without per-store glue code.

## What you can do

* **Trigger automations from RevenueCat events.** Welcome new paid customers, win-back during cancellation grace periods, re-engage after expiration, drip dunning on billing issues
* **Auto-sync subscribers into your audience.** Every RevenueCat event upserts the subscriber into Brew with `revenuecat_*` custom fields (`revenuecat_subscription_status`, `revenuecat_product_id`, etc.) you can filter and segment on
* **Cover every store with one connection.** App Store, Play Store, Amazon, Stripe, Web Billing — RevenueCat normalises receipts, Brew normalises triggers
* **Personalize with product context.** Reference plan, price, store, and cancellation reasons inside emails

<Info>
  RevenueCat webhooks require the **Pro plan or above**. The free / Starter plans don't ship webhooks.
</Info>

## How it works

1. Brew mints a unique webhook URL for your brand and you paste it into your RevenueCat Dashboard webhook configuration.
2. RevenueCat doesn't sign request bodies — instead you give them an Authorization header value (a shared secret you generate). On every webhook Brew constant-time compares the Authorization header against the stored secret.
3. For each verified event Brew (a) starts every **Published** automation whose trigger matches and (b) upserts the subscriber into your [audience](/audience/add-contacts) with `revenuecat_*` custom fields, using the `$email` subscriber attribute as the contact's email.

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="Generate your Brew webhook URL">
    In Brew, open **Integrations**, click the **RevenueCat** card, and click **Generate URL**. Copy the URL Brew generates.
  </Step>

  <Step title="Generate a shared Authorization secret">
    Run `openssl rand -hex 32` to generate a random 32-character secret. RevenueCat does NOT sign request bodies — it echoes this Authorization header value back on every webhook, and Brew constant-time compares it on receipt.
  </Step>

  <Step title="Add the webhook in RevenueCat">
    Open [app.revenuecat.com](https://app.revenuecat.com), go to **Integrations → Webhooks → + Add new configuration**, and configure:

    * **Webhook URL** — the Brew URL from step 1
    * **Authorization header** — the secret from step 2 (a `Bearer <secret>` prefix is OK; Brew strips it before comparison)
    * **Environment** — Production, Sandbox, or both as needed

    Click **Save**.
  </Step>

  <Step title="Paste the same secret into Brew">
    Paste the secret from step 2 into the Brew connect form and click **Connect**. Brew constant-time compares the Authorization header on every webhook against this value.
  </Step>

  <Step title="Verify it's working">
    Trigger a sandbox purchase in RevenueCat (test purchase on iOS / Android, or use the **Send test event** button in the webhook config). Within a few seconds it should appear in the **Manage → Recent events** panel of the RevenueCat integration page in Brew. If it doesn't, recheck the Authorization header value in both places.
  </Step>
</Steps>

<Note>
  RevenueCat doesn't include user emails on most events by default. Call `Purchases.setEmail(email)` from your iOS / Android / Web SDK right after sign-in so Brew can resolve the real recipient. Without it, automations fan out to a placeholder address.
</Note>

## Triggering automations

Once connected, every RevenueCat event below is provisioned automatically and available as a trigger in the [automation builder](/create-emails/automations). The **Manage** tab is a read-only catalogue plus a live **Recent events** stream — no per-event enable step. Whether an event fires is controlled by whether the bound automation is **Published**.

### Supported events

Brew supports the following 11 RevenueCat events:

**Purchase**

* `INITIAL_PURCHASE`
* `NON_RENEWING_PURCHASE`

**Subscription**

* `RENEWAL`
* `PRODUCT_CHANGE`
* `CANCELLATION`
* `UNCANCELLATION`
* `EXPIRATION`
* `SUBSCRIPTION_PAUSED` (Google Play only)
* `SUBSCRIPTION_EXTENDED`
* `TRANSFER`

**Billing**

* `BILLING_ISSUE`

<Warning>
  `CANCELLATION` does **NOT** revoke access — it only signals intent. Use it to drip win-back during the grace period. Wait for the matching `EXPIRATION` event before deactivating user-facing features.
</Warning>

<Tip>
  In chat, say *"Send a dunning email when a payment fails"* and Brew will scaffold the automation with `BILLING_ISSUE` pre-selected.
</Tip>

## Common patterns

| Goal                                   | RevenueCat event        |
| -------------------------------------- | ----------------------- |
| Welcome to premium                     | `INITIAL_PURCHASE`      |
| Receipt + 1-year loyalty milestone     | `RENEWAL`               |
| Thank-you for one-time purchases       | `NON_RENEWING_PURCHASE` |
| Tier-change confirmation               | `PRODUCT_CHANGE`        |
| Win-back during grace period           | `CANCELLATION`          |
| Welcome back after re-sub              | `UNCANCELLATION`        |
| Re-engagement after access ends        | `EXPIRATION`            |
| Dunning ("update your payment method") | `BILLING_ISSUE`         |
| Pause acknowledgment                   | `SUBSCRIPTION_PAUSED`   |
| Courtesy "your sub was extended"       | `SUBSCRIPTION_EXTENDED` |
| Ops alert on entitlement transfer      | `TRANSFER`              |

## Personalization

| Variable                                                     | Example                                                     |
| ------------------------------------------------------------ | ----------------------------------------------------------- |
| `{{@trigger:output.payload.productId}}`                      | `pro_monthly`                                               |
| `{{@trigger:output.payload.store}}`                          | `APP_STORE`, `PLAY_STORE`, `STRIPE`, `AMAZON`, `RC_BILLING` |
| `{{@trigger:output.payload.environment}}`                    | `PRODUCTION` or `SANDBOX`                                   |
| `{{@trigger:output.payload.priceUsd}}`                       | `9.99`                                                      |
| `{{@trigger:output.payload.currency}}`                       | `USD`                                                       |
| `{{@trigger:output.payload.cancelReason}}` (CANCELLATION)    | `CUSTOMER_SUPPORT`                                          |
| `{{@trigger:output.payload.newProductId}}` (PRODUCT\_CHANGE) | `pro_yearly`                                                |

## 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 **Published** (not Draft). The Brew integration's **Manage → Recent events** panel confirms the webhook is arriving — if it isn't there, the issue is upstream (Authorization secret mismatch, RevenueCat plan tier). If the event is there but no email sent, the only remaining gate is `automation.published`.
  </Accordion>

  <Accordion title="All my emails go to a placeholder address" icon="user-slash">
    RevenueCat doesn't carry user emails by default. Set the `$email` subscriber attribute in your app's RevenueCat SDK after sign-in: `Purchases.setEmail(email)` on iOS / Android / Web. Brew uses that attribute as the recipient on every event for that subscriber.
  </Accordion>

  <Accordion title="Brew returns 401 on every webhook" icon="lock">
    The Authorization header value RevenueCat is sending doesn't match the secret stored in Brew. Make sure they're identical (a `Bearer ` prefix is optional — Brew strips it before comparing).
  </Accordion>

  <Accordion title="A user lost access right after CANCELLATION fired" icon="triangle-exclamation">
    `CANCELLATION` only signals intent — RevenueCat doesn't revoke access yet. Drip a win-back email on `CANCELLATION` and **only revoke features on the matching `EXPIRATION` event**.
  </Accordion>

  <Accordion title="No webhooks fire at all" icon="ban">
    RevenueCat webhooks require the **Pro plan or above**. Free / Starter accounts won't deliver webhooks even if the configuration looks correct in the dashboard.
  </Accordion>
</AccordionGroup>

## Requirements

* A RevenueCat account on the **Pro plan or above** (free and Starter plans don't ship webhooks)
* Permission to create webhook configurations in the RevenueCat dashboard

## 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>
