Using Zapier to Create and Set Coupon Codes for Affiliates

There are a number of practises and features you can use to boost your affiliate program - to name a few, you could set up bonus incentives for affiliates, create automated emails to keep affiliates engaged, or setup automated tasks via Zapier to help you manage your affiliate program for example.

In this blog post we’ll give an example on how you can create a coupon code for your affiliates using Zapiers built-in Formatter app. There are countless automated flows you could apply this to - here is the scernario I’ve drawn out for myself:

I have a Shopify store with an affiliate program, which I intend on expanding by having every new costumer in Shopify automatically get added to my program as an affiliate. I also want to offer my affiliates more ways they can refer affiliates to my store, via Instagram, or word of mouth by example. Coupons would be great for this, as they’d be able to easily share coupon codes.

Creating coupons without Zapier entails creating them in the eCommerce platform you’re using first, then you would save the coupon codes that you’ve created in the platform in the Tapfiliate profiles of your affiliates (either manually, or via the API) - after that you hook up your shopping cart to Tapfiliate via the API. Via Zapier, this process is a fair bit more simplified - and best of all, it can be applied to a variety of platforms, not just Shopify as Tapfiliate connects to dozens of eCommerce platforms via app automation tool Zapier.

Here’s an outline of the Zapier integration for my usecase:

  1. Trigger: New customer
  2. Search or Create: Find or create affiliate based on the new customers email
  3. Action: Use Zapiers Formatter app to transform the newly found/created affiliate ID into a coupon code
  4. Search: Find a customer in Shopify based on the email of the new customer in Shopify (from the first step of the Zap)
  5. Action: Use Zapiers Webhooks app to make a POST request to create (and save) the discount code created in step 3 of the Zap for the new customer in Shopify

Easy enough!

Closer look at how my Zapier integration is setup:

Step 1 new customer
I set up the trigger to fire when a new customer is created in Shopify.

Step 2
Then, I use Tapfiliate’s search step to find or create an affiliate. If an affiliate with this new customers email doesn’t already exist, at this stage, I create a new affiliate.

Step 3
Then, using Zapiers Formatter tool, I transform the affiliate ID from lowercase, to uppercase.

Step 3 5
This is what the affiliates coupon code will look like once it’s gone through the Formatter.

Step 4
After that, I want to save the coupon code to the new customer in Shopify. So what I do is add the search step ‘find customer’ - I can find the customer based on the email address provided in the first step of this Zap.

Step 5
If you are setting up this very same Zapier integration, you may need the help of a developer for this last step. Here, I will use Zapiers Webhook app to send a POST request to Shopify, in order to set up a discount code - this is the endpoint I’m using: https://help.shopify.com/api/reference/discounts/discountcode#create

And that’s it!

Now, everytime a checkout happens in Shopify, this Zap will check if the customer who just checked out is already an affiliate. If she/he is not, an affiliate account will be created. Once the affiliate account is created, or the affiliate is found, a coupon code will be created based on the affiliate ID. Then, the Zap will search for the customer in Shopify, and once the customer is found, the coupon code will be created, and saved to this customer.

Now that you know the gist of setting up coupon codes in Tapfiliate via Zapier, you should be able to apply a smiliar workflow for a variety of use cases and different platforms! This is only one example. Have any questions for us regarding Zapier integrations? Feel welcome to reach out via the website!

Related articles

Automate Your Affiliate Marketing with Tapfiliate and Zapier
Feature update: Zapier
Feature update: Coupons