# Manage coupons and gift cards

> After you have created coupons and gift cards in a campaign, from the Coupons page of your campaign, you can [list][list], edit, export, and delete them. You can also import coupons directly from a CSV file.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

## Redeem a coupon {#redeem-a-coupon-code}

Use the [**coupon code is valid** condition](/docs/product/rules/conditions/available-conditions.md#coupon-conditions)
in your [rules](/docs/product/rules/overview.md) to redeem your coupons.

You can then add any required effects. For example, you can create a rule to issue a discount
on the session total when a customer uses a valid coupon in their order. Learn more
about it in the [coupon tutorial](/docs/product/tutorials/coupons/basic-coupon.md).

If you cancel a session where a coupon was redeemed, the coupon can be used again. Learn more
in our [Developer docs](/docs/dev/concepts/entities/customer-sessions.md#customer-session-states).

## Edit coupons

You can modify some characteristics of [a coupon](#edit-an-individual-coupon-code)
or [a batch of coupons](#edit-a-coupon-code-batch) after it has been created.
For example, you can add an expiration date.

:::note
For security reasons, you cannot edit the code itself.
:::

:::tip
You can edit coupons with a recipient integration ID directly in the **Coupons** tab
of the [customer's profile](/docs/product/applications/display-customer-profiles.md#coupons).
To edit a coupon, in the **Edit** column, click <Edit className="icon"/>.
:::

### Edit coupons individually {#edit-an-individual-coupon-code}

To edit coupons individually:

1. On the left-side menu of the campaign where the coupon was created,
   click <Coupons className="icon"/> **Coupons**.
1. Select the checkbox to the left of the coupon you want to edit.
1. At the top of the page,
   click <Menu className="icon"/> > <Edit className="icon"/> **Edit coupon**.
1. Edit the required information and click **Update Coupon** to save your changes.

### Edit a coupon batch {#edit-a-coupon-code-batch}

To edit a batch of coupons:

1. On the left-side menu of the campaign where the batch of coupons was created,
   click <Coupons className="icon"/> **Coupons**.
1. Select the checkbox to the left of the coupon whose batch you want to edit.
1. At the top of the page, click <Menu className="icon"/> > <Edit className="icon"/> **Edit batch**.
1. Edit the required information.
1. Click **Update Batch** and confirm your action in the pop-up that appears.

## Delete coupons

You can delete coupons from your campaign to free up space and reduce clutter.

You can delete coupons in one of the following ways:

- [Delete only expired coupons, only unredeemed coupons, or both](#delete-expired-and-unredeemed-coupons).
- [Delete coupons individually](#delete-individual-coupon-codes).
- [Delete a batch of coupons](#delete-a-coupon-batch).
- [Delete all coupons in a campaign](#delete-all-coupon-codes-in-a-campaign).

### Delete expired and unredeemed coupons

To delete expired and unredeemed coupons:

1. On the left-side menu of your campaign,
   click <Settings className="icon" /> **Settings** > **Delete**.
1. In the **Delete coupons** section, select the coupons you want to delete:

   - **All expired coupons**: Deletes expired coupons, regardless of their redemption.
     - (Optional) To only delete coupons that expired before a specific date, in
       **Expired before (optional)**, select a date.
   - **All unredeemed coupons**: Deletes coupons whose redemption is `0`, regardless of their validity.
   - **All expired coupons** and **All unredeemed coupons**:
     Deletes expired coupons whose redemption is `0`.

   :::tip
   You can check the validity and redemption of your coupons
   on the <Coupons className="icon" /> [**Coupons**][list] page.
   :::

1. Click <Delete className="icon" /> **Delete Coupons**.
1. In the confirmation window that appears, confirm your action
   and click <Delete className="icon" /> **Delete Coupons**.

### Delete coupons individually {#delete-individual-coupon-codes}

To delete coupons individually:

1. On the left-side menu of the campaign where the coupon was created,
   click <Coupons className="icon"/> **Coupons**.
1. Select the checkbox to the left of the coupon you want to delete.

   :::tip
   Select as many coupons as you want. To select all the coupons displayed on the
   page, at the top of the coupons list, select the checkbox next to **Code**.
   :::

1. At the top of the page, click <Menu className="icon"/> > <Delete className="icon"/> **Delete 1 Coupon**.
1. In the confirmation window that appears, click **Delete Selected Coupons**.

### Delete a coupon batch

To delete a batch of coupons:

1. On the left-side menu of the campaign where the batch of coupons was created,
   click <Coupons className="icon"/> **Coupons**.
1. Select the checkbox to the left of the coupon whose batch you want to delete.
1. At the top of the page, click <Menu className="icon"/> > <Delete className="icon"/> **Delete Batch**.
1. In the confirmation window that appears, confirm your action and click
   **Delete Coupon Batch**.

### Delete all coupons {#delete-all-coupon-codes-in-a-campaign}

To delete all coupons:

1. On the left-side menu of the campaign where you want to delete the coupons,
   click <Coupons className="icon"/> **Coupons**.
1. To the right of the <Add className="icon"/> **Create Coupons** button, click <Down className="icon" />.
1. Click <Cross className="icon" /> **Delete All Coupons**.
1. In the confirmation window that appears, click **Delete All Coupons**.

## Import coupons {#import-coupon-codes}

You can import coupons and gift cards from any other marketing tool into Talon.One.

To import coupons:

1. On the left-side menu of the campaign where you want to import your coupons,
   click <Coupons className="icon"/> **Coupons**.
1. To the right of the <Add className="icon"/> **Create Coupons** button, click <Down className="icon" />.
1. Click <Import className="icon"/> **Import Coupons**.
1. Click **Upload a CSV file** to select a CSV file with codes from your computer. Ensure
   the file does not contain any duplicate records.

   :::tip
- To see the required structure of the CSV file, click **Download a sample file**.
- To upload codes with custom attributes,
  see [Importing codes with custom attributes](#import-codes-with-custom-attributes).
:::

1. Click **Import Coupons**.

:::note
- If no limit is set for an imported coupon, the default is single use.
- For gift cards, in the `limitval` column, enter `0`.
  This way, a gift card can be used repeatedly until its entire value is spent.
:::

### Import coupons with custom attributes {#import-codes-with-custom-attributes}

:::important
Before you begin, we recommend you:
- Familiarize yourself with the
  JSON [syntax](https://www.w3schools.com/js/js_json_syntax.asp)
  and [data types](https://www.w3schools.com/js/js_json_datatypes.asp).
- Ensure you know each
  attribute's API name, type, and value.
- Ensure that [location attribute data](/docs/dev/tutorials/use-geolocation) is managed by a technical user.
:::

To import coupons with [custom attributes](/docs/product/account/dev-tools/manage-attributes):

1. In your CSV file, add a column called `attributes`.
1. Insert a **JSON object** listing the key-value pairs in the `attributes` column.

   The pattern is: `{"api_name_1": my_integer_value, "api_name_2": "my_string_value", ...}`.

   :::tip Troubleshooting

   If you use a text editor to edit your CSV file, you may encounter `Import Error: Read
   CSV error parse error on line 2` when you upload the file.
   To solve it, **duplicate all double-quotes**.

   The pattern is: `"{""api_name_1"": my_integer_value, ""api_name_2"": ""my_string_value"", ...}"`.
   :::

The format of the attribute value depends on the attribute type, as shown in the following table:

{

  <colgroup>
    <col span="1" style={{width:20+"%"}}/>
    <col span="1" style={{width:80+"%"}}/>
  </colgroup>
  
    
      Attribute type
      Attribute value format
    
  
  
    
      String
      <code>"value"</code>
    
    
      Number
      <code>1</code>
    
    
      Boolean
      <code>true</code> or <code>false</code>
    
    
      Time
      <code>"2022-03-15T00:00:00Z"</code>
    
    
      Location
      <code>"{'{'}\"name\":\"geofence_name\",\"format\":\"geojson-base64\",\"object\":\"geofence_data\"{'}'}"</code>
    
    
      List of strings
      <code>["value1", "value2", "value3"]</code>
    
    
      List of numbers
      <code>[1, 2, 3]</code>
    
    
      List of dates
      <code>["2022-02-15T00:00:00+02:00", "2022-10-15T00:00:00+02:00", "2022-03-16T00:00:00+02:00"]</code>
    
    
      List of locations
      <code>["{'{'}\"name\":\"geofence_name1\",\"format\":\"geojson-base64\",\"object\":\"geofence_data1\"{'}'}", "{'{'}\"name\":\"geofence_name2\",\"format\":\"geojson-base64\",\"object\":\"geofence_data2\"{'}'}", "{'{'}\"name\":\"geofence_name3\",\"format\":\"geojson-base64\",\"object\":\"geofence_data3\"{'}'}"]</code>
    
  

}

:::note Example
Imagine we want to import a coupon that has two custom attributes:
- A _string_ attribute called `type`.
- A _boolean_ attribute called `added_customer_benefits`.

The content of the `attributes` column in our CSV file must be:
`{"type": "special", "added_customer_benefits": true}`.
:::

## Export coupons {#export-coupon-codes}

You can obtain a CSV file with the coupons and gift cards from your campaign.

You can do this, for example, to import the coupons into another marketing tool, like a
mailing tool, or to share them in promotional literature, like magazines and newspapers.

To export coupons:

1. On the left-side menu of the campaign from which you want to export coupons,
   click <Coupons className="icon"/> **Coupons**.
1. To the right of the <Add className="icon"/> **Create Coupons** button, click <Down className="icon" />.
1. Click <Export className="icon"/> **Export Coupons**.
1. Use the tabs to choose which coupons you want to export:
   - To export all the coupons created after a date you select in **Created after**, click
     **After a Specific Date**.
   - To export all the coupons from the same batch you specify in **Batch ID**, click
     **Specific Batch**.
   - To export all the coupons created after one of your previous exports, click
     **After Recent Export**. You can choose the specific export by using the
     **Created after** dropdown menu. This option is available only if you have exported
     coupons.

   :::tip
   To filter your coupons in a different way, use your spreadsheet software.
   :::

1. In **Export scope**, choose whether you want to export all coupon data or only the
   coupon code values.
1. In **Date format**, select the date format of your choice.

   :::note
In the exported file, all timestamp values follow `UTC+00:00`.
:::

1. Click **Export Coupons**.

## Related pages

- [Create a gift card campaign](/docs/product/tutorials/coupons/giftcard.md)
- [Redeem a coupon code to issue a discount](/docs/product/tutorials/coupons/basic-coupon.md)
- [Use coupon wallets](/docs/dev/tutorials/use-coupon-wallets.md)
- [Create a coupons code effect](/docs/product/rules/effects/use-effects.md#create-a-coupon-code)

[list]: /docs/product/campaigns/coupons/coupon-page-overview.md#list-coupon-codes-and-gift-cards
