Using Zapier to Create and Set Coupon Codes for Affiliates

Using Zapier to Create and Set Coupon Codes for Affiliates

In this article

Here's the outline of the Zapier integration for my use case

Closer look at how my Zapier integration is setup:

There are a number of practices 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 set up automated tasks via Zapier to help you manage your affiliate program for example.

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

I have a Shopify store with an affiliate program, which I intend to expand 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 the outline of the Zapier integration for my use case

  • 1. Trigger: New customer
  • 2. Search or Create: Find or create an affiliate based on the new customer’s email.
  • 3. Action: Use Zapier’s 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 Zapier’s 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:

new customer


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

trigger setup


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.

Find and create an affiliate


Then, using Zapier’s Formatter tool, I transform the affiliate ID from lowercase to uppercase.

Zapier formatter tool


This is what the affiliate’s coupon code will look like once it’s gone through the Formatter.

Affiliate coupon code


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.

Find the customer


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, every time 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 similar 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!

In this article

Here's the outline of the Zapier integration for my use case

Closer look at how my Zapier integration is setup: