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

# Stripe Setup Guide

> Step-by-step guide to connect Stripe Restricted API Keys and Webhook events to Indic8.

Connect your Stripe account to stream one-time card charges, recurring subscriptions, invoices, and customer refunds into Indic8.

## What You Need to Connect

| Credential                              | Where to find it in Stripe               | Description                                                                       |
| :-------------------------------------- | :--------------------------------------- | :-------------------------------------------------------------------------------- |
| **Stripe Restricted API Key (RAK)**     | Stripe Dashboard > Developers > API keys | Secure, read-only token to fetch historical and live charges, invoices, and plans |
| **Webhook Signing Secret** *(Optional)* | Stripe Dashboard > Developers > Webhooks | Verifies live push events arriving at Indic8                                      |

***

## Part 1: Create a Restricted API Key (Read-Only)

We recommend using a **Restricted API Key (RAK)** rather than a standard secret key. A restricted key only grants read access to the specific resources Indic8 needs.

<Steps>
  <Step title="Open Stripe Developers Settings">
    1. Log in to your [Stripe Dashboard](https://dashboard.stripe.com).
    2. Click **Developers** in the top right header.
    3. In the left menu, click **API keys**.
  </Step>

  <Step title="Create Restricted Key">
    1. Scroll down to the **Restricted keys** section.
    2. Click the button **+ Create restricted key**.
    3. In **Key name**, enter: `Indic8 Analytics Sync`.
  </Step>

  <Step title="Set Read Permissions">
    Configure the following permissions to **Read**:

    | Resource                          | Required Access | Why it is needed                                |
    | :-------------------------------- | :-------------- | :---------------------------------------------- |
    | **Charges**                       | `Read`          | Reads one-time card payments, amounts, and fees |
    | **Customer balance transactions** | `Read`          | Reads credit balance adjustments                |
    | **Customers**                     | `Read`          | Computes repeat customer retention and cohorts  |
    | **Disputes**                      | `Read`          | Tracks chargebacks and disputed payments        |
    | **Invoices**                      | `Read`          | Reads B2B invoice payments and renewal bills    |
    | **Plans & Products**              | `Read`          | Groups sales by product SKU and tier            |
    | **Subscriptions**                 | `Read`          | Calculates MRR, ARR, renewals, and churn        |

    Leave all other resources set to `None`.
  </Step>

  <Step title="Save and Copy Key">
    1. Click **Create key** at the bottom of the page.
    2. Stripe will reveal your restricted key (starts with `rk_live_...`).
    3. Copy this key to your clipboard.
  </Step>
</Steps>

***

## Part 2: Connect Key in Indic8

1. Open your [Indic8 Dashboard](https://app.indic8.ing).
2. Go to **Settings > Integrations > Stripe**.
3. Paste your restricted key into the **Stripe Restricted API Key** field.
4. Click **Connect Stripe**.

Indic8 will immediately test the connection and begin syncing your Stripe products, active subscriptions, and charges.

***

## Part 3: Set up Real-Time Webhooks (Optional)

To receive instant transaction updates in under 2 seconds:

<Steps>
  <Step title="Copy Indic8 Webhook Endpoint">
    In Indic8 **Settings > Integrations > Stripe**, copy your Webhook URL:

    ```text theme={null}
    https://api.indic8.ing/v1/webhooks/stripe/whk_live_xxxxxxxx
    ```
  </Step>

  <Step title="Add Endpoint in Stripe">
    1. In Stripe, go to **Developers > Webhooks**.
    2. Click **Add destination** (or **Add endpoint**).
    3. Paste your Indic8 URL into **Endpoint URL**.
    4. Click **Select events** and select:
       * `checkout.session.completed`
       * `charge.succeeded`
       * `charge.refunded`
       * `customer.subscription.created`
       * `customer.subscription.updated`
       * `customer.subscription.deleted`
       * `invoice.paid`
    5. Click **Add endpoint**.
    6. Reveal the **Signing secret** (`whsec_...`) and paste it into Indic8.
  </Step>
</Steps>
