Welcome to a practical Zapier tutorial! In this guide, we'll use Zapier to revoke user permissions when a subscription in Stripe is cancelled. We do not focus on any one specific user permission, since the same set up steps apply to all permissions in Zapier. We do assume that a subscription fee has been set up to charge for these permissions using Stripe.
IMPORTANT: After the subscription is canceled on Stripe, the user permissions are changed automatically by Zapier, but not instantly.
The speed of the automation depends on how quickly Zapier polls your marketplace for updates. The time it takes Zapier to get new information from your marketplace is called the 'polling time' and its length depends on which Zapier plan you are subscribed to.
The default polling time is two minutes, which means that when a transaction is canceled, it can take up to two minutes until the user permissions are revoked.
About Zapier
Zapier is a powerful and versatile tool for integrating different tools to your marketplace. You can learn more about Zapier in our introductory article or through this brief video from Zapier.
If you haven’t read the introduction and the action/event Zapier articles, we encourage you to do so to understand better how Zapier works. But if you want to dive straight into action, feel free to read on!
What you need for this tutorial
External accounts
Zapier Account
Create a Zapier account if you don’t already have one. You can sign up at www.zapier.com.
During registration, Zapier may ask which apps you plan to use. You can enter Sharetribe at this point or add it later.
How to set up your marketplace
Correct User Permissions
This tutorial assumes that you have set up your marketplace so that some rights are limited to only subscribed users. For example, only users with an active subscription can view listings, post listings, or initiate transactions. You can set this up in the Access Control section of your Console.
Subscription system on Stripe
You’ll need to have set up membership subscriptions on your Stripe account. You can find more about this from this article.
In order to test this Zap, there needs to be at least one user with a canceled subscription on your Stripe account. You can both initiate and cancel the subscription manually from your Stripe dashboard for the purposes of this tutorial.
Metadata settings on Stripe
The user whose rights you are modifying needs to have the correct metadata in their user account. Specifically, they need to have a field called “User ID” that includes their Sharetribe user ID.
This is something that you can add manually on the Stripe dashboard, for example just for the sake of this tutorial. If you choose to do so, you can find the metadata settings by opening the customer's information sheet on your Stripe dashboard, and editing the metadata from the lower right corner of the screen.
However, it’s best to automate this step. See our Zapier tutorial on how to grant permissions after a subscription fee is paid.
Integration API Application
You’ll also need to create an application using the Integration API. The instructions for doing this are below. For the purposes of this tutorial, you don’t need to know details about using the APIs, but if you want, you can read about them from our technical documentation here.
With these pieces in place, let's get started!
Getting your Integration API key from Console
Navigate to Build > Advanced > Applications
Click on “+ Add a new application”
Give the application a descriptive name (like Zapier), and select ‘Integration API’.
Click ‘Add application’.
Important: Copy and paste the Client ID and Client secret to a safe place, like a password manager.
Think of the Client ID and secret as a sort of password to your marketplace that can be used through other services. Note that you won’t be able to ever see the Client secret to this application again in the Console under any circumstances. Make sure you copy it to a secure place. If you lose it, you will need to create a new application.
Creating the Zap, step by step
(Optional) Importing a pre-existing Zap
Go to www.zapier.com and log in with your account (or create a free one, if you don't already have one)
Open the pre-made Zap for revoking permissions on Sharetribe here
Click on ‘Try this Zap'
Step 1: Find a canceled subscription from your Stripe account
Connect your Stripe account by logging in with your username and password
Choose ‘Canceled Subscription’ as the Trigger event
Click ‘Continue’ to move to the ‘Configure’ section
Leave the search field empty
Select ‘False’ in ‘Would you like to use test mode data for the test sample?’
Click ‘Continue’ to move to the ‘Test’ section
Test the trigger, and make sure it finds a cancelled subscription from your marketplace, along with all related information.
Step 2: Revoke user permissions
Select ‘Sharetribe’ as the app. Use the Client ID + Secret that you created earlier to log in.
As the ‘Action event’, select ‘Update Permissions’
Click ‘Continue’ to move to the ‘Configure’ section
Under ‘User ID’, click the Plus sign +, and Select “1. Customer Metadata User ID: xxxx” from the drop down. You can quickly find it by searching for “metadata”.
Select “False” the permissions you would like to revoke. Note that you do not need to set values for all the permissions: you can choose any number of permissions to revoke from the user. The options are:
Viewing listings
Posting listings
Initiating transactions
Select ‘False’ for ‘Expand the response to return the full resource?’, as it is not needed here.
Click 'Continue' to go to the 'Test' section. Test the Zap, and make sure from your Sharetribe Console that the permissions were correctly revoked for the correct user.
Final thoughts
Thanks for reading this tutorial about creating a Zap for automated permission revoking.
There is a companion tutorial for granting of user permissions after a subscription fee is paid. Follow this tutorial to set it up.
Feel free to read through other parts of our Zapier guide as well: the Introduction and the article about Events and Actions.
We also have tutorials and templates for various different Zaps available, including SMS notifications, digital calendar invites, and more. You can read about all our templates in this article.
Please get in touch with us from your Console or from the bottom right section of this page from the chat widget if you have any questions about this guide, or anything else. We'll be happy to help!