# プロモーションコードを引き換える プロモーションコードを引き換えます。 プロモーションコードを引き換えた後、ユーザーは無料でアイテムを入手したり、カートや特定のアイテムの価格を下げたりすることができます。 Endpoint: POST /v2/project/{project_id}/promocode/redeem Version: 2.0.0 Security: AuthForCart ## Path parameters: - `project_id` (integer, required) プロジェクトID。このパラメータは、パブリッシャーアカウントのプロジェクト名の横にあります。 Example: 44056 ## Request fields (application/json): - `cart` (object,null) - `cart.id` (string, required) カートID。 - `coupon_code` (string) プロモーションコードの一意のコード。文字と数字が含まれています。 Example: "SUMMER2021" - `selected_unit_items` (object) ユーザーが選択したリワード。 オブジェクトのキーはユニットのSKUで、値はユニット内の1つのアイテムのSKUです。 Example: {"game_1":"game_1_steam","game_2":"game_2_playstation"} ## Response 200 fields (application/json): - `cart_id` (string) カートID。 Example: "cart_id" - `is_free` (boolean) trueの場合で、アイテムは無料です。 - `items` (array) Example: [{"attributes":[],"can_be_bought":{"$ref":"../schemas/Can_be_bought.yaml"},"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,"limits":{"$ref":"../schemas/Catalog_item_limits.yaml"},"name":"Xsolla Booster Mega","periods":{"$ref":"../schemas/item-periods.yaml"},"price":{"amount":"50.0000000000000000","amount_without_discount":"100.0000000000000000","currency":"USD"},"promotions":{"$ref":"../schemas/Catalog_item_promotions.yaml"},"quantity":123,"sku":"com.xsolla.booster_mega_1","type":"virtual_good","virtual_item_type":"consumable","virtual_prices":[],"vp_rewards":{"$ref":"../schemas/reward-chain-client/client-item-value-point-reward.yaml"}}] - `items.can_be_bought` (boolean) trueの場合、ユーザーはアイテムを購入することができます。 Example: true - `items.description` (string) - `items.groups` (array) - `items.groups.external_id` (string) - `items.groups.name` (string) - `items.image_url` (string) - `items.limits` (object,null) アイテム制限。 - `items.limits.per_item` (object,null) アイテムのアイテム制限。 - `items.limits.per_item.available` (integer) すべてのユーザーが購入できるアイテムの残り数。 Example: 3 - `items.limits.per_item.total` (integer) すべてのユーザーが購入できるアイテムの最大数。 Example: 5 - `items.limits.per_user` (object,null) ユーザーのアイテム制限。 - `items.limits.per_user.available` (integer) 現在のユーザーが購入できるアイテムの残り数。 Example: 3 - `items.limits.per_user.limit_exceeded_visibility` (string) 購入制限に達してから次回の制限リセットまでの間、カタログ内でのアイテムの表示・非表示を決定します。 これは、recurrent_schedule配列で定期的な制限リセットが設定されているアイテムに適用されます。 制限のリセットが設定されていない場合、limit_exceeded_visibilityの値に関わらず、購入制限に達した後のアイテムはカタログに表示されません。 Enum: "show", "hide" - `items.limits.per_user.recurrent_schedule` (object) ユーザーのアイテム制限の定期更新期間。 - `items.limits.per_user.recurrent_schedule.interval_type` (string) 定期更新期間のタイプ。 Enum: "daily", "weekly", "monthly", "hourly" - `items.limits.per_user.recurrent_schedule.reset_next_date` (integer) 制限がリセットされた日時(UNIXタイムスタンプ)。 Example: 1677553200 - `items.limits.per_user.total` (integer) 1ユーザーあたりのユーザーが購入できるアイテムの最大数。 Example: 5 - `items.periods` (array,null) アイテム販売期間。 - `items.periods.date_from` (string) 指定されたアイテムの販売開始日。 Example: "2020-08-11T10:00:00+03:00" - `items.periods.date_until` (string,null) 指定されたアイテムが販売できなくなる日付。nullを指定することもできます。 Example: "2020-08-11T20:00:00+03:00" - `items.promotions` (array) カート内の特定アイテムに適用されるプロモーション。この配列は、以下のケースで返されます: * 特定のアイテムに対して、割引キャンペーンが構成されている場合。 * 選択されたアイテムの割引設定を持つプロモーションコードが適用された場合。 アイテムレベルのプロモーションが適用されない場合は、空の配列が返されます。 - `items.promotions.bonus` (array) - `items.promotions.bonus.bundle_type` (string) ボーナスバンドルアイテムタイプ。ボーナスアイテムタイプbundleのみで利用可能です。 Enum: "standard", "virtual_currency_package" - `items.promotions.bonus.image_url` (string) ボーナスアイテムの画像URLです。ボーナスアイテムのタイプ physical_good では使用できません。ー - `items.promotions.bonus.name` (string) ボーナスアイテムの名前です。ボーナスアイテムのタイプphysical_goodでは使用できません。 - `items.promotions.bonus.quantity` (integer) - `items.promotions.bonus.sku` (string) - `items.promotions.bonus.type` (string) ボーナスアイテムタイプ。 Enum: "virtual_good", "virtual_currency", "bundle", "physical_good", "game_key", "nft" - `items.promotions.date_end` (string,null) - `items.promotions.date_start` (string,null) - `items.promotions.discount` (object,null) - `items.promotions.discount.percent` (string,null) - `items.promotions.discount.value` (string,null) - `items.promotions.limits` (object) - `items.promotions.limits.per_user` (object) - `items.promotions.limits.per_user.available` (integer) - `items.promotions.limits.per_user.total` (integer) - `items.type` (string) - `items.vp_rewards` (array) バリューポイントアイテム報酬。 - `items.vp_rewards.amount` (integer) バリューポイントの量。 - `items.vp_rewards.image_url` (string) 画像URL。 Example: "https://image.example.com" - `items.vp_rewards.is_clan` (boolean) バリューポイントがクランリワードチェーンで使用されるかどうか。 Example: true - `items.vp_rewards.item_id` (integer) 内部の一意のアイテムID。 Example: 1 - `items.vp_rewards.name` (string) バリューポイント名。 - `items.vp_rewards.sku` (string) 一意のバリューポイントID。 - `price` (object,null) カート価格。 Example: {"amount":"6150.0000000000000000","amount_without_discount":"6150.0000000000000000","currency":"USD"} - `price.amount` (string) Example: "6150.0000000000000000" - `price.amount_without_discount` (string) Example: "6150.0000000000000000" - `price.currency` (string) Example: "USD" - `rewards` (object) - `rewards.discount` (object,null) 割引率。 カートの価格は、この割引率で計算された値で減少し、小数点以下2桁に四捨五入されます。 - `rewards.discounted_items` (array,null) プロモーションコードによる割引が適用されるアイテムリスト。 - `rewards.discounted_items.sku` (string, required) アイテムSKU。 - `rewards.is_selectable` (boolean) trueの場合、ユーザーはプロモーションコードを引き換える前にボーナスを選択する必要があります。 ## 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 promo 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"