# 兑换优惠券码 兑换优惠券码。用户在兑换优惠券后获得奖励。 Endpoint: POST /v2/project/{project_id}/coupon/redeem Version: 2.0.0 Security: XsollaLoginUserJWT ## Path parameters: - `project_id` (integer, required) 项目ID。您可以在您的发布商帐户项目名称旁边找到。 Example: 44056 ## Request fields (application/json): - `coupon_code` (string) 唯一优惠券码。包含字母和数字。 Example: "WINTER2021" - `selected_unit_items` (object) 用户选择的奖励。 对象键是单位的SKU,值是单位中一个商品的SKU。 Example: {"game_1":"game_1_steam","game_2":"game_2_playstation"} ## 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/misc/images/e9f2f4a634bc96ea03b5d5ceadd7c55f.png","is_free":false,"name":"Xsolla Booster Mega","price":{"amount":"50.0000000000000000","amount_without_discount":"100.0000000000000000","currency":"USD"},"quantity":1,"sku":"com.xsolla.booster_mega_1","type":"virtual_good","virtual_item_type":"consumable","virtual_prices":[]}] - `items.attributes` (array) - `items.description` (string) - `items.groups` (array) - `items.groups.external_id` (string) - `items.groups.name` (string) - `items.image_url` (string) - `items.is_free` (boolean) - `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)。 Example: "USD" - `items.quantity` (integer) - `items.sku` (string) - `items.type` (string) - `items.virtual_item_type` (string) 虚拟物品的类型。 Enum: "consumable", "non_consumable", "non_renewing_subscription" - `items.virtual_prices` (array) ## Response 401 fields (application/json): - `errorCode` (integer) Example: 1501 - `errorMessage` (string) Example: "[0401-1501]: Authorization failed: Provide authorization" - `statusCode` (integer) Example: 401 ## Response 403 fields (application/json): - `errorCode` (integer) - `errorMessage` (string) Example: "Authorization header not sent." - `statusCode` (integer) Example: 403 - `transactionId` (string) Example: "x-x-x-x-transactionId-mock-x-x-x" ## Response 404 fields (application/json): - `errorCode` (integer) Example: 4001 - `errorMessage` (string) Example: "[0401-9807]: Enter valid coupon code." - `statusCode` (integer) Example: 404 ## Response 422 fields (application/json): - `errorCode` (integer) Example: 1102 - `errorMessage` (string) Example: "[0401-1102]: Unprocessable Entity. The property `coupon_code` is required" - `statusCode` (integer) Example: 422 - `transactionId` (string) Example: "x-x-x-x-transactionId-mock-x-x-x"