> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dintero.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.dintero.com/feedback

```json
{
  "path": "/docs/checkout/gift-cards",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Pay with gift cards in Checkout

> Let customers pay full or partial amounts with Dintero virtual gift cards in Checkout Express, including capture, refund, and split-payment behavior rules.

Dintero Gift Cards gives your customers the option to pay either fully or partially with a gift card in your checkout. This way you can create virtual gift cards which customers can use to pay an order in your store later.

<Info>
  * Gift cards are only supported for Dintero Checkout Express sessions.
  * Only one gift card can be used to authorize a payment session.
  * Gift cards are *not* supported for payment sessions where splits are specified.
  * Gift cards have precedence when a transaction is partially captured or
    refunded
  * The refunded amount to a gift card cannot exceed what was initially
    captured

  Creating a payment session with Dintero Gift Cards enabled is currently only supported for the following payment options:

  * `payex`
  * `bambora`
  * `dintero_psp.creditcard`
  * `klarna.klarna`
</Info>

## Creating gift cards

See the [gift card documentation](../wallet-create-gift-card.md) for info about creating gift cards with pin codes.

## Using gift cards in the checkout

There are two ways a gift card can be used to authorize a payment session:

* Customer provides their gift card during the checkout flow.
* Merchant provides the customer gift card when the payment session is
  created.

<Info>
  Native push to payment Wallets (Vipps/MobilePay/Swish) will be disabled when
  gift card is enabled as the payer must "use" their gift card before
  being redirected to the Wallets app. Push will be done by sending SMS
  containing link to checkout.
</Info>

### Customer initiated

This flow allows the payer to pay their order either fully or partially using a gift card—depending on the order amount and the available balance on the card.

When the payer loads the checkout they get the option to add a gift card after they have entered their personal details and before they complete the authorization, as shown below:

<img src="https://mintcdn.com/dintero-c3a7bfec/TiCvqt4VXcXnNQNe/docs/assets/checkout/gift-card-input.png?fit=max&auto=format&n=TiCvqt4VXcXnNQNe&q=85&s=88e60fdc63c4cf6a53e612335d267386" alt="Gift card input" width="2248" height="802" data-path="docs/assets/checkout/gift-card-input.png" />

Please note that PIN is required in this case, meaning that the payer will need to input a PIN code in order to activate the gift card. To learn more about creating a card, including cards with PIN codes, please refer to the [relevant documentation](../wallet-create-gift-card.md)

If the gift card number and PIN entered are both correct and the gift card is valid, the gift card will be added to the session and the total amount will update to reflect the order amount minus the available balance on the gift card. In this example, the available balance was 100 NOK. The updated order amount after adding the gift card is therefore 400 - 100 = 300 NOK, as shown below:

<img src="https://mintcdn.com/dintero-c3a7bfec/TiCvqt4VXcXnNQNe/docs/assets/checkout/gift-card-added.png?fit=max&auto=format&n=TiCvqt4VXcXnNQNe&q=85&s=8d2e858a3a9a1a6c2ce9980704bcd729" alt="Gift card added" width="2254" height="1022" data-path="docs/assets/checkout/gift-card-added.png" />

An example request for creating a payment session with Dintero Gift Cards enabled is shown below:

```
POST https://checkout.dintero.com/v1/sessions-profile
Authorization: Bearer <token>
Content-Type: application/json

{
  "url": {
    "return_url": "https://example.com/accept",
    "callback_url": "https://example.com/callback?method=GET",
    "merchant_terms_url": "https://example.com/terms.html"
  },
  "order": {
    "amount": 72200,
    "currency": "NOK",
    "vat_amount": 13660,
    "items": [
      {
        "amount": 72200,
        "quantity": 2,
        "line_id": "1",
        "description": "Forsvinnignspølse",
        "vat": 20,
        "id": "10"
      }
    ],
    "merchant_reference": "string"
  },
  "configuration": {
    "active_payment_types": { "enabled": true },
    "dintero": {
      "type": "payment_type",
      "wallets": {
        "type": "payment_product_type",
        "enabled": true
      }
    }
  },
  "profile_id": "default",
  "merchant": {
    "name": "string",
    "logo_url": "http://example.com"
  }
}
```

<Info>
  See related documentation for more information about creating payment sessions

  * [Create a session](/docs/checkout/create-session)
  * [Checkout API reference](https://docs.dintero.com/payments-api.html#tag/session/operation/checkout_session_profile_post)
</Info>

### Merchant initiated

This flow is intended for the use case where the gift card is presented
before the payment session is created, e.g. the payer is authenticated
and the gift card is provided from the merchant CRM system.

PIN is *not* required in this case, since the payer is known and authenticated.

When the payer loads the checkout, it will display that a gift card has been activated and added to the session. The payer can then either proceed with the payment or remove the gift card. If they remove the gift card, they will need to input the gift card number and PIN code in order to activate it again.

An example request for creating a payment session with Dintero Gift Cards enabled and preloaded is shown below:

```
POST https://checkout.dintero.com/v1/sessions-profile
Authorization: Bearer <token>
Content-Type: application/json

{
  "url": {
    "return_url": "https://example.com/accept",
    "callback_url": "https://example.com/callback?method=GET",
    "merchant_terms_url": "https://example.com/terms.html"
  },
  "customer": {
    "gift_cards": {
      "dintero.wallets": [
          {
            "card_id": "{wallets.card_id}"
          }
      ]
    }
  },
  "order": {
    "amount": 72200,
    "currency": "NOK",
    "vat_amount": 13660,
    "items": [
      {
        "amount": 72200,
        "quantity": 2,
        "line_id": "1",
        "description": "Forsvinnignspølse",
        "vat": 20,
        "id": "10"
      }
    ],
    "merchant_reference": "string"
  },
  "configuration": {
    "active_payment_types": { "enabled": true },
    "dintero": {
      "type": "payment_type",
      "wallets": {
        "type": "payment_product_type",
        "enabled": true
      },
      "zero": {
        "type": "payment_product_type",
        "enabled": true,
        "payability": "payable"
      }
    }
  },
  "profile_id": "default",
  "merchant": {
    "name": "string",
    "logo_url": "http://example.com"
  }
}
```
