# Use effects

> It allows you to apply a discount to the total value of a customer session. For example, use it to offer a discount when customers reach a certain minimum amount or redeem a coupon.

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

## Use discount effects

### Discount session total

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Discount**, click **Discount session total**.
1. In **Discount name**, type a suitable name for your effect.
1. In **Discount value**, enter the value of the discount. This can be a number or a
   formula including attributes from the [Attribute Selector][attribute selector] such as the total value of the session.
1. (Optional) In **Advanced Settings** > **Allow lower discount value if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [setDiscount](/docs/dev/integration-api/api-effects.md#setdiscount) API effect.
:::

### Discount individual items

It allows you to apply a discount to certain items in the cart or to any
[additional costs](/docs/product/account/dev-tools/manage-additional-costs.md) applied to them.
For example, use it to run a promotion on some specific item categories or have part of your
catalog on sale.

With [cart item flattening](/docs/product/rules/cart-item-flattening.md),
identical products are viewed as single items in the cart.
This allows us to discount individual items rather than total quantities of a product.

Before using the effect, create a [cart item filter][cif], [value map](/docs/product/rules/manage-value-map.md),
or a [bundle definition](/docs/product/rules/create-and-manage-bundles.md) to specify which items
you want to apply the discount to. By default, the list includes all the items
in the customer's cart and any [Application cart item filters][app-cif] you created.

You can then discount individual items in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Discount**, click **Discount individual items**.
1. In **List of items**, select a list of cart items. The list can be a [bundle definition](/docs/product/rules/create-and-manage-bundles.md) or items from a [value map](/docs/product/rules/manage-value-map.md).

1. In **Discount name**, type a suitable name for your effect.
1. In **Discount value**, enter the value of the discount. This can be a number or a
   formula including attributes from the [Attribute Selector][attribute selector] such as the value of the item.
1. (Optional) In **Discount scope**, select where you want the discount effect to be applied:
   - **Price** (default): The price of the item without taking into account additional costs.
   - **Additional costs**: The total value of any additional costs applied to the item.
   - **Item total**: The price of the item together with any additional costs.
1. (Optional) In **Advanced Settings** > **Allow lower discount value if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [setDiscountPerItem](/docs/dev/integration-api/api-effects.md#setdiscountperitem) API effect.
:::

### Discount individual items pro rata

It allows you to apply a pro rata discount to certain items in the cart. The value of the discount
is divided among the eligible items in direct proportion to the price of each of them.

:::note Rounding error resolution
Prorated discounts are [rounded](/docs/product/rules/create-and-manage-rules#use-rounding-in-a-condition-or-effect)
to the nearest hundredth. If the sum of all rounded individual discounts does not equal
the total discount, the difference is subtracted or added to the values of the largest
individual discounts. For example, a €20 discount spread evenly across six items has a
deficit discount value of €0.02.
The deficit value will be added to two items.

Try [creating a pro rata discount campaign](/docs/product/tutorials/coupons/prorata-discount)
for better understanding.
:::

With [cart item flattening](/docs/product/rules/cart-item-flattening.md),
identical products are viewed as single items in the cart and are discounted
individually.

Before using the effect, create a [cart item filter][cif], [value map](/docs/product/rules/manage-value-map.md),
or a [bundle definition](/docs/product/rules/create-and-manage-bundles.md) to specify which items
you want to apply the discount to. By default, the list includes all the items
in the customer's cart and any [Application cart item filters][app-cif] you've created.

You can then discount individual items in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Discount**, click **Discount individual items pro rata**.
1. In **List of items**, select a list of cart items.
1. In **Discount name**, type a suitable name for your effect.
1. In **Discount value**, enter the value of the discount. This can be a number or a
   formula including attributes from the [Attribute Selector][attribute selector] such as the value of the item.
1. (Optional) In **Advanced Settings** > **Allow lower discount value if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [setDiscountPerItem](/docs/dev/integration-api/api-effects.md#setdiscountperitem) API effect.
:::

### Discount bundles pro rata

It allows you to apply a pro rata discount to the items in one or more [item bundles](/docs/product/rules/create-and-manage-bundles.md).
The discount value is applied to each of the bundles formed from the same bundle definition
and is divided among the items in those bundles in direct proportion to their individual prices.

:::note Rounding error resolution
Prorated discounts are [rounded](/docs/product/rules/create-and-manage-rules#use-rounding-in-a-condition-or-effect)
to the nearest hundredth. If the sum of all rounded individual discounts does not equal
the total discount, the difference is subtracted or added to the values of the largest
individual discounts. For example, a €20 discount spread evenly across six items has a
deficit discount value of €0.02.
The deficit value will be added to two items.

Try [creating a pro rata discount campaign](/docs/product/tutorials/coupons/prorata-discount)
for better understanding.
:::

Before using the effect, [create a bundle definition](/docs/product/rules/create-and-manage-bundles.md)
to specify which items you want to apply the discount to.

You can then create the rule to discount the items in the bundles created from that bundle
definition:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Discount**, click **Discount bundles pro rata**.
1. In **Bundle definition**, select a [bundle definition](/docs/product/rules/create-and-manage-bundles.md)
   that you have created.
1. In **Discount name**, type a suitable name for your effect.
1. In **Discount value for each bundle**, enter the value of the discount. This can be a number
   or a formula including attributes from the [Attribute Selector][attribute selector] such as the value of the item.
1. (Optional) In **Advanced Settings** > **Allow lower discount value if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [setDiscountPerItem](/docs/dev/integration-api/api-effects.md#setdiscountperitem) API effect.
:::

### Discount individual item in bundles

:::note
Previously named _Discount individual item in bundles pro rata_.
:::

It allows you to discount a specific item in one or more [item bundles](/docs/product/rules/create-and-manage-bundles.md).

You can choose whether to apply the discount directly to an item in the bundle,
or apply it pro rata. A prorated discount value is determined by the individual item,
but is distributed across all items in the bundle in proportion
to their individual price.

The discount value is applied to each of the bundles formed from the same bundle definition.

:::note Rounding error resolution
Prorated discounts are [rounded](/docs/product/rules/create-and-manage-rules#use-rounding-in-a-condition-or-effect)
to the nearest hundredth. If the sum of all rounded individual discounts does not equal
the total discount, the difference is subtracted or added to the values of the largest
individual discounts. For example, a €20 discount spread evenly across six items has a
deficit discount value of €0.02.
The deficit value will be added to two items.

Try [creating a pro rata discount campaign](/docs/product/tutorials/coupons/prorata-discount)
for better understanding.
:::

Before using the effect, create a [cart item filter][cif]
and a [bundle definition](/docs/product/rules/create-and-manage-bundles.md).

You can then create the rule to discount a specific item in the bundles created from the
bundle definition:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Discount**, click **Discount individual item in bundles**.
1. Select whether you want the discount to be **Pro rata** or **Non-pro rata**.
1. In **Bundle definition**, select a [bundle definition](/docs/product/rules/create-and-manage-bundles.md)
   that you have created.
1. In **Discounted cart item in bundle**, select the cart item you want to discount:
   - **Cheapest item**: Selects the least expensive item in the bundle.
   - **Most expensive item**: Selects the most expensive item in the bundle.
   - **Select an item**: Allows you to choose an item from a dropdown.

   :::note
   If two or more items qualify as the cheapest or most expensive item, the
   item that is listed first in the bundle definition is discounted.
   :::

1. In **Discount name**, type a suitable name for your effect.
1. In **Discount value**, enter the value of the discount for each bundle. It can be a
   number or a formula, including attributes from the [Attribute Selector][attribute selector], such as the
   value of the item.
1. (Optional) In **Advanced Settings** > **Allow lower discount value if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [setDiscountPerItem](/docs/dev/integration-api/api-effects.md#setdiscountperitem) API effect.
:::

### Discount additional costs

It allows you to discount additional costs applied to the entire customer session. Additional
costs are extra costs such as shipping costs or other additional fees that you want to charge
to customers.

With [cart item flattening](/docs/product/rules/cart-item-flattening.md),
identical products are viewed as single items in the cart and are discounted
individually.

Before using the effect, [create one or more additional costs per cart (session)](/docs/product/account/dev-tools/manage-additional-costs.md).

You can then discount an additional cost in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Discount**, click **Discount additional cost**.
1. In **Select additional cost**, choose the cost you want to discount.
1. In **Discount name**, type a suitable name for your effect.
1. In **Discount value**, enter the value of the discount. This can be a number or a
   formula including attributes from the [Attribute Selector][attribute selector] such as the value of the additional
   cost.
1. (Optional) In **Advanced Settings** > **Allow lower discount value if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [setDiscountPerAdditionalCost](/docs/dev/integration-api/api-effects.md#setdiscountperadditionalcost) API effect.
:::

### Discount additional costs per item

It allows you to discount additional costs applied to individual cart items. Additional costs
are extra costs such as shipping costs or other additional fees that you want to charge to
customers.

Before using the effect, [create one or more additional costs per item](/docs/product/account/dev-tools/manage-additional-costs.md).

You can also create a [cart item filter][cif]
to define which items you want to apply the discount to. Otherwise, the only list available
includes all the items in the cart and any [Application cart item filters][app-cif] you created.

You can then discount an additional cost in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Discount**, click **Discount additional cost per item**.
1. In **Select additional cost**, choose the cost you want to discount.
1. In **Pick a list of items**, select a list.
1. In **Discount name**, type a suitable name for your effect.
1. In **Discount value**, enter the value of the discount. This can be a number or a
   formula including attributes from the [Attribute Selector][attribute selector]
   such as the value of the additional cost.
1. (Optional) In **Advanced Settings** > **Allow lower discount value if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [setDiscountPerAdditionalCostPerItem](/docs/dev/integration-api/api-effects.md#setdiscountperadditionalcostperitem) API effect.
:::

## Use incentives effects

### Add a free item

It allows you to add a free item to the customer's session, for example, if customers
purchase a certain number of items and get one item free.

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Incentives**, click **Add a free item**.
1. In **SKU**, enter the SKU of the item you want your customer to receive.
1. In **Discount name**, type a suitable name for your effect.
1. In **Quantity**, enter the number of free items. This can be a number or a formula
   including attributes from the [Attribute Selector][attribute selector].
1. (Optional) In **Advanced Settings** > **Allow fewer free items if budget is insufficient**,
   select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note API effect
This effect returns the [addFreeItem](/docs/dev/integration-api/api-effects.md#addfreeitem) API effect.
:::

### Add loyalty points

This effect allows you to reward your customers with points that they can use in future
purchases. Points are added for the session total.

Before using the effect, ensure you have completed the following steps:

- [Enabled the loyalty feature](/docs/product/campaigns/settings/manage-campaign-features.md)
  in your campaign.
- [Created a profile-based loyalty program](/docs/product/loyalty-programs/profile-based/create-pb-programs.md).

You can then add loyalty points in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Incentives**, click **Add Loyalty points**.
1. In **Loyalty program**, select the loyalty program.
1. If you have [enabled subledgers](/docs/product/loyalty-programs/use-subledgers.md) for the loyalty program, you can enter the name of a subledger in the **Subledger** field where you want to add points.

   If the name you enter does not exist yet, a new subledger is automatically created.

1. In **Recipient**, select where the points are added:

   - For profile-based loyalty programs, your **current customer** is the default recipient.
     [If the **Referrals** feature is active](/docs/product/campaigns/settings/manage-campaign-features.md)
     in your campaign, you can choose:
     - **Current Customer (Friend)**
     - **Advocate**
   - For card-based loyalty programs, the default recipient is **Loyalty card**.

1. In **Reason**, type a description for this effect.
1. In **Amount of points**, set the value of the reward.
1. (Optional) Click **Points settings** to set start and expiry dates for the points.
   :::note
   - All timestamps are in the loyalty program time zone.
   - After there are point transactions in the loyalty program, changes to these
     settings only apply to new transactions. Existing transaction data remains
     unchanged.
   :::
   - In **Start date**, select when the points become active:
     - **(Duration)**: Points become active a specified duration after session
       closure. This option is only displayed if the loyalty program's
       [Points](/docs/product/loyalty-programs/manage-loyalty-programs.md#points) settings
       specify a start date relative to the session closure. For example, if the
       start date is set to 3 months after session closure, the Rule Builder displays
       **3 months**.
     - **Immediate**: Points become active when the session closes.
     - **Action-based**: Points become active when a defined action occurs in your system.
Developers can configure which action triggers points activation, such as the completion
of a taxi ride or the delivery of an item in an order. After the session closes, all
earned points remain pending until the defined action occurs.

To activate points when an action occurs, developers can use the
[Activate loyalty points](/integration-api#tag/Loyalty) endpoint.
This endpoint enables your system to activate all points earned in a single session or
the points earned in specific transactions of a session.

When points are activated, the `startDate` of each point transaction is set to the
time the action occurs.
     - **Time-based**: Points become active at a predefined time:
         - **Specific date**: Select a fixed start date and time.
         - **Relative date**: Select a start date and time relative to a baseline attribute.
            {
<details>
  <summary>Examples: Points activation relative to baseline</summary>
    
      For all the examples mentioned in this table, let's assume the baseline attribute
      is set to <code>12 October 2024, 07:20:50</code>.
    
    
      
      <colgroup>
	      <col span="2" style={{width:50+"%"}}/>
	    </colgroup>
      
        
          Time after baseline
          Points become active on
        
      
      
        
          
            <code>1</code> days, Same time as baseline
          
          
            <code>13 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> days, Start of day (00:00:00)
          
          
             <code>13 October 2024, 00:00:00</code>
          
        
        
          
            <code>1</code> days, End of day (23:59:59)
          
          
            <code>13 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> weeks, Same day as baseline
          
          
           <code>19 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> weeks, End of week (Sunday 23:59:59)
          
          
           <code>20 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> months, Same date as baseline
          
          
            <code>12 November 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> months, End of month (23:59:59)
          
          
            <code>30 November 2024, 23:59:59</code>
          
        
      
      
    
</details>
}
         - **Attribute value**: Select a time attribute as the start date. When the effect
           is triggered, the value of the attribute defines the start date for the
           added points.

   - In **Expiry date**, select when the points expire:
     - **(Duration)**: Points expire a specified duration after the start date. This option
       is only displayed if the loyalty program's
       [Points](/docs/product/loyalty-programs/manage-loyalty-programs.md#points) settings
       specify an expiry date relative to the start date. For example, if the expiry
       date is set to 3 months after the start date, the Rule Builder displays
       **3 months**.
     - **Unlimited**: Points do not have an expiry date.
     - **Time-based**: Points expire at a predefined time:
         - **Specific date**: Select a fixed expiry date and time.
         - **Relative date**: Select an expiry date and time relative to a baseline attribute.
            {
<details>
  <summary>Examples: Points expiry relative to baseline</summary>
    
      For all the examples mentioned in this table, let's assume that the points
       became active on <code>12 October 2024, 07:20:50</code>
      Note: If the start is action-based, the Rule Engine sets the baseline to the
        reward start date and calculates the expiry date accordingly.
      
    
    
      
      <colgroup>
	      <col span="2" style={{width:50+"%"}}/>
	    </colgroup>
      
        
          Time after baseline
          Points expire on
        
      
      
        
          
            <code>1</code> days, Same time as baseline
          
          
            <code>13 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> days, Start of day (00:00:00)
          
          
             <code>13 October 2024, 00:00:00</code>
          
        
        
          
            <code>1</code> days, End of day (23:59:59)
          
          
            <code>13 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> weeks, Same day as baseline
          
          
           <code>19 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> weeks, End of week (Sunday 23:59:59)
          
          
           <code>20 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> months, Same date as baseline
          
          
            <code>12 November 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> months, End of month (23:59:59)
          
          
            <code>30 November 2024, 23:59:59</code>
          
        
      
      
    
</details>
}
         - **Attribute value**: Select a time attribute as the expiry date. When the effect
           is triggered, the value of the attribute defines the expiry date of the points.
1. (Optional) In **Allow fewer points if budget is insufficient**, select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note
Awarded points are displayed in the
[loyalty dashboard](/docs/product/loyalty-programs/profile-based/profile-based-overview.md#points-overview).
:::

:::note API effect
- This effect returns the [addLoyaltyPoints](/docs/dev/integration-api/api-effects.md#addloyaltypoints) API effect.

- When this effect results in the upgrade of a customer's tier, it also
returns the [changeLoyaltyTierLevel](/docs/dev/integration-api/api-effects.md#changeloyaltytierlevel) API effect.
:::

### Add loyalty points per cart item

It allows you to reward your customers with points that they can later exchange for
different items or use in future purchases. Points are added for individual cart items.

:::note important
The awarded loyalty points are revoked if the item that triggered the effect is returned.
:::

Before using the effect, ensure you have completed the following steps:

- [Enabled the loyalty feature](/docs/product/campaigns/settings/manage-campaign-features.md)
  in your campaign.
- [Created a profile-based loyalty program](/docs/product/loyalty-programs/profile-based/create-pb-programs.md).

You can create a [cart item filter][cif]
to define which items you want to give loyalty points for. Otherwise, the only list available
includes all the items in the cart and any [Application cart item filters][app-cif] you created.

You can then add loyalty points in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Incentives**, click **Add loyalty points per item**.
1. In **Cart items filter**, select a list of cart items. The list can be a [bundle definition](/docs/product/rules/create-and-manage-bundles.md).
1. In **Loyalty program**, select the loyalty program.
1. If you have [enabled subledgers](/docs/product/loyalty-programs/use-subledgers.md) for the loyalty program, you can enter the name of a subledger in the **Subledger** field where you want to add points.

   If the name you enter does not exist yet, a new subledger is automatically created.

1. In **Recipient**, select where the points are added:

   - For profile-based loyalty programs, your **current customer** is the default recipient.
     [If the **Referrals** feature is active](/docs/product/campaigns/settings/manage-campaign-features.md)
     in your campaign, you can choose:
     - **Current Customer (Friend)**
     - **Advocate**
   - For card-based loyalty programs, the default recipient is **Loyalty card**.

1. In **Reason**, type a description for this effect.
1. In **Amount of points**, set the value of the reward.
1. (Optional) Click **Points settings** to set start and expiry dates for the points:
   :::note
   - All timestamps are in the loyalty program time zone.
   - After there are point transactions in the loyalty program, changes to these
     settings only apply to new transactions. Existing transaction data remains
     unchanged.
   :::
   - In **Start date**, select when the points become active:
     - **(Duration)**: Points become active a specified duration after session
       closure. This option is only displayed if the loyalty program's
       [Points](/docs/product/loyalty-programs/manage-loyalty-programs.md#points) settings
       specify a start date relative to the session closure. For example, if the
       start date is set to 3 months after session closure, the Rule Builder displays
       **3 months**.
     - **Immediate**: Points become active at session closure.
     - **Action-based**: Points become active when a defined action occurs in your system.
Developers can configure which action triggers points activation, such as the completion
of a taxi ride or the delivery of an item in an order. After the session closes, all
earned points remain pending until the defined action occurs.

To activate points when an action occurs, developers can use the
[Activate loyalty points](/integration-api#tag/Loyalty) endpoint.
This endpoint enables your system to activate all points earned in a single session or
the points earned in specific transactions of a session.

When points are activated, the `startDate` of each point transaction is set to the
time the action occurs.
     - **Time-based**: Points activate at a predefined time:
         - **Specific date**: Select a fixed start date and time.
         - **Relative date**: Select a start date and time relative to a baseline attribute.
            {
<details>
  <summary>Examples: Points activation relative to baseline</summary>
    
      For all the examples mentioned in this table, let's assume the baseline attribute
      is set to <code>12 October 2024, 07:20:50</code>.
    
    
      
      <colgroup>
	      <col span="2" style={{width:50+"%"}}/>
	    </colgroup>
      
        
          Time after baseline
          Points become active on
        
      
      
        
          
            <code>1</code> days, Same time as baseline
          
          
            <code>13 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> days, Start of day (00:00:00)
          
          
             <code>13 October 2024, 00:00:00</code>
          
        
        
          
            <code>1</code> days, End of day (23:59:59)
          
          
            <code>13 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> weeks, Same day as baseline
          
          
           <code>19 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> weeks, End of week (Sunday 23:59:59)
          
          
           <code>20 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> months, Same date as baseline
          
          
            <code>12 November 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> months, End of month (23:59:59)
          
          
            <code>30 November 2024, 23:59:59</code>
          
        
      
      
    
</details>
}
         - **Attribute value**: Select a time attribute as the start date.

   - In **Expiry date**, select when the points expire:
     - **(Duration)**: Points expire a specified duration after the start date. This
       option is only displayed if the loyalty program's
       [Points](/docs/product/loyalty-programs/manage-loyalty-programs.md#points) settings
       specify an expiry date relative to the start date. For example, if the expiry
       date is set to 3 months after the start date, the Rule Builder displays
       **3 months**.
     - **Unlimited**: Points do not have an expiry date.
     - **Time-based**: Points expire at a predefined time:
         - **Specific date**: Select a fixed expiry date and time.
         - **Relative date**: Select an expiry date and time relative to a baseline attribute.
            {
<details>
  <summary>Examples: Points expiry relative to baseline</summary>
    
      For all the examples mentioned in this table, let's assume that the points
       became active on <code>12 October 2024, 07:20:50</code>
      Note: If the start is action-based, the Rule Engine sets the baseline to the
        reward start date and calculates the expiry date accordingly.
      
    
    
      
      <colgroup>
	      <col span="2" style={{width:50+"%"}}/>
	    </colgroup>
      
        
          Time after baseline
          Points expire on
        
      
      
        
          
            <code>1</code> days, Same time as baseline
          
          
            <code>13 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> days, Start of day (00:00:00)
          
          
             <code>13 October 2024, 00:00:00</code>
          
        
        
          
            <code>1</code> days, End of day (23:59:59)
          
          
            <code>13 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> weeks, Same day as baseline
          
          
           <code>19 October 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> weeks, End of week (Sunday 23:59:59)
          
          
           <code>20 October 2024, 23:59:59</code>
          
        
        
          
            <code>1</code> months, Same date as baseline
          
          
            <code>12 November 2024, 07:20:50</code>
          
        
        
          
            <code>1</code> months, End of month (23:59:59)
          
          
            <code>30 November 2024, 23:59:59</code>
          
        
      
      
    
</details>
}
         - **Attribute value**: Select a time attribute as the expiry date. When the effect
           is triggered, the value of the attribute defines the expiry date of the points.

1. (Optional) In **Allow fewer points if budget is insufficient**, select:
   - [Application Default Settings](/docs/product/applications/manage-general-settings.md#partial-discounts-and-rewards)
   - Yes
   - No
1. Click **Done**.

:::note
Awarded points are displayed in the [loyalty dashboard](/docs/product/loyalty-programs/profile-based/profile-based-overview.md#points-overview).
:::

:::note API effect
- This effect returns the [addLoyaltyPoints](/docs/dev/integration-api/api-effects.md#addloyaltypoints) API effect.

- When this effect results in the upgrade of a customer's tier, it also
returns the [changeLoyaltyTierLevel](/docs/dev/integration-api/api-effects.md#changeloyaltytierlevel) API effect.
:::

### Redeem loyalty points

It allows your customers to use their loyalty points in different ways, such as direct
discounts.

Before using the effect, ensure you have completed the following steps:

- [Enabled the loyalty feature](/docs/product/campaigns/settings/manage-campaign-features.md)
  in your campaign.
- [Created a profile-based loyalty program](/docs/product/loyalty-programs/profile-based/create-pb-programs.md).

You can then deduct loyalty points in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/>**Add Effect**.
1. In **Incentives**, click **Redeem Loyalty points**.
1. In **Loyalty program**, select the loyalty program from which you want to redeem points.
1. If you have [enabled subledgers](/docs/product/loyalty-programs/use-subledgers.md) for the loyalty program, you can enter the name of a subledger in the **Subledger** field from where you want to redeem points.

   If the name you enter does not exist yet, a new subledger is automatically created.

1. In **Reason**, type a description for this effect.
1. In **Amount of points**, set the number of points to redeem.
1. Click **Done**.

:::note API effect
This effect returns the [deductLoyaltyPoints](/docs/dev/integration-api/api-effects.md#deductloyaltypoints) API effect.
:::

### Extend loyalty points expiry date

If loyalty points have an expiry date, this effect extends the expiry of all active and pending point transactions by a selected duration.

Before using the effect, ensure you have [enabled the loyalty feature](/docs/product/campaigns/settings/manage-campaign-features.md) in your campaign.

To extend the expiry date of every active and pending point transaction in a rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/>**Add Effect**.
1. In **Incentives**, click **Extend loyalty points expiry date**.
1. In **Loyalty program**, select the loyalty program.
1. If you have [enabled subledgers](/docs/product/loyalty-programs/use-subledgers.md) for the loyalty program, you can enter the name of a subledger in the **Subledger** field. This extends the points expiry date for all active and pending point transactions in that subledger that have an expiry date.

   If the name you enter does not exist yet, a new subledger is automatically created.

1. In **Extend point expiration by**, select a duration by which to extend the expiry date of every active and pending point transaction.
1. Click **Done**.

:::note
- This effect only extends the expiry date for existing point transactions that have not expired yet. It does not apply to points earned in the current session.
- [Reopening](/integration-api#tag/Customer-sessions/operation/reopenCustomerSession) or [canceling](/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) a session does not roll back the updated expiry date for active, pending, and unlimited point transactions.
:::

### Update loyalty points expiry date

This effect updates the expiry date of all active, pending, and unlimited point transactions to a specific date.

Before using the effect, ensure you have [enabled the loyalty feature](/docs/product/campaigns/settings/manage-campaign-features.md) in your campaign.

To update the expiry date of point transactions in a rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/>**Add Effect**.
1. In **Incentives**, click **Update loyalty points expiry date**.
1. In **Loyalty program**, select the loyalty program.
1. If you have [enabled subledgers](/docs/product/loyalty-programs/use-subledgers.md) for the loyalty program, you can enter the name of a subledger in the **Subledger** field. This updates the points expiry date for all active, pending, and unlimited point transactions in that subledger that have an expiry date.

   If the name you enter does not exist yet, a new subledger is automatically created.

1. To set a new expiry date for all active, pending, and unlimited point transactions, select one of the following options:
   - **Update expiry relative to attribute value**: Set a new expiry date by adding a selected duration to an attribute of type `Time`.
   - **Update expiry to specific date**: Select a new expiry date and time for the point transactions.
1. Click **Done**.

:::note
- This effect only updates the expiry date for existing point transactions that have not expired yet. It does not apply to points earned in the current session.
- [Reopening](/integration-api#tag/Customer-sessions/operation/reopenCustomerSession) or [canceling](/integration-api#tag/Customer-sessions/operation/updateCustomerSessionV2) a session does not roll back the updated expiry date for active, pending, and unlimited point transactions.
:::

### Award a giveaway

It allows you to offer direct rewards to your customers. For example, you can grant them
vouchers generated outside of Talon.One, such as Amazon gift cards.

Before using the effect, ensure you have completed the following steps:

1. [Created a giveaway pool](/docs/product/giveaways/create-giveaways.md) and connected it to
   the Application containing your campaign.
1. [Imported codes](/docs/product/giveaways/manage-giveaways.md#import-giveaway-codes) into
   the pool.
1. [Enabled the giveaway feature](/docs/product/campaigns/settings/manage-campaign-features.md)
   in your campaign.

You can then award a giveaway in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Incentives**, click **Award giveaway**.
1. In **Giveaway pool**, select the giveaway pool.
1. In **Recipient**, select who will receive the giveaway. Your **current customer** is
   the default option. [If the **Referrals** feature is
   active](/docs/product/campaigns/settings/manage-campaign-features) in your campaign, you can choose:

   - **Current customer (friend)**
   - **Advocate**

   :::note
   To give a reward to both of them, create a second **Award giveaway** effect.
   :::

1. Click **Done**.

:::note API effect
This effect returns the [awardGiveaway](/docs/dev/integration-api/api-effects.md#awardgiveaway) API effect.
:::

## Use creation effects

### Create a notification

It enables you to trigger a message that is intended to be displayed to the customer. It can
be a rule effect or a [failure effect](/docs/product/rules/effects/overview.md).

For example, use this effect to inform a customer about a special discount when they are
close to reaching the minimum amount necessary to obtain it or to debug a rule during the
testing phase.

To create a notification as a rule effect:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Create**, click **Create Notification**.
1. In **Type**, select the kind of notification you want to display.
1. In **Title**, type a name for the notification.
1. In **Message**, type what your customer will read. You can include attributes from the
   [Attribute Selector][attribute selector] such as coupons in the message.
1. Click **Done**.

:::tip
To learn how to create a notification as a failure effect, read [Add a failure effect to a condition](/docs/product/rules/conditions/use-conditions.md#add-a-failure-effect-to-a-condition).
:::

:::note API effect
This effect returns the [showNotification](/docs/dev/integration-api/api-effects.md#shownotification) API effect.
:::

### Create a referral code

It allows you to grant your customers [referral codes](/docs/product/campaigns/referrals/referral-overview.md)
that they can give to their friends so that they too become customers.

The code is stored in the session and you can use it in another effect, such as [**Create notification**](#create-a-notification),
by selecting the <Attribute name="Generated Referral in Session" type="builtin" /> attribute
in the [Attribute Selector][attribute selector].

Before using the effect, ensure you have [enabled the referrals feature](/docs/product/campaigns/settings/manage-campaign-features.md)
in your campaign. You can then create a referral code in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Create**, click **Create referral code**.
1. From the **Campaign** dropdown, choose where you want to create a referral code:
   - **In the current campaign**.
   - **Select a campaign from a list**. For this option, select a campaign in the
     drop-down menu.
   - **Determine the campaign ID based on an attribute**. For this option, select a custom
     attribute of type `Number` in the Attribute Selector.
1. In **Redemption limit**, set how many times the code can be used. From the dropdown,
   select from the following:
     - **Unlimited**: Allow unlimited redemptions.
     - **Set a limit**: Define a specific limit.
1. In **Code pattern**, define the characteristics of the referral code:
   - **Use campaign settings code pattern**.
   - **Use custom code pattern** allows you to define a specific code length, the
     characters appearing in the code, and a prefix and a suffix.
1. (Optional) In **Set start time and end time**, define start and expiration dates for your
   coupons.

   :::note
   To specify a relative time, click <Clock className="icon" /> **Select a relative date**.
   For **days after the session**,
   - **start of the day** represents `00:00:00 hours` in the Application time zone.
   - **end of the day** represents `23:59:59 hours` in the Application time zone.
   :::
1. (Optional) In **Referral attributes**, define the value for [any available referral
   attributes](/docs/product/account/dev-tools/manage-attributes).
1. Click **Done**.

:::note API effect
This effect returns the [referralCreated](/docs/dev/integration-api/api-effects.md#referralcreated) API effect.
:::

### Create a coupon code

It allows you to generate a coupon code or a gift card. The code can be generated for the campaign
of your choice in the current Application, as long as they have the **coupons** feature
enabled.

The code is stored in the session and you can use it in another effect, such as [**Create notification**](#create-a-notification),
by selecting the <Attribute name="Generated Coupon in Session" type="builtin" /> attribute
in the [Attribute Selector][attribute selector].

Before using the effect, ensure you have [enabled the coupons feature](/docs/product/campaigns/settings/manage-campaign-features.md)
in your campaign. You can then create a coupon code in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Create**, click **Create coupon code**.
1. From the **Campaign** dropdown, choose where you want to create a coupon code:
   - **In the current campaign**.
   - **Select a campaign from a list**. For this option, select a campaign in the
     drop-down menu.
   - **Determine the campaign ID based on an attribute**. For this option, select a custom
     attribute of type `Number` in the Attribute Selector.
1. Set the details of your coupon code:
   - **Recipient**: The customer that should receive the code.
   - **Redemption limit**: How many times the code can be used. From the dropdown, select
     from the following:
     - **Unlimited**: Allow unlimited redemptions.
     - **Set a limit**: Define a specific limit.
   - **Discount limit**: The maximum total discount given by the coupon. From the
     dropdown, select from the following:
     - **Campaign default settings (Use coupon budget limit)**: Apply an existing
       [coupon budget](/docs/product/campaigns/settings/manage-campaign-budgets#budget-types)
       limit. This option is only visible if your
       campaign contains a coupon budget with a
       [discount total budget limit](/docs/product/campaigns/settings/manage-campaign-budgets.md#discount-limits).
       Otherwise, the option is **Campaign default settings (Unlimited)** and the limit
       is set to **Unlimited**.
     - **Unlimited**: Do not set a maximum total discount for the coupon.
     - **Set a limit**: Define a specific limit.
   - **Code pattern**: The specific code length, the characters appearing in the code,
     and any prefix and suffix.
   - **Set start time and end time**: Start and expiration dates.

   :::note
   To specify a relative time, click <Clock className="icon" /> **Select a relative date**.
   For **days after the session**,
   - **start of the day** represents `00:00:00 hours` in the Application time zone.
   - **end of the day** represents `23:59:59 hours` in the Application time zone.
   :::
   - **Coupon attributes**: The value for [any available coupon
     attributes](/docs/product/account/dev-tools/manage-attributes).
1. Click **Done**.

:::note API effect
This effect returns the [couponCreated](/docs/dev/integration-api/api-effects.md#couponcreated) API effect.
:::

### Reserve a coupon code

The **Create coupon code reservation** effect allows you to reserve the coupon codes of
the current session for the [customer profile](/docs/product/applications/display-customer-profiles.md)
of the session. This is useful, for example, to make a coupon redeemable only by a particular group of customers.
For a sample scenario, see our [Braze tutorial](/docs/dev/technology-partners/braze/use-universal-coupons-reservations-braze.md).

Talon.One provides **soft** and **hard** reservations. The type of reservation depends on
the coupon code's properties:

- If the **Reservation mandatory** option was selected when the coupon code was created,
the effect creates a **hard** reservation, meaning only users who have this coupon code reserved can redeem it.
- Otherwise, the effect creates a **soft** reservation, meaning the coupon will be associated with the customer profile (it shows up when using the [List customer data](/integration-api#tag/Customer-profiles/operation/getCustomerInventory) endpoint), but any user can redeem it. This can be useful, for example, to display a _coupon wallet_ for customers when they visit your store.

:::note
- You cannot use the **Coupon code is valid** or **Coupon code is valid (without redemption)**
  conditions in the same rule as the **Create coupon code reservation** effect.
- Contrary to most effects, this effect is applied when the [session state](/docs/dev/concepts/entities/customer-sessions.md#customer-session-states) is either `open` or `closed`.
- You can also reserve coupon codes using the [Create coupon reservation](/integration-api#tag/Coupons/operation/createCouponReservation)
  endpoint of the Integration API.
:::

Before using the effect, ensure you have completed the following steps:

1. [Enabled the coupons feature](/docs/product/campaigns/settings/manage-campaign-features.md)
   in your campaign.
1. Created at least one coupon code.

To create a coupon reservation in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Create**, click **Create coupon code reservation**.

:::note API effect
This effect returns the [reserveCoupon](/docs/dev/integration-api/api-effects.md#reservecoupon) API effect.
:::

## Use update effects

### Update an attribute value

It allows you to set a new value for a custom attribute.

Before using the effect, ensure you have defined [one or more custom attributes](/docs/product/account/dev-tools/manage-attributes.md).

You can then update them in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Update**, click **Update attribute value**.
1. In **Set attribute**, select a custom attribute from the [Attribute Selector][attribute selector].
1. In **To new value**, type a value or select an attribute from the Attribute Selector to define
   yours.
1. Click **Done**.

:::note API effect
This effect returns the [updateAttribute](/docs/dev/integration-api/api-effects.md#updateattribute) API effect.
:::

### Update a cart item attribute value

It allows you to set a new value for a custom attribute affecting only certain items in
the customer's cart. Use the [Integration API](/docs/dev/integration-api/overview.md) to set a
cart item custom attribute.

Before using the effect, ensure you have completed the following steps:

- Defined [one or more custom attributes](/docs/product/account/dev-tools/manage-attributes.md).
- Created a [cart item filter][cif] to
  define the items whose attribute value you want to update. Otherwise, the only list
  available includes all the items in the customer's cart and
  any [Application cart item filters][app-cif] you created.

You can then update them in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Update**, click **Update cart item attribute value**.
1. In **Pick a list of items**, select a list.
1. In **Set attribute**, select a custom attribute from the [Attribute Selector][attribute selector].
1. In **To new value**, type a value or select an attribute from the Attribute Selector to define
   yours.
1. Click **Done**.

:::note API effect
This effect returns the [updateAttribute](/docs/dev/integration-api/api-effects.md#updateattribute) API effect.
:::

### Update an audience

It allows you to add a customer to or remove them from an [audience](/docs/product/audiences/overview.md).
For example, you can add the customer of the current customer session to a _Recurring customers_
audience and give them a 20% discount in the same campaign.

:::note
- All the effects of a rule are applied before evaluating the next rule. To ensure the
  **Update audience** effect is applied before a discount is given, for example,
  [ensure the rule](/docs/product/applications/evaluation-order-for-rules-and-filters.md#evaluate-rules) that contains this
  effect is on top.

- This effect does not trigger the
  [**Has joined an audience** or **Has left an audience**](/docs/product/rules/conditions/available-conditions.md#audience-conditions)
  conditions in rules placed later in the [campaign evaluation](/docs/product/applications/evaluation-order-for-rules-and-filters.md#evaluate-rules) flow.
:::

Before using the effect, ensure you have [created an audience](/docs/product/audiences/overview.md#create-an-audience)
whose [environment](/docs/product/audiences/overview.md#audience-environments) matches the
environment of the Application you want to use it in.

You can then update an audience in your rule:

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Update**, click **Update audience**.
1. Choose whether you want to:
   - **Add a customer to an audience**.
   - **Remove a customer from an audience**.
1. From the **Audience** dropdown, select the audience you want to update.
1. From the **Integration ID** dropdown, choose the customer that should be added to
   or removed from the audience.
1. Click **Done**.

:::note API effect
This effect returns the following API effects:
- [addToAudience](/docs/dev/integration-api/api-effects.md#addtoaudience) when you
  add a customer to an audience.
- [removeFromAudience](/docs/dev/integration-api/api-effects.md#removefromaudience)
  when you remove a customer from an audience.
:::

## Use achievement effects

### Update customer progress

It allows you to update the progress of the customer in a particular achievement. Before
you start, ensure you have [created an achievement](/docs/product/achievements/create-achievements.md)
in your campaign.

1. Open the <RuleBuilder className="icon"/> **Rule Builder** for your campaign.
1. Click <Add className="icon"/> **Create Rule**.
1. In **Effects**, click <Add className="icon"/> **Add Effect**.
1. In **Achievements**, click **Update customer progress**.
1. In **Achievement name**, select or enter the name of the achievement in which you
   want to update the customer's progress.
1. In **Update progress by**, set the value by which you want the customer's progress
   in the achievement to increase.
1. Click **Done**.

:::note API effect
This effect returns the [increaseAchievementProgress](/docs/dev/integration-api/api-effects.md#increaseachievementprogress) API effect.
:::

## Use webhooks

Use webhooks to send information from Talon.One to external tools that use
APIs. For example, you can create a webhook that triggers an email to a customer
when their friend redeems a referral code. You can also define your own webhooks
and use them as effects.

Learn more about webhooks in the [Developer docs](/docs/product/account/dev-tools/manage-webhooks.md) and
learn how to use them in [this tutorial](/docs/dev/tutorials/create-a-webhook.md).

## Use failure effects

Use failure effects to define what happens when a condition is not met during rule
evaluation. For example, you can use a failure effect to create a custom message that
communicates to a customer what they can do to fulfill the condition. See
[Add a failure effect to a condition](/docs/product/rules/conditions/use-conditions.md#add-a-failure-effect-to-a-condition).

## Related pages

- See some examples of rules with effects in our tutorials:
  - [Create a discount using cart item filters](/docs/product/tutorials/coupons/cart-item-filters-discount.md)
  - [Create a point-based loyalty campaign](/docs/product/tutorials/loyalty/loyalty-points-program.md)
- [Cart item filters][cif]
- [Application cart item filters][app-cif]
- [Manage a value map](/docs/product/rules/manage-value-map.md)
- [API effects](/docs/dev/integration-api/api-effects.md)
- [Export triggered effects](/docs/product/rules/effects/export-triggered-effects.md)
- [Create and manage item bundles](/docs/product/rules/create-and-manage-bundles.md)
- [Manage webhooks](/docs/product/account/dev-tools/manage-webhooks.md)

[cif]: /docs/product/rules/cart-item-filters/overview.md
[app-cif]: /docs/product/applications/manage-application-cart-item-filters.md
[attribute selector]: /docs/product/rules/overview.md#attribute-selector
