# Gift Cards

## Get all gift cards

<mark style="color:blue;">`GET`</mark> `https://plugin.tebex.io/gift-cards`

Return an array of all gift cards on your account.

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| X-Tebex-Secret | string | The secret key of a server. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "data": [
    {
      "id": 38,
      "code": "165261930219",
      "balance": {
        "starting": "25.00",
        "remaining": "12.60",
        "currency": "GBP"
      },
      "note": "Created for player ABC",
      "void": false
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Retrieve a gift card

<mark style="color:blue;">`GET`</mark> `https://plugin.tebex.io/gift-cards/{id}`

Retrieve a gift card by ID.

#### Path Parameters

| Name | Type   | Description            |
| ---- | ------ | ---------------------- |
| id   | string | The ID of a gift card. |

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| X-Tebex-Secret | string | The secret key of a server. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "data": {
    "id": 23,
    "code": "094104746161",
    "balance": {
      "starting": "20.00",
      "remaining": "12.00",
      "currency": "GBP"
    },
    "note": "",
    "void": false
  }
}
```

{% endtab %}
{% endtabs %}

## Lookup a gift card by code

<mark style="color:blue;">`GET`</mark> `https://plugin.tebex.io/gift-cards/lookup/{code}`

Retrieve a gift card by its code.

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| code | string | The code of a gift card. |

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| X-Tebex-Secret | string | The secret key of a server. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "data": {
    "id": 23,
    "code": "094104746161",
    "balance": {
      "starting": "20.00",
      "remaining": "12.00",
      "currency": "GBP"
    },
    "note": "",
    "void": false
  }
}
```

{% endtab %}
{% endtabs %}

## Create a gift card

<mark style="color:green;">`POST`</mark> `https://plugin.tebex.io/gift-cards`

Create a gift card of a specified amount.

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| X-Tebex-Secret | string | The secret key of a server. |

#### Request Body

<table><thead><tr><th width="203">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>expires_at</td><td>string</td><td>The gift card's expiry date in the format <em>yyyy-mm-dd hh:mm:ss</em>.</td></tr><tr><td>note</td><td>string</td><td>The note that will be stored against the gift card.</td></tr><tr><td>amount</td><td>number</td><td>The currency value of the gift card should have upon creation.</td></tr></tbody></table>

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "data": {
    "id": 40,
    "code": "094006746161",
    "balance": {
      "starting": "60.00",
      "remaining": "60.00",
      "currency": "GBP"
    },
    "note": "My note",
    "void": false
  }
}
```

{% endtab %}
{% endtabs %}

## Void a gift card

<mark style="color:red;">`DELETE`</mark> `https://plugin.tebex.io/gift-cards/{id}`

Void a gift card to prevent it from being used.

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| id   | string | The ID of the gift card. |

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| X-Tebex-Secret | string | The secret key of a server. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "data": {
    "id": 23,
    "code": "094104746161",
    "balance": {
      "starting": "20.00",
      "remaining": "12.00",
      "currency": "GBP"
    },
    "note": "",
    "void": true
  }
}
```

{% endtab %}
{% endtabs %}

## Top-up a gift card

<mark style="color:orange;">`PUT`</mark> `https://plugin.tebex.io/gift-cards/{id}`

Top-up (Add more credit) to an existing gift card.

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| id   | string | The ID of the gift card. |

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| X-Tebex-Secret | string | The secret key of a server. |

#### Request Body

| Name   | Type   | Description                                               |
| ------ | ------ | --------------------------------------------------------- |
| amount | string | The currency value the gift card should have added to it. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "data": {
    "id": 40,
    "code": "094006746161",
    "balance": {
      "starting": "10.00",
      "remaining": "40.00",
      "currency": "GBP"
    },
    "note": "",
    "void": false
  }
}
```

{% endtab %}
{% endtabs %}
