Whitelabel

Setting up Zapier with Stripe and Answerly API

Published @ 18/10/2024 by

author Nevrie
Nevrie, Co-Founder @ answerly.io

Hello there! 😊

Whether you need help setting up brand new automation or refining existing ones, we've got you covered. Let's walk through setting up Zapier with Stripe and Answerly API.

Step 1: Create the Zapier Trigger (Stripe Payment)

The first thing you're going to want to do is set up a trigger. This is the event that will kick off your Zap. Here, you will select Stripe as your app, and the event will be a successful payment. Here's a step by step breakdown:

  • Choose Stripe as the app in Zapier.
  • Select "Payment Succeeded" as your event. This means the Zap will be triggered every time a customer pays for a plan successfully.
  • Next, you'll connect your Stripe account to Zapier and select the specific payment type that your customers will be using.

Step 2: Set Up Plan Association (Lookup Table)

Since your platform uses its own plan IDs (different from Stripe's price IDs), you'll need to map these in Zapier. Here's how:

  • Add a new action in your Zap and choose Formatter by Zapier.
  • Select "Utilities" as the event and then "Lookup Table" as the transformation.
  • Set up the Input field to receive the Stripe price ID from the trigger e.g: {{ StripePriceID }}.
  • In the Lookup Table, map each Stripe price ID to your platform's plan ID. For example:
  price_1JTrRLGqVkn0rjXN1dCjQP8e  -->  plan_123
  price_1JTrbOGqVkn0rjXNbvMhQNfL  -->  plan_456
  price_1JTrbAGqVkn0rjXN8vOi8fAA  -->  plan_789
  • Optionally, set a default plan ID in case no matching Stripe price ID is found.

Step 3: Add the Action (POST to Answerly API)

This is where you'll choose the action that Zapier will take once your trigger event occurs. Let me share how:

  • Select Webhooks by Zapier as your action.
  • Choose POST as the method.
  • Enter the following URL in the setup:

https://api.answerly.io/whitelabel/edit-client-plan


Step 4: Configure the Webhook Request in Zapier

Now, you'll set up the request body for your API call! Here's how to use the Stripe data and platform plan ID:

  • Under Headers, add Content-Type: application/json.
  • In the Data part of the webhook, you will add a JSON payload that should look something like this:
{
  "APIKey": "YOUR_API_KEY",
  "planId": "",
  "emailAddress": ""
}

Replace YOUR_API_KEY with your actual Answerly API key. Use the planId from the lookup table and the emailAddress from Stripe.


Step 5: Test the Zap

Now that everything is set up, it's time to test! Zapier will send a test payment through Stripe, and if everything goes well, the platform's plan ID will be sent to Answerly’s API.


Step 6: Handle Plan Upgrades or Cancellations (Optional)

To handle plan changes or cancellations, you can create additional Zaps using Stripe’s subscription update or cancellation events as triggers.


Step 7: Monitor and Debug

Keep an eye on your Zaps to make sure everything is going smoothly. If you see any issues, you can usually find out what's wrong by checking the error responses from Answerly's API.


Additional Notes

Make sure to store the plan ID values for each plan on your site, so they can be easily referenced in the lookup table. If you run into any issues or have questions, drop us an email at hi@answerly.io. We're here to help!

Happy client managing! 😊