---
title: "How to set up coupons (for Magento 1.x)"
description: "Magento supports Shopping Cart Price Rules that can be used to apply a discount to a customer's order. Coupon codes can be created for existing price rules, so that shoppers can easily leverage a given code to apply a discount during the checkout process."
canonical_url: "https://help.klaviyo.com/hc/en-us/articles/115005246547"
markdown_url: "https://help.klaviyo.com/hc/en-us/articles/115005246547.md"
locale: "en-us"
category: "Content"
section: "Coupons and ecommerce integrations"
updated: "2026-10-28"
---

# How to set up coupons (for Magento 1.x)

**📝 Note:** Klaviyo's Magento 1 integration is no longer accepting new installations and will reach full end-of-support in late 2027. Klaviyo Support is no longer able to assist with Magento 1–related requests.

## You will learn

Magento supports Shopping Cart Price Rules that can be used to apply a discount to a customer's order. Coupon codes can be created for existing price rules, so shoppers can use a code to apply a discount during checkout.

Klaviyo's Coupons for Magento feature allows stores with an existing Magento 1.x integration to do the following:

- Create new coupons in Klaviyo associated with pre-existing price rules in Magento.

- Include dynamic coupons in email and SMS/MMS flow messages, so each recipient receives a unique code.



This guide will explain how to get set up with Magento coupons in Klaviyo.

**📝 Note:** Magento-generated dynamic coupons are available in email and SMS/MMS flow messages. They are not available in campaign emails. Sending unique coupon codes in a campaign can require thousands of codes per second, and Magento server rate limits can affect code generation at that volume.

## Requirements

These steps require an existing, enabled Magento 1 integration and the Klaviyo extension installed in Magento. For details about the data synced by the integration, see the [Magento 1 data reference](https://help.klaviyo.com/hc/en-us/articles/115005254528.md).

## Enable the REST API

Start by enabling the REST API by creating a new REST Role and giving it full access, then assigning the role to one of your admin users.

1. Click on **System > Web Services > REST - Roles**.

2. Create a new Admin role. For the field *Role Name* enter a name, for example "Administrator".

3. Click on the **Role API Resources** tab on the left. Set *Resource Access* to **All** and click **Save Role**.

4. Next, navigate to **System > Web Services > REST - Attributes**.

5. Select **Admin** from the list of user types.

6. Set *Resource Access* to **All** and click **Save.**

7. Next, navigate to **System > Permissions > Users**.

8. Select an admin user from the list and click **Edit user**.

9. Click the **REST role** tab on the left sidebar.

10. Click the radio button to assign the new REST admin role to your user.




![Image](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/f93a77021c81315223583dd2bbf2cacee113341f-1400x345.png?auto=format)

11. Click **Save User**.



You've now enabled the REST API for your Magento store.

**📝 Note:** If you are unsure whether or not your REST API is configured properly, please review the steps outlined in our [resource on troubleshooting coupons for Magento 1x](#h_01GZ248ZJVNJTRVFYKMTKFXFEK).

## Generate REST credentials in Magento

To enable Klaviyo's Magento Coupons feature, generate REST API credentials using the admin user you assigned the REST role to, then enter them in Klaviyo.

1. Log in as the admin user you assigned the REST role to in the [Enable the REST API section above.](#h_01KKKQ1Q7BEAGKX5DGW5DZ1X5G)

2. Click on **System > Configuration** and then click on **Klaviyo** under the *Customers* section.

3. Click **Generate OAuth Tokens**.



![763276](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/7d11b32e17c76511612caa572478f4da850faff6-1164x612.png?auto=format)

The *Consumer Key, Consumer Secret, Authorization Token,* and the *Authorization Secret* will populate. You will copy/paste these values into your Klaviyo account in the next step.

## Set up Magento coupons in Klaviyo

**📝 Note:** Your Magento server must support HMAC-SHA1 signatures for OAuth authentication.

1. From your Klaviyo account, [navigate to your Magento integration](https://www.klaviyo.com/integration/magento).

2. On the **Settings** tab, go to **Advanced > Coupons** and select **Activate coupons**.

3. Enter your **Consumer key**, **Consumer secret**, **Authorization token**, and **Authorization secret** from Magento.



![Image](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/79b1ab04a6c3149d23557076636ccad0d42aa932-1179x1117.png?auto=format)

4. Click **Save**.



After the settings save successfully, you can create a coupon from the **Coupons** page.

## Create a Magento coupon in Klaviyo

Open the **[Coupons page](https://www.klaviyo.com/coupons)** in Klaviyo and select the **Magento 1 Coupons** tab.

**📝 Note:** Before you create a new coupon, you will first need to define a Price Rule in Magento that will include all the specifications for the coupon. Price Rules cannot be created from within Klaviyo. A new coupon created in Klaviyo must reference a pre-existing Price Rule in Magento.

When creating a Price Rule in Magento, note that the option to associate a new Price Rule with a specific coupon should be left set to Specific Coupon and you must have the *Use Auto Generation* checkbox selected.

1. Click **Create Magento 1 Coupon**.

2. Enter the **Name** and **Magento rule ID**:

   - **Name:** Use a unique name with only letters, numbers, and underscores, up to 32 characters long. You cannot change the name after creating the coupon.

   - **Magento rule ID:** Enter the ID of the price rule you created in Magento to associate it with this coupon.

3. Click **Create coupon**. After creation succeeds, Klaviyo returns you to the Magento coupon list.



![Image](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/7daa4e8ba8d461847ebffb974fe44b4ebde419a9-915x446.png?auto=format)

After creation, you can review the following details in Klaviyo:

- **Coupon:** The coupon name in the list.

- **Active timeframe:** Open the coupon to see the dates supplied by its Magento price rule. The timeframe can show:

  - Active, No Expiration

  - Date A - No Expiration

  - Date A - Date B

  - Expires Date B

- **Created:** The date the coupon was created.

- **Last Updated:** The date the coupon was last updated.



To edit a coupon, click its name, update the **Magento rule ID**, and click **Update coupon**. To delete a coupon, open its row menu, select **Delete**, and confirm the deletion.

![Image](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/027f1333ea095e61afdc0163c491bc67e4309749-891x171.png?auto=format)

## Use a Magento coupon in a flow email

Once a coupon is created, insert it into a flow email using the following template tag. To display the same code in multiple places, repeat the tag with the same coupon name.

```text
{% coupon_code 'CouponName' %}
```

Replace *CouponName* with the name of your coupon. For example:

![mceclip0__2_.png](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/a411790ee81946398f174449e878ce6f4f83f31a-1184x1082.png?auto=format)

Using the same coupon in an email and an SMS/MMS flow message lets Klaviyo reuse the code already assigned to that recipient. Repeating the coupon name does not guarantee a new code for each message.

## Use unique coupons in SMS flow messages

Unique coupons are also available for your [SMS/MMS messages](https://help.klaviyo.com/hc/en-us/articles/360044863132.md) in flows. Generate the codes just like you would for email. Then, use the template tag below to add the coupon code to your SMS or MMS message:

`{% coupon_code 'CouponName' %}`.

In the snippet, change *CouponName* to the name of your coupon and add the snippet to your SMS or MMS flow message.

![2020-06-16_17-58-37.png](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/8022572a21738bf0f9548f5d0610481a7ec20a8d-2148x1240.png?auto=format)

You can use 1 coupon name per SMS/MMS message. If you add different coupon names, you will see an error. In email, you can use [show/hide blocks](https://help.klaviyo.com/hc/en-us/articles/7655965301531.md) to send different coupons based on where someone lives or what they’ve done. To show 1 offer per recipient, set the conditions so only the intended coupon block appears.

![2020-06-17_09-51-08.png](https://cdn.sanity.io/images/6ct6b26e/help-center-prod/e91efdf228679a3ac5ef34f16d42597f6082b6d4-2106x1244.png?auto=format)

## Troubleshoot errors

### Unable to activate coupons or connect to the REST API

You may see “Unable to activate coupons due to an authentication issue” in the integration settings, or “Unable to connect to the REST API with the specified REST credentials. Please check that these credentials are valid in your Magento admin.”

First, check that all 4 REST credentials were copied correctly. If they are correct, check these possible causes:

1. Your Magento server is not set up to support HMAC-SHA1 signatures for OAuth authentication.

2. You may not have enabled full role access for the REST API.



Confirm that your Magento server supports HMAC-SHA1 signatures for OAuth authentication. Then check the following REST permissions and server settings:

1. Uncomment, or add, the rewrite rule in your .htaccess file. This is the line you’ll want to ensure is un-commented:
`RewriteRule ^api/rest api.php?type=rest [QSA,L]`

2. Check that your REST role is set up correctly.
Follow the steps in the [Enable the REST API section above](#h_01KKKQ1Q7BEAGKX5DGW5DZ1X5G).

3. If you use Apache, check that it passes the `Authorization` header to PHP. The Magento REST connection uses OAuth credentials. See this [guide to passing the Authorization header](https://devhacksandgoodies.wordpress.com/2014/06/27/apache-pass-authorization-header-to-phps-_serverhttp_authorization/) for server configuration details.



If the error specifically mentions an SSL certificate, check that your Magento store has a valid, trusted SSL certificate installed.

### All recipients receive the same coupon code

When creating a Price Rule in Magento, the option to associate a new Price Rule with a specific coupon should be left set to **Specific Coupon** and you must have the **“Use Auto Generation”** checkbox selected.

Click on your Price Rule in Magento, and under **General Information**, scroll down to the line option "Coupon" and change this setting to "Specific Coupon". Next, check the box for auto generation here. This should fix the issue and allow us to generate a new unique coupon code for each email recipient.
