# Gift cards

A gift card is a special type of payment instrument that can be either purchased or used to pay for an order — in total or in part — depending on its outstanding balance. All gift cards must be activated before being used. Rechargeable gift cards can be reloaded at any time. Single-use gift cards become redeemed after the first usage, whatever the balance is used.

{% hint style="info" %}
You can set an expiration date for a gift card. Expired gift cards cannot be used anymore, but they remain active so that you can use them again once the expiration date is updated.
{% endhint %}

You can associate a gift card to a market if you want to restrict its availability to that specific market. Check the `balance_log` attribute to browse the history of a gift card's balance changes and the `usage_log` attribute for more information about how, when, and by which order the gift card has been used.

### Discount calculation and distribution

Unless you set the `distribute_discount` attribute to `false` (default is `true`) at the single gift card level, the total discount due to gift cards used to pay for an order is calculated and distributed on all the [taxable items](/core-api-reference/orders.md#taxable-items) of the order, based on the ratio between the line item amount and the sum of the amounts of all the line items to which the promotion is applied.

{% hint style="warning" %}
If you set the `distribute_discount` attribute to `false` and the price list associated with the market where you're placing the order does not include taxes (i.e. the [price list](/core-api-reference/price_lists.md) `tax_included` attribute is set to `false`), the discount will be applied to the whole order amount plus taxes. This means that if the gift card balance is greater enough, it will saturate both the order amount and taxes amount. In any other case, only the order amount (taxes excluded) will be considered when applying the gift card discount.
{% endhint %}

<details>

<summary>Data model</summary>

Check the related [ER diagram](/data-model/promo-and-loyalty/promotions-and-gift-cards.md) and explore the flowchart that illustrates how the gift card resource relates to the other API entities.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/core-api-reference/gift_cards.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
