# Fill cart with items

Fills the cart with items. If the cart already has an item with the same SKU, the existing item will be replaced by the passed value.

Endpoint: PUT /v2/project/{project_id}/cart/fill
Version: 2.0.0
Security: AuthForCart

## Path parameters:

  - `project_id` (integer, required)
    Project ID. You can find this parameter in your Publisher Account next to the project name and in the browser address bar when working with a project. The URL has the following format: https://publisher.xsolla.com//projects/.
    Example: 44056

## Request fields (application/json):

  - `items` (array, required)
    List of items.
    Example: [{"sku":"com.xsolla.booster_mega_1","quantity":123}]

  - `items.sku` (string, required)

  - `items.quantity` (number, required)

## Response 200 fields (application/json):

  - `cart_id` (string)
    Cart ID.
    Example: "cart_id"

  - `price` (object,null)
    Cart price.
    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"

  - `is_free` (boolean)
    If true, a cart is free.

  - `items` (array)

  - `items.sku` (string)

  - `items.groups` (array)

  - `items.groups.external_id` (string)

  - `items.groups.name` (string)

  - `items.name` (string,null)

  - `items.attributes` (array)
    List of attributes and their values corresponding to the item. Can be used for catalog filtering.

  - `items.attributes.external_id` (string)
    Unique attribute ID. The external_id may contain only lowercase and uppercase Latin alphanumeric characters, dashes, and underscores.

  - `items.attributes.name` (string)
    Name of attribute.
    Example: "Genre"

  - `items.attributes.values` (array)

  - `items.attributes.values.external_id` (string)
    Unique value ID for an attribute. The external_id may only contain lowercase Latin alphanumeric characters, dashes, and underscores.

  - `items.attributes.values.value` (string)
    Value of attribute.
    Example: "Strategy"

  - `items.type` (string)

  - `items.description` (string)

  - `items.image_url` (string)

  - `items.quantity` (integer)

  - `items.price` (object,null)
    Item price.
    Example: {"amount":"6150.0000000000000000","amount_without_discount":"6150.0000000000000000","currency":"USD"}

  - `items.price.amount` (string)
    Example: "6150.0000000000000000"

  - `items.price.amount_without_discount` (string)
    Example: "6150.0000000000000000"

  - `items.price.currency` (string)
    Example: "USD"

  - `items.virtual_item_type` (string)
    Type of item.

  - `items.virtual_prices` (array)
    Virtual prices.

  - `items.virtual_prices.amount` (integer)
    Item price in virtual currency.
    Example: 100

  - `items.virtual_prices.amount_without_discount` (integer)
    Item price in virtual currency without discount. Always equal to amount since discounts are not applied to prices in virtual currency.
    Example: 200

  - `items.virtual_prices.sku` (string)
    Virtual currency SKU.
    Example: "vc_gold"

  - `items.virtual_prices.is_default` (boolean)
    Whether it is the default price in virtual currency.
    Example: true

  - `items.virtual_prices.image_url` (string,null)
    Virtual currency image URL.
    Example: "http://image.png"

  - `items.virtual_prices.name` (string)
    Virtual currency name.
    Example: "Gold"

  - `items.virtual_prices.type` (string)
    Item type. For virtual currency, it is virtual_currency.
    Example: "virtual_currency"

  - `items.virtual_prices.description` (string,null)
    Virtual currency description.
    Example: "In-game currency used to purchase weapons and upgrades"

  - `items.is_free` (boolean)
    Whether the item is free.

  - `items.is_bonus` (boolean)

  - `items.promotions` (array)
    Applied promotions for specific items in the cart. The array is returned in the following cases:

* A discount promotion is configured for a specific item.

* A promo code with the Discount on selected items setting is applied.

If no item-level promotions are applied, an empty array is returned.

  - `items.promotions.name` (string)

  - `items.promotions.date_start` (string,null)

  - `items.promotions.date_end` (string,null)

  - `items.promotions.discount` (object,null)

  - `items.promotions.discount.percent` (string,null)

  - `items.promotions.discount.value` (string,null)

  - `items.promotions.bonus` (array)

  - `items.promotions.bonus.sku` (string)

  - `items.promotions.bonus.quantity` (integer)

  - `items.promotions.bonus.type` (string)
    Bonus item type.
    Enum: "virtual_good", "virtual_currency", "bundle", "physical_good", "game_key", "nft"

  - `items.promotions.bonus.name` (string)
    Bonus item name. Not available for physical_good bonus item type.

  - `items.promotions.bonus.image_url` (string)
    Bonus item image URL. Not available for physical_good bonus item type.

  - `items.promotions.bonus.bundle_type` (string)
    Bonus bundle item type. Available only for bundle bonus item type.
    Enum: "standard", "virtual_currency_package"

  - `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.can_be_bought` (boolean)
    If true, the user can buy an item.

  - `items.vp_rewards` (array)
    List of value point rewards for the item.

  - `items.vp_rewards.item_id` (integer)
    Internal unique item ID.

  - `items.vp_rewards.sku` (string)
    Unique value point ID.

  - `items.vp_rewards.amount` (integer)
    Amount of value points.

  - `items.vp_rewards.name` (string)
    Value point name.

  - `items.vp_rewards.image_url` (string)
    Image URL.

  - `items.vp_rewards.is_clan` (boolean)
    Whether the value point is used in clan reward chains.

  - `items.loyalty_rewards` (array)
    Loyalty points the user receives as a reward for purchasing the item.

  - `items.loyalty_rewards.name` (string)
    Loyalty point name.

  - `items.loyalty_rewards.sku` (string)
    Loyalty point SKU. Pass this value in the loyalty_point_sku parameter of other API calls, for example, when creating an order paid with loyalty points.

  - `items.loyalty_rewards.description` (string)
    Loyalty point description.

  - `items.loyalty_rewards.image_url` (string,null)
    Image URL.

  - `items.loyalty_rewards.amount` (integer)
    Number of loyalty points the user receives for purchasing the item.

  - `items.limits` (object,null)
    Item limits.

  - `items.limits.per_user` (object,null)
    Item limits for a user.

  - `items.limits.per_user.total` (integer)
    Maximum number of items a single user can purchase.
    Example: 5

  - `items.limits.per_user.available` (integer)
    Remaining number of items the current user can purchase.
    Example: 3

  - `items.limits.per_user.recurrent_schedule` (any)

  - `items.limits.per_user.limit_exceeded_visibility` (string)
    Determines the visibility of the item in the catalog after the purchase limit is reached, until the next limit reset.

Applies to items for which recurring limit resets are configured in the recurrent_schedule array.

If limit resets are not configured, the item doesn't appear in the catalog after the purchase limit is reached,
regardless of the limit_exceeded_visibility value.

Possible values:
- show — The item is returned in catalog retrieval API calls after the purchase limit is reached. In client-side
catalog retrieval API calls, once the limit is reached, the item is returned with the can_be_bought: false flag. The
next reset date is returned in reset_next_date.
- hide — The item is not returned in catalog retrieval API calls after the purchase limit is reached, until the
limit is reset.
    Enum: "show", "hide"

  - `items.limits.per_item` (object,null)
    Item limits for an item.

  - `items.limits.per_item.total` (integer)
    Maximum number of items all users can purchase.
    Example: 5

  - `items.limits.per_item.available` (integer)
    Remaining number of items all users can purchase.
    Example: 3

  - `items.periods` (array,null)
    Item sales period.

  - `items.periods.date_from` (string)
    Date when the specified item will be available for sale.
    Example: "2020-08-11T10:00:00+03:00"

  - `items.periods.date_until` (string,null)
    Date when the specified item will become unavailable for sale. Can be null.
    Example: "2020-08-11T20:00:00+03:00"

  - `promotions` (array)
    Applied promotions for the entire cart. The array is returned in the following cases:

* A promotion affects the total cart amount, such as a promo code with the Discount on purchase setting.

* A promotion adds bonus items to the cart.

If no order-level promotions are applied, an empty array is returned.

  - `promotions.name` (string)

  - `promotions.date_start` (string,null)

  - `promotions.date_end` (string,null)

  - `promotions.discount` (object,null)

  - `promotions.discount.percent` (string,null)

  - `promotions.discount.value` (string,null)

  - `promotions.bonus` (array)

  - `promotions.bonus.sku` (string)

  - `promotions.bonus.quantity` (integer)

  - `promotions.bonus.type` (string)
    Bonus item type.
    Enum: "virtual_good", "virtual_currency", "bundle", "physical_good", "game_key", "nft"

  - `promotions.bonus.name` (string)
    Bonus item name. Not available for physical_good bonus item type.

  - `promotions.bonus.image_url` (string)
    Bonus item image URL. Not available for physical_good bonus item type.

  - `promotions.bonus.bundle_type` (string)
    Bonus bundle item type. Available only for bundle bonus item type.
    Enum: "standard", "virtual_currency_package"

  - `promotions.limits` (object)

  - `promotions.limits.per_user` (object)

  - `promotions.limits.per_user.available` (integer)

  - `promotions.limits.per_user.total` (integer)

  - `warnings` (array)

  - `warnings.sku` (string)

  - `warnings.quantity` (integer)

  - `warnings.errorCode` (integer)

  - `warnings.errorMessage` (string)


