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

# Stripe

> Connect Stripe payment and subscription data to Mavera for revenue-driven persona creation, retention content, and churn-aware messaging.

Stripe captures the full financial lifecycle of your customers — subscriptions, invoices, disputes, and payment methods. Pipe this data into Mavera to build revenue-grounded personas, generate retention messaging for at-risk accounts, and produce case studies from real growth trajectories.

<Info>
  **Stripe API**

  * **Base URL:** `https://api.stripe.com/v1/`
  * **Auth:** Bearer token (`Authorization: Bearer sk_live_...`)
  * **Encoding:** Form-encoded request bodies (not JSON)
  * **Rate limit:** 25 requests/second per endpoint
  * **Docs:** [stripe.com/docs/api](https://stripe.com/docs/api)

  **Mavera API**

  * **Base URL:** `https://app.mavera.io/api/v1`
  * **Auth:** Bearer token (`Authorization: Bearer MAVERA_API_KEY`)
</Info>

```mermaid theme={"dark"}
flowchart TD
    subgraph data["Stripe Data"]
        customers["Customers"]
        subscriptions["Subscriptions"]
        invoices["Invoices"]
        disputes["Disputes"]
        paymentMethods["Payment Methods"]
    end
    subgraph surfaces["Mavera Surfaces"]
        personas["Personas"]
        generate["Generate"]
        mave["Mave"]
        chat["Chat"]
    end
    subgraph outputs["Outputs"]
        revenuePersonas["Revenue Personas"]
        retentionContent["Retention Content"]
        marketPersonas["Market Personas"]
        caseStudies["Case Studies"]
        disputePrevention["Dispute Prevention"]
    end
    customers --> personas
    subscriptions --> personas
    subscriptions --> generate
    invoices --> mave
    customers --> mave
    disputes --> chat
    paymentMethods --> personas
    personas --> revenuePersonas
    personas --> marketPersonas
    generate --> retentionContent
    mave --> caseStudies
    chat --> disputePrevention
```

## Prerequisites

<Steps>
  <Step title="Get your Stripe API key">
    From [Stripe Dashboard → API keys](https://dashboard.stripe.com/apikeys), copy your Secret key (`sk_live_` or `sk_test_`). Use a restricted key with read-only access to Customers, Charges, Invoices, Subscriptions, Disputes, and Payment Methods.
  </Step>

  <Step title="Get your Mavera API key">
    From [Mavera → API Keys](https://app.mavera.io/settings/api-keys), generate a key with `personas:write`, `generations:write`, and `brand-voices:write` scopes.
  </Step>

  <Step title="Set environment variables">
    ```bash theme={"dark"}
    export STRIPE_API_KEY="sk_live_..."
    export MAVERA_API_KEY="mav_..."
    ```
  </Step>
</Steps>

## Jobs

| # | Job                                                             | Stripe Data                         | Mavera Surface | Output                   |
| - | --------------------------------------------------------------- | ----------------------------------- | -------------- | ------------------------ |
| 1 | [Revenue Segment → Persona Tiering](revenue-persona-tiering)    | Customers, Subscriptions            | `/personas`    | Tiered personas by MRR   |
| 2 | [Churn Prediction → Retention Content](churn-retention-content) | Subscriptions (past\_due, canceled) | `/generations` | Retention messaging      |
| 3 | [Payment Method Geography → Market Personas](market-personas)   | Charges, Payment Methods            | `/personas`    | Regional market personas |
| 4 | [Invoice Data → Case Study Generation](case-study-generation)   | Invoices, Customers                 | `/mave/chat`   | Case study drafts        |
| 5 | [Dispute Analysis → Messaging Fix](dispute-messaging-fix)       | Disputes                            | `/responses`   | Rewritten product copy   |

***

***

## Rate Limits & Production Notes

| Concern     | Stripe                               | Mavera                                   |
| ----------- | ------------------------------------ | ---------------------------------------- |
| Rate limit  | 25 req/sec per endpoint              | Varies by plan (see dashboard)           |
| Pagination  | `has_more` + `starting_after` cursor | Offset-based                             |
| Idempotency | `Idempotency-Key` header on writes   | Built-in deduplication on persona names  |
| Webhooks    | Available for real-time events       | Webhook support for generation callbacks |
| Test mode   | `sk_test_` keys hit sandbox          | Use `X-Mavera-Sandbox: true` header      |

<Warning>
  Never log or commit Stripe secret keys. Use environment variables or a secrets manager. Keys starting with `sk_live_` have full account access — a leaked key can move money. Rotate immediately if exposed.
</Warning>

**Production checklist:**

* [ ] Use Stripe restricted keys with read-only access
* [ ] Implement exponential backoff for both APIs
* [ ] Store Mavera persona IDs mapped to Stripe segments for updates
* [ ] Test with `sk_test_` + Mavera sandbox before production
* [ ] Set up Stripe webhooks instead of polling
* [ ] Log responses (without sensitive fields) for debugging

## Next Steps

<CardGroup cols={2}>
  <Card title="Stripe Webhooks" icon="bell" href="/integrations/stripe-webhooks">
    Trigger Mavera jobs from events like `invoice.payment_failed`.
  </Card>

  <Card title="HubSpot Integration" icon="hubspot" href="/integrations/hubspot">
    Combine Stripe revenue with HubSpot CRM for full-funnel personas.
  </Card>

  <Card title="Persona Management" icon="users" href="/guides/personas">
    Version, merge, and archive personas as segments evolve.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference">
    Full reference for all Mavera endpoints used in this guide.
  </Card>
</CardGroup>
