# 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](https://www.bonzai.pro/api/v1/products/%7Bproduct:uuid%7D/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](https://www.bonzai.pro/api/v1/products/%7Bproduct:uuid%7D/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.
