# 获取兑换码奖励

通过兑换码获取兑换码奖励。可用于允许用户从多个商品中选择一个作为赠品。常见场景是：如果兑换码包含游戏作为赠品(type=unit)，则选择DRM。


  注：
    此API调用使用用户JWT进行授权。
    请在Authorization请求头中按以下格式传入令牌：Bearer &lt;user_JWT&gt;。关于用户JWT的更多信息，请参阅此调用的安全性部分。

Endpoint: GET /v2/project/{project_id}/promocode/code/{promocode_code}/rewards
Version: 2.0.0
Security: XsollaLoginUserJWT

## Path parameters:

  - `project_id` (integer, required)
    项目ID。您可以在发布商帐户的项目名称旁找到此参数；使用项目时，也可以在浏览器地址栏中找到此参数。URL格式如下：https://publisher.xsolla.com//projects/。
    Example: 44056

  - `promocode_code` (string, required)
    区分大小写的唯一兑换码。包含字母和数字。
    Example: "SO6rew99j9"

## Response 200 fields (application/json):

  - `bonus` (array)

  - `bonus.item` (object)

  - `bonus.item.sku` (string)
    唯一商品ID。SKU只能包含大小写英文字母、数字、句点、短横线和下划线。
    Example: "game_01"

  - `bonus.item.name` (string)
    商品名称。
    Example: "Game name"

  - `bonus.item.type` (string)
    商品类型。可能值：virtual_good — 虚拟物品virtual_currency — 虚拟货币bundle — 捆绑包unit — 游戏Key套餐
    Example: "unit"

  - `bonus.item.description` (string)
    商品描述。
    Example: "Game description"

  - `bonus.item.image_url` (string)
    图片URL。
    Example: "https://cdn.xsolla.net/img/misc/images/b79342cdf24f0f8557b63c87e8326e62.png"

  - `bonus.item.unit_items` (array)
    平台专属游戏Key数组。仅当商品类型为unit (bonus.item.type = 'unit')时使用。如果游戏Key套餐包含平台专属Key，用户可以选择其中一个作为赠品。

  - `bonus.item.unit_items.sku` (string)
    唯一的平台专属游戏Key套餐ID。允许使用以下字符：a-z、A-Z、0-9、句点（.）、连字符（-）、下划线（_）。该值由bonus.item.​sku和bonus.item.unit_items.drm_sku的值组合而成。例如，如果bonus.item.​sku = 'cool_game'，且bonus.item.unit_items.drm_sku = 'steam'，则该值为cool_game_steam。
    Example: "cool_game_steam"

  - `bonus.item.unit_items.is_free` (boolean)

  - `bonus.item.unit_items.type` (string)
    表示该商品为游戏Key。
    Enum: "game_key"

  - `bonus.item.unit_items.name` (string)
    游戏名称。
    Example: "Awesome Game"

  - `bonus.item.unit_items.drm_name` (string)
    DRM名称。
    Example: "Steam"

  - `bonus.item.unit_items.drm_sku` (string)
    唯一DRM ID，用作后缀以表示平台专属游戏Key。允许使用以下字符：a-z、A-Z、0-9、句点（.）、连字符（-）、下划线（_）。
    Example: "steam"

  - `bonus.quantity` (number)
    商品数量。

  - `discount` (object,null)
    百分比折扣。
购物车价格将按照此百分比打折，然后四舍五入到小数点后两位。

  - `discount.percent` (string)
    Example: "10.00"

  - `discounted_items` (array,null)
    通过兑换码享受折扣的商品列表。

  - `discounted_items.sku` (string, required)
    商品SKU。

  - `discounted_items.discount` (object, required)

  - `discounted_items.discount.percent` (string, required)
    百分比折扣。

购物车商品价格将按照此百分比打折，
然后四舍五入到小数点后两位。

  - `is_selectable` (boolean)
    如果为true，则用户应在核销兑换码前选择赠品。

## 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)

  - `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 promo code."


