# Custom Units Expiration & Pending Settings

### **Why Customize This**

By enabling this option, you can create dynamic expiration or pending dates based on a variety of conditions, ensuring that the campaign's incentives align with strategic business objectives such as encouraging quicker customer spending or rewarding long-term loyalty. These methods let you create urgency or tie expirations to loyalty milestones.

{% hint style="info" %}
Advanced settings override [default wallet settings](https://help.openloyalty.io/wallets/wallet-types-and-configuration#unit-settings), making it possible to customize campaigns at a very detailed level.&#x20;
{% endhint %}

### **How to Configure**

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FJKoH6l9OFCpfXnqx51Uy%2Fimage.png?alt=media&#x26;token=720bf0a2-1529-44b0-84d5-d87604e6d81f" alt=""><figcaption></figcaption></figure>

* Select effect **Add Units**
* In **Override units settings**, enable **Expiration settings** or **Pending settings**.
* Use templates to set expiration (e.g., fixed date, X days from transaction).<br>

  <figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FbcIS0KGzokIfgp3bNv6a%2Fimage.png?alt=media&#x26;token=ec30e88e-533b-4e3e-921d-f70448a69915" alt=""><figcaption></figcaption></figure>
* Use variables to reference system timestamps, transaction dates, or member attribute dates.\
  The list of available variables depends on the campaign trigger.<br>

  <figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FIjhqnk9qMIwwTlqVis16%2Fimage.png?alt=media&#x26;token=37a6d6b7-9f6d-473d-be30-9a2f59cc7864" alt=""><figcaption></figcaption></figure>

### Examples

The example: `add_days_to_date(executionContext.processedAt, 15)`. The transaction got into the OL on the 1st of Feb, 2024, so the expiration date of the points will be 16.02.2024 (+15).

* **Transaction document date** - e.g `add_days_to_date(transaction.purchasedAt, 5)`.
* **Member custom attribute** - points will expire on the date of what’s in the member custom attribute value. (`to_date` - converts the key to date). Example custom attribute:

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FVk11s79eR2rMLEBvIEzU%2Fimage.png?alt=media&#x26;token=cb2d3c09-ddf2-4e8c-b424-28c70f056699" alt=""><figcaption></figcaption></figure>

\
If you use the variable below, the points will expire on 2025-08-24.

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2FPsLIftm6WECGOlRWmFDI%2Fimage.png?alt=media&#x26;token=198c7f9a-dbfe-4a7b-a559-99280f4b2cdc" alt=""><figcaption></figcaption></figure>

* But if you want to add days to the point expiration to the end date of the custom attribute, you can use one of the templates and the following formula: `add_days_to_date(to_date(agg(customer.labels).getLabelValue('subscription_end_date)),6)`. Then the expiration date of points will be on 30.08.2025.
* e.g. transaction took place at transaction date 2024-03-01 16:30 → formula days: add\_days\_to\_date(transaction.purchasedAt, 3) → points expire at (2024-03-04 16:30)&#x20;

→ IMPORTANT: it’s not by the end of the day, it’s always the same time as the event/ transaction date
