> ## 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/wallet-batch-create-gift-card",
  "feedback": "Description of the issue"
}
```

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

</AgentInstructions>

# Batch create gift cards

> Pre-generate batches of physical Dintero gift cards with the wallet API so cards can be printed by your manufacturer and activated at point of sale.

The Dintero wallet services support batch creation of gift cards. Use this
when you need to pre-generate cards for printing before they are sold and activated.

A typical example is a retail chain ordering a batch of physical gift cards from
a card manufacturer. The cards are printed with the token and PIN, distributed
to stores, and activated individually at the point of sale when a customer
purchases one.

## Create a batch of gift cards

Create 2 unactivated gift cards for printing

```
POST https://api.dintero.com/v1/accounts/{aid}/wallets/cards/batch
Authorization: Bearer <token>
Content-Type: application/json
```

```json theme={null}
{
  "cards": [
    {
      "card_id": "card-01",
      "type": "gift_card"
    },
    {
      "card_id": "card-02",
      "type": "gift_card"
    }
  ],
  "options": {
    "pin": {
      "format": {
        "length": 36,
        "prefix": "DINCARD:",
        "symbols": true,
        "numbers": true,
        "characters": true,
        "barcode": false
      }
    },
    "card_token": {
      "format": {
        "length": 36,
        "prefix": "DINCARD:",
        "symbols": true,
        "numbers": true,
        "characters": true,
        "barcode": false
      }
    }
  }
}
```

Cards created via batch are assigned status `inactive` and carry no balance.

<Info>
  The `card_token` and `pin` for each card are included in the response and will
  **not** be retrievable again after this call. Store or forward them immediately
  for printing.

  * [Wallets Batch API reference]
</Info>

## Activate a gift card

When a card is sold, activate it using:

```
POST https://api.dintero.com/v1/accounts/{aid}/wallets/cards/{card_id}/activate
Authorization: Bearer <token>
Content-Type: application/json
```

```json theme={null}
{
  "customer_id": "string",
  "name": "string",
  "amount": 50000,
  "currency": "NOK",
  "originated_by": "string",
  "active_from": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "metadata": {
    "dintero_transaction_id": "P12345678.xxxxx"
  }
}
```

This transitions the card from `inactive` to `unused` and sets the balance. All
fields are optional except amount and currency:

| Field              | Description                                              |
| ------------------ | -------------------------------------------------------- |
| amount / currency  | Required. Initial balance loaded onto the card           |
| customer\_id       | Associate the card with a customer at point of sale      |
| active\_from       | Defaults to the time of activation if omitted            |
| expires\_at        | Omit if the card should not expire                       |
| metadata           | Recommended — include the transaction that sold the card |

<Info>
  Cards in `inactive` status cannot be used for payment.

  * [Wallets Activate API reference]
</Info>

[Wallets Batch API reference]: https://docs.dintero.com/wallets-api.html#tag/cards/operation/aid_cards_batch_post

[Wallets Activate API reference]: https://docs.dintero.com/wallets-api.html#tag/cards/operation/aid_cards_cardid_activate_post
