# ボーナスプロモーションを作成

ボーナスプロモーションを作成します。

プロモーションは、ユーザーによる購入に無料のボーナスアイテムを追加します。
プロモーションは、プロジェクト内のすべての購入、または特定のアイテムを含む購入に適用することができます。

Endpoint: POST /v3/project/{project_id}/admin/promotion/bonus
Version: 2.0.0
Security: basicAuth

## Path parameters:

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

## Request fields (application/json):

  - `id` (integer)
    プロモーションID。プロジェクト内での一意のプロモーション識別子。

  - `promotion_periods` (array)
    プロモーションの有効期間。複数の期間を指定する場合は、date_fromとdate_untilの両方が必須となります。

  - `promotion_periods.date_from` (string, required)
    指定されたプロモーションの開始日。
    Example: "2020-08-11T10:00:00+03:00"

  - `promotion_periods.date_until` (string,null)
    指定されたプロモーションの終了日。nullに設定した場合、プロモーションは無期限となります。単一の有効期間のみが指定されている場合に限り、nullに設定可能です。
    Example: "2020-08-11T20:00:00+03:00"

  - `name` (object, required)
    プロモーション名。キーと値のペアを含む必要があります。キーは"^[a-z]{2}-[A-Z]{2}$"フォーマットのロケール、値は文字列です。
    Example: {"en-US":"Summer season bonus","de-DE":"Sommersaison Bonus"}

  - `condition` (array,null, required)
    プロモーションを適用するために、購入に含める必要があるアイテムのセット。このパラメータがnullである場合、プロジェクト内のすべての購入にプロモーションが適用されます。

  - `condition.sku` (string)
    アイテムSKU。

  - `attribute_conditions` (array)
    ユーザー属性を検証するための条件。
ユーザー属性が指定されたすべての条件に一致するかどうかに基づいて、プロモーションの可用性を決定します。

  - `bonus` (array,null, required)

  - `bonus.sku` (string)
    アイテムSKU。

  - `bonus.quantity` (number)
    アイテム数量。

  - `limits` (object)
    プロモーションの制限。

  - `limits.per_user` (integer,null)
    別ユーザーでのプロモーション制限。

  - `limits.recurrent_schedule` (object,null)
    制限更新期間。

  - `limits.recurrent_schedule.per_user` (any)
    ユーザー制限更新期間。

  - `price_conditions` (array,null)
    プロモーションを適用する価格帯を設定する条件を持つオブジェクトの配列。 プロモーションは、価格が配列内のすべての条件を満たすアイテムにのみ適用されます。この配列を渡す場合は、[条件](/ja/api/shop-builder/operation/create-bonus-promotion/#!path=condition&t=request)オブジェクトの値をnullに設定します。

  - `price_conditions.operator` (string, required)
    プロモーションを適用する価格帯を設定する比較演算子。

可能な値：
- ge — 大なりイコール
- gt — より大きい
- le — 小なりイコール
- lt — より小さい
- eq — イコール
- ne — ノットイコール
    Enum: "ge", "gt", "le", "lt", "eq", "ne"

  - `price_conditions.value` (string, required)
    プロモーションを適用する価格帯を決定するための値。

  - `excluded_promotions` (array)
    このプロモーションを適用する際に除外するプロモーションIDのリスト。Example：[12, 789]

  - `is_enabled` (boolean)
    プロモーションが有効かどうか。

## Response 201 fields (application/json):

  - `promotion_id` (integer)
    プロモーションID。プロジェクト内での一意のプロモーション識別子。

## Response 401 fields (application/json):

  - `statusCode` (integer)
    Example: 401

  - `errorCode` (integer)
    Example: 1020

  - `errorMessage` (string)
    Example: "[0401-1020]: Error in Authentication method occurred"

## Response 422 fields (application/json):

  - `statusCode` (integer)
    Example: 422

  - `errorCode` (integer)
    Example: 1102

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

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


