Linking a Unique Discount Code on Klaviyo to Shopcada Discounts

You can now add a unique discount code into your Klaviyo email content, that is linked to a Shopcada discount.

Prerequisites: 

  1. After creating your discount on Shopcada, do take note of its Discount ID:


        
  2. When creating your discount on Shopcada to be linked later on, do ensure you have the "Require discount code to activate this discount" setting enabled:



Setting Up on Klaviyo:

  1. From the left pane under Actions > Drag and drop the  Webhook action before the Email action

  2. Click on "Set up Webhook"  

  3. Set the Destination URL as https://<your domain name>/api/plugin/klaviyo/discount  Ensure that you change <your domain name> to your actual domain name ie. https://testingsite.com/api/plugin/klaviyo/discount


  4. Set the JSON Body as such:

    {
    "discount_id": [discount id],
    "expire_in": [expire in],
    "profile_id": "{{ person.KlaviyoID }}",
    "email": "{{ person.email }}"
    }


    discount_id
    : Replace "[discount id]" with the discount ID created on Shopcada. This can be found at the top of the discount configuration page.

    expire_in: Replace "[expire in]" with the number of days the discount code will expire, from the time of generation.
    profile_id and email are both required, and to be copied exactly as shown above. Do not modify it.

    ❗️Note: Do remove the [ ] square brackets for Discount ID and Expire In.
    An example of what your JSON Body should look like: 
    {
    "discount_id": 3,
    "expire_in": 7,
    "profile_id": "{{ person.KlaviyoID }}",
    "email": "{{ person.email }}"
    }
     
     

       
  5. After you're done, scroll up slightly, and click on "Preview" located above the Destination URL field.

       
  6. Scroll down on the pop up > Click on Send Test Request



  7. To ensure that the discount code has fully synced to Klaviyo, add a 1-5 mins Time Delay between Webhook Action and Email Action.


  8. To add the discount code token into your email content, click on "Add personalization" and add discount_code.
    Once added it should show: {{ person|lookup:"discount_code"|default:'' }}



  9. Your set up is done! Do preview and test out your email to ensure your email and discount are working as intended.