# Stripe

The Stripe integration allows you to automatically send email or SMS surveys to your customers based on Stripe events like checkout completions, refunds, and subscription changes.

## Step 1: Connect Your Stripe Account

1. In Zigpoll, go to **Settings** -> **Manage Integrations**
2. Find **Stripe** in the integrations list and enable it
3. Enter your Stripe **API Key** (secret key or restricted key)
4. Press **Save**

{% hint style="info" %}
You can use a full secret key (`sk_live_...` or `sk_test_...`) or a restricted key. If using a restricted key, it must have the following permissions enabled:

* **Customers** - Read
* **Webhook Endpoints** - Write
  {% endhint %}

## Step 2: Create a Survey

1. Go to your account dashboard and click **Create Survey**
2. Choose a question template or build your own slides
3. In the delivery step, select one of the Stripe templates:

| Template                   | Stripe Event                    | Description                                       |
| -------------------------- | ------------------------------- | ------------------------------------------------- |
| **Checkout Completed**     | `checkout.session.completed`    | Sent after a Stripe Checkout session is completed |
| **Charge Refunded**        | `charge.refunded`               | Sent after a refund is processed                  |
| **New Subscription**       | `customer.subscription.created` | Sent when a customer starts a new subscription    |
| **Subscription Cancelled** | `customer.subscription.deleted` | Sent when a subscription is cancelled             |

Each template supports both **Email** and **SMS** delivery. Use the dropdown on the template card to choose your preferred channel.

4. Adjust the **Trigger Settings** to control the delay before sending (e.g., send 1 hour after the event)
5. Click **Create Survey**

Zigpoll will automatically register a webhook endpoint on your Stripe account. You can verify it in your Stripe Dashboard under **Developers** -> **Webhooks**.

## Step 3: Customer Targeting (Optional)

You can filter which customers receive the survey based on Stripe event data. Go to the **Targeting** tab on your survey and configure rules using:

* **Amount** - Filter by payment amount (e.g., only send for orders over $50)
* **Currency** - Filter by currency code (e.g., only USD transactions)
* **Metadata** - Filter by Stripe metadata key=value pairs
* **Product IDs** - Filter by Stripe product IDs
* **Price IDs** - Filter by Stripe price IDs

## Step 4: Customize Your Email

Go to the **Email** tab on your survey to customize:

* Subject line
* Header, body, and footer text
* Button text and colors
* Sender name and reply-to address

## How It Works

1. When the configured Stripe event fires, Stripe sends a webhook to Zigpoll
2. Zigpoll verifies the webhook signature and extracts the customer's email
3. After the configured delay, Zigpoll sends the survey via email or SMS
4. Responses are tracked in your Zigpoll dashboard with Stripe metadata (customer ID, amount, event type)

## Troubleshooting

**Survey not being sent?**

* Check that your survey is **visible** (not hidden or archived)
* Check the **Activity** tab to see if emails were queued and sent
* Verify the webhook endpoint exists in your Stripe Dashboard under **Developers** -> **Webhooks**
* For subscription events, the customer email is fetched from the Stripe Customer object. Make sure your customers have an email address on file.

**Permission error when creating a survey?**

* Your API key needs **Webhook Endpoints** write permission. If using a restricted key, update its permissions in the Stripe Dashboard.

**Webhook showing 403 errors?**

* The webhook signing secret may be out of sync. Try deleting the survey and creating a new one to re-register the webhook.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zigpoll.com/integrations/stripe.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
