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

# Setup

# Connecting Stripe to ChatCrafterAI

Follow these steps to connect your Stripe account to ChatCrafterAI.

## Prerequisites

Before starting, ensure you have:

* A Stripe account (create one at stripe.com if needed)
* API keys ready (publishable and secret key)
* Webhook secret from Stripe

## Step-by-Step Setup in ChatCrafterAI

1. Navigate to **Agent Settings** → **Integrations**
2. Click **Add Integration** → Select **Stripe**
3. Choose mode: **Production** or **Test**
4. Paste your **Publishable Key**
5. Paste your **Secret Key**
6. Paste your **Webhook Secret**
7. Click **Connect**
8. Verify the status shows **Connected**
9. Click **Test Connection** to verify the agent can communicate with Stripe

## Finding Your Credentials in Stripe

### API Keys

1. Log into your Stripe dashboard at stripe.com/dashboard
2. Go to **Developers** → **API keys**
3. Copy the **Publishable key** (starts with `pk_`)
4. Copy the **Secret key** (starts with `sk_`)

### Webhook Secret

1. In Stripe dashboard, go to **Developers** → **Webhooks**
2. Find the ChatCrafterAI webhook endpoint (or create one if missing)
3. Click to view details
4. Copy the **Signing secret** (starts with `whsec_`)

## Test vs Production Mode

**Test Mode:**

* Use this first to experiment without real transactions
* Test card numbers available (see [Testing Guide](./testing))
* No actual charges processed

**Production Mode:**

* Use when ready for real customer transactions
* Real charges will be processed
* Requires production API keys

You can configure both modes and toggle between them as needed.

## Webhook Setup

ChatCrafterAI automatically creates a webhook endpoint in your Stripe account when you connect. If you need to create it manually:

**Endpoint URL:** `https://api.chatcrafterai.com/stripe/webhook`

**Events to enable:**

* `payment_intent.succeeded`
* `customer.subscription.updated`
* `invoice.payment_succeeded`
* `charge.refunded`

## Verification

After setup, verify the connection:

1. Open Chatlab (testing environment)
2. Send a test message: "What's my balance?"
3. Agent should return a success message with balance amount
4. If you see an error, check that:
   * Keys are copied exactly (no extra spaces)
   * You're using the correct mode (test vs production)
   * Webhook secret matches exactly

## Troubleshooting Setup

**Connection failed?**

* Verify API keys are correct (no spaces before/after)
* Ensure you're using keys from the correct mode
* Check your Stripe account is active

**Webhook issues?**

* Confirm webhook secret is copied correctly
* Verify webhook endpoint is reachable
* Check Stripe webhook dashboard for delivery status

## Next Steps

Now that Stripe is connected, learn about [Available Actions](./actions) your agent can perform.
