> For the complete documentation index, see [llms.txt](https://bonzai.gitbook.io/bonzai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bonzai.gitbook.io/bonzai/stripe-+-zapier-use-case.md).

# Stripe + Zapier use case

In this tutorial, you will learn how to integrate Stripe with Bonzai using Zapier. The process is designed to grant access to products when a subscription is activated and to revoke it when the subscription is no longer valid.

### Prerequisites

* Bonzai API access
* Zapier account
* Stripe account

## Handling new Stripe subscriptions

### Step 1: trigger setup in Zapier

* **Trigger**: Choose Stripe as your trigger app and select the event "New Subscription."
* **Stripe Account**: Connect your Stripe account to Zapier.

### Step 2: action setup for Bonzai API 'Invite'

* **Action**: Choose a Webhooks by Zapier and set it to "POST."
* **URL**: Enter the Bonzai API endpoint for invite (e.g., <https://www.bonzai.pro/api/v1/products/{product:uuid}/invite>).
* **Payload type**: Set to "form."
* **Data**: Configure the data with the following fields:
  * `email`: The email address from the Stripe subscription event.
  * `code`: Use the Stripe subscription ID as the code.

### Handling Stripe Unsubscriptions

### Step 1: trigger setup in Zapier

* **Trigger**: Choose Stripe as your trigger app and select the event "Subscription Cancelled."
* **Stripe account**: Connect your Stripe account to Zapier.

### Step 2: action setup for Bonzai API 'Revoke'

* **Action**: Choose a Webhooks by Zapier and set it to "POST."
* **URL**: Enter the Bonzai API endpoint for revoke (e.g., <https://www.bonzai.pro/api/v1/products/{product:uuid}/revoke>).
* **Payload Type**: Set to "form."
* **Data**: Configure the data with the following fields:
  * `code`: Use the Stripe subscription ID to filter which access to revoke.

### Conclusion

By integrating Bonzai's API with Zapier, you can automate product access based on Stripe subscription events, streamlining the process for both you and your customers.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://bonzai.gitbook.io/bonzai/stripe-+-zapier-use-case.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.
