# クポーンコードを引き換える

クーポンコードを引き換えます。クーポンが引き換えられると、ユーザーはボーナスを受け取ります。<br>
<div class="note">
<strong>注意</strong><br><br>
このAPIコールはユーザーJWTを使用して認証を行います。<br><br>
トークンは<code>Authorization</code>ヘッダーへ次の形式でトークンを設定します：<code>Bearer <user_JWT></code>。ユーザーJWTに関する詳細情報は、該当コールの<strong>セキュリティ</strong>ブロックで確認できます。
</div>

Endpoint: POST /v2/project/{project_id}/coupon/redeem
Version: 2.0.0
Security: XsollaLoginUserJWT

## Path parameters:

  - `project_id` (integer, required)
    プロジェクトID。このパラメータは、[パブリッシャーアカウント](https://publisher.xsolla.com/0/projects/0/)のプロジェクト名の横、またはプロジェクトの作業中にブラウザのアドレスバーで確認できます。URLの形式は以下の通りです：`https://publisher.xsolla.com/<merchant_id>/projects/<project_id>`。

## Request fields (application/json):

  - `coupon_code` (string)
    一意のコードです。文字と数字が含まれます。
    Example: WINTER2021

## Response 200 fields (application/json):

  - `items` (array)
    Example: [{"attributes":[],"description":"Take it, take it all! All of Xsolla's riches in one Mega Booster.","groups":[{"external_id":"powerups","name":"Power Ups"}],"image_url":"https://cdn.xsolla.net/img/mis…

  - `items.sku` (string)

  - `items.groups` (array)

  - `items.groups.external_id` (string)

  - `items.groups.name` (string)

  - `items.name` (string | null)

  - `items.price` (object | null)
    アイテム価格。

  - `items.price.amount` (string)
    割引後のアイテム価格。
    Example: 2.9900

  - `items.price.amount_without_discount` (string)
    アイテム価格。
    Example: 2.9900

  - `items.price.currency` (string)
    商品価格通貨。[ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) による3文字コード。
    Example: USD

  - `items.type` (string)

  - `items.virtual_item_type` (string)
    仮想アイテムタイプ。
指定可能な値：
- `consumable` — 使用後にインベントリから消滅するアイテム（例：弾薬など）。
- `non_consumable` — 期間の制限なくインベントリに残り続けるアイテム。
- `non_renewing_subscription` — 制限された期間内に限り、サービスやコンテンツへのアクセス権を付与する期間限定アイテム。
    Enum: "consumable", "non_consumable", "non_renewing_subscription"

  - `items.virtual_prices` (array)

  - `items.description` (string)

  - `items.image_url` (string)

  - `items.quantity` (integer)

  - `items.is_free` (boolean)

  - `items.attributes` (array)

## Response 401 fields (application/json):

  - `statusCode` (integer)
    Example: 401

  - `errorCode` (integer)
    Example: 1501

  - `errorMessage` (string)
    Example: [0401-1501]: Authorization failed: Provide authorization

## Response 403 fields (application/json):

  - `statusCode` (integer)
    Example: 403

  - `errorCode` (integer)
    Example: 0

  - `errorMessage` (string)
    Example: Authorization header not sent.

  - `transactionId` (string)
    Example: x-x-x-x-transactionId-mock-x-x-x

## Response 404 fields (application/json):

  - `statusCode` (integer)
    Example: 404

  - `errorCode` (integer)
    Example: 4001

  - `errorMessage` (string)
    Example: [0401-9807]: Enter valid coupon code.

## Response 422 fields (application/json):

  - `statusCode` (integer)
    Example: 422

  - `errorCode` (integer)
    Example: 1102

  - `errorMessage` (string)
    Example: [0401-1102]: Unprocessable Entity. The property `coupon_code` is required

  - `transactionId` (string)
    Example: x-x-x-x-transactionId-mock-x-x-x

