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

# Dodo Payments Integration

> Sync revenue data from Dodo Payments to power segments and automations

Connect your Dodo Payments account to automatically sync revenue metrics for all your subscribers. This enables powerful segmentation based on MRR and LTV.

## What is Dodo Payments?

[Dodo Payments](https://dodopayments.com) is a simple payments platform designed for indie developers and small businesses. It offers straightforward pricing, easy integration, and handles payments globally with minimal setup.

## Connecting Dodo Payments

Dodo Payments requires manual API key and webhook setup. Here's how to connect:

### Step 1: Get Your Dodo API Key

1. Go to your [Dodo Payments Dashboard](https://dashboard.dodopayments.com)
2. Navigate to **Settings → API Keys**
3. Create a new API key or copy an existing one
4. Copy the API key

<Warning>
  Your API key is only shown once. Store it securely before closing the dialog.
</Warning>

### Step 2: Find Your Business ID

1. In the Dodo Payments Dashboard, go to **Settings**
2. Your **Business ID** is displayed in your account settings (format: `bus_xxxxxxxxx`)
3. Copy this ID for later

### Step 3: Set Up Webhooks in Dodo Payments

1. In Dodo Payments, go to **Settings → Webhooks**
2. Click **Add Endpoint**
3. Enter your Sequenzy webhook URL:
   ```
   https://api.sequenzy.com/webhooks/dodo/{your-company-id}
   ```
   <Note>
     You can find this URL in Sequenzy when connecting Dodo Payments—it's automatically shown in the connection modal.
   </Note>
4. Select these events to listen for:
   * `payment.succeeded`
   * `payment.failed`
   * `subscription.active`
   * `subscription.created`
   * `subscription.updated`
   * `subscription.renewed`
   * `subscription.cancelled`
   * `subscription.expired`
   * `subscription.on_hold`
   * `subscription.failed`
   * `refund.succeeded`
5. Click **Create** to save the webhook endpoint
6. Copy the **Webhook Secret** (format: `whsec_xxxxxxxxx`)

### Step 4: Connect in Sequenzy

1. Go to **Settings → Integrations** in Sequenzy
2. Click **Connect** next to Dodo Payments
3. Enter your:
   * **Business ID** (from Step 2)
   * **API Key** (from Step 1)
   * **Webhook Secret** (from Step 3)
4. Click **Connect Dodo Payments**

Sequenzy will immediately begin receiving webhook events from Dodo Payments.

## Synced Attributes

When connected, Sequenzy adds these attributes to each subscriber matched by email:

| Attribute | Type   | Description                                                                 |
| --------- | ------ | --------------------------------------------------------------------------- |
| `mrr`     | Number | Monthly Recurring Revenue in dollars (normalized from any billing interval) |
| `ltv`     | Number | Lifetime Value - total payments minus refunds                               |

### MRR Calculation

MRR is normalized from any billing interval:

* **Monthly**: Used as-is
* **Yearly**: Divided by 12
* **Weekly**: Multiplied by 52, then divided by 12
* **Daily**: Multiplied by 365, then divided by 12

Only `active` subscriptions count toward MRR.

## Automatic Tags

Sequenzy automatically applies tags to subscribers based on their Dodo Payments subscription status:

| Tag            | Applied When                    |
| -------------- | ------------------------------- |
| `customer`     | Has an active subscription      |
| `cancelled`    | Subscription has been cancelled |
| `churned`      | Subscription has expired        |
| `saas.monthly` | On a monthly billing interval   |
| `saas.yearly`  | On a yearly billing interval    |

These tags update automatically whenever subscription status changes via webhooks.

## Tracked Events

When you connect Dodo Payments, these events are automatically tracked for use in automations:

| Event                   | Triggered When                                      |
| ----------------------- | --------------------------------------------------- |
| `saas.purchase`         | Payment succeeded or subscription activated/renewed |
| `saas.purchase_monthly` | Monthly subscription purchase                       |
| `saas.purchase_yearly`  | Yearly subscription purchase                        |
| `saas.cancelled`        | Subscription cancelled                              |
| `saas.churn`            | Subscription expired                                |
| `saas.payment_failed`   | Payment failed or subscription on hold/failed       |
| `saas.refund`           | Refund succeeded                                    |

## Using Revenue Data

### Building Segments

With MRR and LTV synced as numeric attributes, you can create sophisticated segments:

**Revenue-based segments:**

* `mrr >= 100` — High MRR customers
* `ltv > 1000` — Lifetime high-value customers
* `mrr >= 50 AND mrr < 200` — Mid-tier customers

**Combining with tags:**

* `tag = churned AND ltv > 500` — High-value churned customers (win-back targets)
* `tag = cancelled AND mrr >= 100` — At-risk high-value customers needing attention
* `tag = saas.yearly AND mrr >= 100` — Yearly enterprise customers

### Automations

Trigger automations when revenue attributes change:

* Send a thank-you email when `ltv` exceeds a threshold
* Trigger a win-back sequence when a subscriber gets the `churned` tag
* Notify your team when a high-value customer cancels

## How Matching Works

Subscribers are matched by email address (case-insensitive). A Dodo Payments customer with email `User@Example.com` will match a subscriber with email `user@example.com`.

If a Dodo Payments customer doesn't have an email in the webhook or doesn't match any subscriber, the event is acknowledged but no action is taken.

## Troubleshooting

### Webhooks Not Arriving

1. Verify your webhook URL is correct in Dodo Payments settings
2. Check that you've selected the correct events
3. Check Dodo Payments webhook logs for failed delivery attempts
4. Ensure your Sequenzy webhook endpoint is accessible

### Invalid Webhook Signature

If webhooks are failing with signature errors:

1. Verify you copied the complete webhook secret from Dodo Payments
2. Re-create the webhook endpoint in Dodo Payments and update the secret in Sequenzy
3. Ensure you're using the correct secret format

### Customer Email Not Found

Dodo Payments webhooks include customer data with email addresses. If events are being acknowledged but subscribers aren't being updated:

1. Ensure the customer email in Dodo Payments matches a subscriber in Sequenzy
2. Check that customers have valid email addresses in Dodo Payments
