**版本：202201**

# 创建礼品卡

**POST** `/openapi/2022-01/gift_cards`

使用提供的详情创建新礼品卡。

## 请求

**application/json**

**请求体 | 示例**

**请求体**

- `gift_card` object

  Gift card informations.

  - `code` string (required)

    The gift card code, which is a string of alphanumeric characters.(minimum: `8` characters, maximum: `20` characters)
  - `initial_value` string (required)

    The initial value of the gift card when it was created. e.g. `200.00`
  - `expires_on` string

    The expiration date of the gift card in ISO-8601 format. e.g. `2022-11-01T00:00:00Z`
  - `note` string

    An optional note that a merchant can attach to the gift card that isn't visible to customers.
  - `customer_id` string

    The ID of the customer associated with this gift card.
  - `template_suffix` string

    The suffix of the Liquid template that's used to render the gift card online.
  - `send_email` boolean

    Send notification email to customer, true is default.

    **默认值：** `true`

```json
{
  "gift_card": {
    "code": "string",
    "initial_value": "string",
    "expires_on": "string",
    "note": "string",
    "customer_id": "string",
    "template_suffix": "string",
    "send_email": true
  }
}
```

## 响应

**200**

200

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `gift_card` object

  - `id` string

    **示例：** `377026890382183978`
  - `last_characters` string

    **示例：** `218p`
  - `balance` string

    **示例：** `100.00`
  - `initial_value` string

    **示例：** `100.00`
  - `note` string

    **示例：** `note`
  - `expires_on`
  - `disabled_at`
  - `enabled` boolean

    **默认值：** `true`

    **示例：** `true`
  - `created_at` string

    **示例：** `2024-05-06T10:12:05Z`
  - `updated_at` string

    **示例：** `2024-05-06T10:12:05Z`
  - `status` string

    **示例：** `enable`
  - `currency` string

    **示例：** `USD`
  - `line_item_id`
  - `order_id`
  - `user_id` string

    **示例：** `cba51e16-ac53-43d8-a7a3-161c5b1ecd8e`
  - `template_suffix`
  - `customer_id` string

    **示例：** `2dd957e3-2051-4cdf-8584-9c0046b4d1ae`

```json
{
  "gift_card": {
    "id": "377026890382183978",
    "last_characters": "218p",
    "balance": "100.00",
    "initial_value": "100.00",
    "note": "note",
    "expires_on": {},
    "disabled_at": {},
    "enabled": true,
    "created_at": "2024-05-06T10:12:05Z",
    "updated_at": "2024-05-06T10:12:05Z",
    "status": "enable",
    "currency": "USD",
    "line_item_id": {},
    "order_id": {},
    "user_id": "cba51e16-ac53-43d8-a7a3-161c5b1ecd8e",
    "template_suffix": {},
    "customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae"
  }
}
```

```json
{
  "gift_card": {
    "id": "377026890382183978",
    "last_characters": "218p",
    "balance": "100.00",
    "initial_value": "100.00",
    "note": "note",
    "expires_on": null,
    "disabled_at": null,
    "enabled": true,
    "created_at": "2024-05-06T10:12:05Z",
    "updated_at": "2024-05-06T10:12:05Z",
    "status": "enable",
    "currency": "USD",
    "line_item_id": null,
    "order_id": null,
    "user_id": "cba51e16-ac53-43d8-a7a3-161c5b1ecd8e",
    "template_suffix": null,
    "customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae"
  }
}
```
