> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Create Cart

POST https://your_store.example.com/api/storefront/carts
Content-Type: application/json

Creates a *Cart*.

> #### Note
> * Substitute your storefront domain for `yourstore.example.com`. 
> * The Send a Test Request feature is not currently supported for this endpoint.  

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/storefront/carts/create-cart

## Request

### Query parameters

- `include` (list of enum, optional) — Sub-resources to include in the Cart response, in a comma-separated list. `lineItems.physicalItems.options`: The Cart returns an abbreviated result. Use this to return physical items product options. Can also be used in a /POST to have the extended Cart object return. `lineItems.digitalItems.options`: The Cart returns an abbreviated result. Use this to return digital items product options. Can also be used in a /POST to have the extended Cart object return. `lineItems.digitalItems.options,lineItems.physicalItems.options`: The Cart returns an abbreviated result. Use this to return digital and physical options. Can also be used in a /POST to have the extended Cart object return. `lineItems.physicalItems.stockPosition`: Returns backorder and stock availability details for physical items. `lineItems.digitalItems.stockPosition`: Returns backorder and stock availability details for digital items. Since digital products cannot be backordered, backorder values are always zero.
  - Allowed values: `lineItems.physicalItems.options`, `lineItems.digitalItems.options`, `lineItems.physicalItems.stockPosition`, `lineItems.digitalItems.stockPosition`

### Headers

- `Accept` (string, required, default: application/json) — The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body.

### Body (application/json)

This endpoint expects a requestCart.

- `requestCart`
  - RequestCart0
  - RequestCart1
  - RequestCart2

## Response

### 200

Post Carts Response

- `id` (string, optional) — Cart ID, provided after creating a cart with a POST.
- `customerId` (integer, optional) — ID of the customer to which the cart belongs.
- `email` (string, optional) — The cart's email. This is the same email that is used in the billing address
- `currency` (responseCartCurrency, optional) — This will always be the same between cart and checkout.
- `isTaxIncluded` (boolean, optional) — Whether this item is taxable.
- `baseAmount` (double, optional) — Cost of cart’s contents, before applying discounts.
- `discountAmount` (float, optional) — Order based discounted amount only - Coupon discounts and product based discounts are excluded.
- `cartAmount` (double, optional) — Sum of line-items amounts, minus cart-level discounts and coupons. This amount includes taxes (where applicable).
- `coupons` (list of ResponseCartCouponsItems, optional)
- `discounts` (list of ResponseCartDiscountsItems, optional)
- `lineItems` (responseCartLineItems, optional)
- `createdTime` (string, optional) — Time when the cart was created.
- `updatedTime` (string, optional) — Time when the cart was last updated.
- `locale` (string, optional) — Locale of the cart.
- `version` (integer, optional) — The current version of the cart increments with each successful update. You can use it to enable optimistic concurrency control for subsequent updates.

## Types

### RequestCart0

- `lineItems` (list of requestCartPostLineItem, required)
- `locale` (string, optional)

### RequestCart1

- `giftCertificates` (list of requestLineItemGiftCertificate, required)
- `locale` (string, optional)

### RequestCart2

- `lineItems` (list of requestCartPostLineItem, required)
- `giftCertificates` (list of requestLineItemGiftCertificate, required)
- `locale` (string, optional)

### responseCartCurrency

This will always be the same between cart and checkout.

- `code` (string, optional) — ISO-4217 currency code. (See: https://www.iso.org/iso-4217-currency-codes.html.)
- `decimalPlaces` (integer, optional) — The number of decimal places that prices have when you use the currency.
- `name` (string, optional) — The name for the currency that the merchant entered in the control panel.
- `symbol` (string, optional) — The currency symbol displayed on the storefront.

### ResponseCartCouponsItems

- `code` (string, required) — The coupon code.
- `couponType` (integer, optional) — |Type `int`|Type Name| |-|-| |`0`|`per_item_discount`| |`1`|`percentage_discount`| |`2`|`per_total_discount`| |`3`|`shipping_discount`| |`4`|`free_shipping`| |`5`|`promotion`|
- `discountedAmount` (float, optional) — The discounted amount applied within a given context.
- `displayName` (string, optional) — The coupon name displayed on the storefront.
- `id` (string, optional) — The coupon ID.

### ResponseCartDiscountsItems

- `discountedAmount` (float, optional) — The discounted amount applied within a given context.
- `id` (string, optional) — ID of the applied discount.

### responseCartLineItems

- `customItems` (list of responseCartLineItemsCustomItems, optional)
- `digitalItems` (list of responseCartLineItemsDigitalItems, optional) — Array of `ItemDigital` objects.
- `giftCertificates` (list of responseCartLineItemsGiftCertificates, optional) — Array of `ItemGiftCertificate` objects.
- `physicalItems` (list of responseCartLineItemsItemsPhysicalItemsItems, optional) — Array of `ItemPhysical` objects.

### requestCartPostLineItem

- Simple product: Simple product
- Product with a variant: Product with a variant

### requestLineItemGiftCertificate

- `amount` (double, required) — Gift-certificate amount.
- `name` (string, required) — Name assigned to this gift-certificate line item.
- `quantity` (integer, required) — Quantity of this item.
- `recipient` (requestLineItemGiftCertificateRecipient, required)
- `sender` (requestLineItemGiftCertificateSender, required)
- `theme` (string, required) — Currently supports `Birthday`, `Boy`, `Celebration`, `Christmas`, `General`, and `Girl`.
- `message` (string, optional) — Message shown to recipient, as provided by sender.

### responseCartLineItemsCustomItems

**Read Only** This will return in the Cart Response if the Cart was created using the [REST Management API](/developer/api-reference/rest/admin/management/carts). A custom item can only be added to a cart using the REST Management API.

- `extendedListPrice` (integer, optional)
- `id` (string, optional) — ID of the custom item
- `listPrice` (integer, optional) — Price of the item. With or without tax depending on your stores set up.
- `name` (string, optional) — Name of the custom item.
- `quantity` (integer, optional)
- `sku` (string, optional) — SKU of the custom item.

### responseCartLineItemsDigitalItems

- `quantity` (double, required) — Quantity of this item.
- `brand` (string, optional) — The products brand
- `couponAmount` (double, optional) — The total value of all coupons applied to this item.
- `discountAmount` (float, optional) — The total value of all discounts applied to this item (excluding coupon).
- `discounts` (list of responseCartLineItemsDigitalItemsAllOf0DiscountsItems, optional) — List of discounts applied to this item, as an array of AppliedDiscount objects.
- `extendedListPrice` (double, optional) — Item's list price multiplied by the quantity.
- `extendedSalePrice` (double, optional) — Item's sale price multiplied by the quantity.
- `id` (string, optional) — The line-item ID.
- `imageUrl` (string, optional) — URL of an image of this item, accessible on the internet.
- `isMutable` (boolean, optional) — Whether or not you can change or remove the item from the cart. Items that are immutable include those added automatically by promotions.
- `isTaxable` (boolean, optional) — Whether the item is taxable.
- `listPrice` (double, optional) — The net item price before discounts and coupons. BigCommerce derives an item’s list price from the product default price or, if applicable, the sale price configured in the admin panel.
- `name` (string, optional) — The item's product name.
- `options` (list of responseCartLineItemsDigitalItemsAllOf0OptionsItems, optional) — The list of selected options for this product.
- `originalPrice` (double, optional) — An item’s original price is the same as the product default price in the admin panel.
- `parentId` (string, optional) — The product is part of a bundle such as a product pick list, then the parentId or the main product id will populate.
- `productId` (double, optional) — ID of the product.
- `salePrice` (double, optional) — Item's price after all discounts are applied. (The final price before tax calculation.)
- `sku` (string, optional) — SKU of the variant.
- `stockPosition` (ResponseCartLineItemsDigitalItemsAllOf0StockPosition, optional) — Backorder and stock availability details for this line item. Only returned when explicitly requested via `include=lineItems.digitalItems.stockPosition` — not included by default. Since digital products cannot be backordered, backorder values are always zero for digital items.
- `type` (enum, optional) — The type of line item.
  - Allowed values: `digital`
- `url` (string, optional) — The product URL.
- `variantId` (double, optional) — ID of the variant.

### responseCartLineItemsGiftCertificates

- `amount` (double, required) — Value must be between 1.00 and 1,000.00 in the storeʼs default currency.
- `recipient` (responseCartLineItemsGiftCertificatesRecipient, required)
- `sender` (responseCartLineItemsGiftCertificatesSender, required)
- `theme` (string, required) — Currently supports `Birthday`, `Boy`, `Celebration`, `Christmas`, `General`, and `Girl`.
- `id` (string, optional) — ID of this gift certificate.
- `taxable` (boolean, optional) — Whether or not the gift certificate is taxable.
- `message` (string, optional) — Message that will be sent to the gift certificate's recipient. Limited to 200 characters.
- `name` (string, optional) — Name provided for the gift certificate that appears in the control panel.
- `type` (enum, optional) — The type of line item.
  - Allowed values: `giftCertificate`

### responseCartLineItemsItemsPhysicalItemsItems

- `quantity` (double, required) — Quantity of this item.
- `brand` (string, optional) — The products brand
- `couponAmount` (double, optional) — The total value of all coupons applied to this item.
- `discountAmount` (float, optional) — The total value of all discounts applied to this item (excluding coupon).
- `discounts` (list of ResponseCartDiscountsItems, optional)
- `extendedListPrice` (double, optional) — Item's list price multiplied by the quantity.
- `extendedSalePrice` (double, optional) — Item's sale price multiplied by the quantity.
- `giftWrapping` (responseCartLineItemsPhysicalItemGiftWrapping, optional)
- `id` (string, optional) — The line-item ID.
- `imageUrl` (string, optional) — URL of an image of this item, accessible on the internet.
- `isMutable` (boolean, optional) — Whether or not you can change or remove the item from the cart. Items that are immutable include those added automatically by promotions.
- `isShippingRequired` (boolean, optional) — Whether this item requires shipping to a physical address.
- `isTaxable` (boolean, optional) — Whether the item is taxable.
- `listPrice` (double, optional) — The net item price before discounts and coupons. BigCommerce derives an item’s list price from the product default price or, if applicable, the sale price configured in the admin panel.
- `name` (string, optional) — The item's product name.
- `options` (list of responseCartLineItemsItemsPhysicalItemsItemsAllOf0OptionsItems, optional) — The list of selected options for this product.
- `originalPrice` (double, optional) — An item’s original price is the same as the product default price in the admin panel.
- `parentId` (double, optional) — The product is part of a bundle such as a product pick list, then the parentId or the main product id will populate.
- `productId` (double, optional) — ID of the product.
- `salePrice` (double, optional) — Item's price after all discounts are applied. (The final price before tax calculation.)
- `sku` (string, optional) — SKU of the variant.
- `stockPosition` (ResponseCartBaseItemStockPosition, optional) — Backorder and stock availability details for this line item. Only returned when explicitly requested via `include=lineItems.physicalItems.stockPosition` (or the `digitalItems` equivalent) — not included by default.
- `type` (enum, optional) — The type of line item.
  - Allowed values: `physical`
- `url` (string, optional) — The product URL.
- `variantId` (double, optional) — ID of the variant.

### Simple product

- `productId` (double, required) — ID of the product.
- `quantity` (double, required) — Quantity of this item.
- `optionSelections` (list of RequestCartPostLineItemOneOf0OptionSelectionsItems, optional)
- `giftWrapping` (requestPostOrPutGiftWrapping, optional) — if passing null, it will remove the current gift wrapping for the item

### Product with a variant

- `productId` (double, required) — ID of the product.
- `quantity` (double, required) — Quantity of this item.
- `variantId` (double, optional) — ID of the variant.
- `optionSelections` (list of RequestCartPostLineItemOneOf1OptionSelectionsItems, optional)
- `giftWrapping` (requestPostOrPutGiftWrapping, optional) — if passing null, it will remove the current gift wrapping for the item

### requestLineItemGiftCertificateRecipient

- `email` (string, optional) — Contact's email address.
- `name` (string, optional) — Contact's name.

### requestLineItemGiftCertificateSender

- `email` (string, optional) — Contact's email address.
- `name` (string, optional) — Contact's name.

### responseCartLineItemsDigitalItemsAllOf0DiscountsItems

- `discountedAmount` (float, optional) — The discounted amount applied within a given context.
- `id` (double, optional) — ID of the applied discount.

### responseCartLineItemsDigitalItemsAllOf0OptionsItems

- `name` (string, optional) — The product option name. For example, Color or Size
- `nameId` (double, optional) — The product option identifier. It is the same as the `optionId` used in the request.
- `value` (string, optional) — The product option value. For example, Red or Medium
- `valueId` (double, optional) — The product option value identifier. It is the same as the `optionValue` used in the request.

### ResponseCartLineItemsDigitalItemsAllOf0StockPosition

Backorder and stock availability details for this line item. Only returned when explicitly requested via `include=lineItems.digitalItems.stockPosition` — not included by default. Since digital products cannot be backordered, backorder values are always zero for digital items.

- `quantityOnHand` (integer, optional) — Number of units currently in stock and available to fulfill this line item without backordering.
- `quantityBackordered` (integer, optional) — Number of units from this line item that are fulfilled via backorder.
- `quantityOutOfStock` (integer, optional) — Number of units from this line item that are out of stock and unavailable for backorder.
- `backorderMessage` (string, optional, nullable) — Backorder messaging shown to the customer for this line item. `null` if no backorder message applies.

### responseCartLineItemsGiftCertificatesRecipient

- `email` (string, optional) — Contact's email address.
- `name` (string, optional) — Contact's name.

### responseCartLineItemsGiftCertificatesSender

- `email` (string, optional) — Contact's email address.
- `name` (string, optional) — Contact's name.

### responseCartLineItemsPhysicalItemGiftWrapping

- `amount` (float, optional) — Gift-wrapping price per product.
- `message` (string, optional)
- `name` (string, optional) — Name of the gift-wrapping option.

### responseCartLineItemsItemsPhysicalItemsItemsAllOf0OptionsItems

- `name` (string, optional) — The product option name. For example, Color or Size
- `nameId` (double, optional) — The product option identifier. It is the same as the `optionId` used in the request.
- `value` (string, optional) — The product option value. For example, Red or Medium
- `valueId` (double, optional) — The product option value identifier. It is the same as the `optionValue` used in the request.

### ResponseCartBaseItemStockPosition

Backorder and stock availability details for this line item. Only returned when explicitly requested via `include=lineItems.physicalItems.stockPosition` (or the `digitalItems` equivalent) — not included by default.

- `quantityOnHand` (integer, optional) — Number of units currently in stock and available to fulfill this line item without backordering.
- `quantityBackordered` (integer, optional) — Number of units from this line item that are fulfilled via backorder.
- `quantityOutOfStock` (integer, optional) — Number of units from this line item that are out of stock and unavailable for backorder.
- `backorderMessage` (string, optional, nullable) — Backorder messaging shown to the customer for this line item. `null` if no backorder message applies.

### RequestCartPostLineItemOneOf0OptionSelectionsItems

- `optionId` (integer, optional) — Modifier option ID.
- `optionValue` (RequestCartPostLineItemOneOf0OptionSelectionsItemsOptionValue, optional) — Modifier option value.

### requestPostOrPutGiftWrapping

if passing null, it will remove the current gift wrapping for the item

- `wrapTogether` (boolean, required) — Boolean value that specifies whether items whether items should be wrapped together or wrapped individually.
- `wrapDetails` (list of RequestPostOrPutGiftWrappingWrapDetailsItems, required) — Details for the gift wrapping option selected. This can be specified for each line item or together based on wrapTogether value. If wrapTogether is false, each element in the wrapDetails array determines each item's specific wrapping. (e.g if this line item has 6 quantity, you can pass at maximum 6 elements for the array to spefified each one's wrapping) If wrapTogether is true, we will only use 1st element in the wrapDetails array to determine what to be wrapped

### RequestCartPostLineItemOneOf1OptionSelectionsItems

- `optionId` (integer, optional) — Modifier option ID.
- `optionValue` (RequestCartPostLineItemOneOf1OptionSelectionsItemsOptionValue, optional) — Modifier option value.

### RequestCartPostLineItemOneOf0OptionSelectionsItemsOptionValue

Modifier option value.

- string
- integer

### RequestPostOrPutGiftWrappingWrapDetailsItems

- `id` (integer, required) — Identifier of the gift wrapping option selected.
- `message` (string, optional) — Custom gift message.

### RequestCartPostLineItemOneOf1OptionSelectionsItemsOptionValue

Modifier option value.

- string
- integer

## Examples

### Create a cart

**Request**

```json
{
  "lineItems": [
    {
      "optionSelections": [
        {
          "optionId": 10,
          "optionValue": "Some Text Value"
        }
      ],
      "productId": 230,
      "quantity": 2
    }
  ],
  "locale": "en"
}
```

**Response**

```json
{
  "id": "string",
  "customerId": 1,
  "email": "string",
  "currency": {
    "code": "string",
    "decimalPlaces": 1,
    "name": "US Dollar",
    "symbol": "$"
  },
  "isTaxIncluded": true,
  "baseAmount": 1.1,
  "discountAmount": 1.1,
  "cartAmount": 1.1,
  "coupons": [
    {
      "code": "string",
      "couponType": 1,
      "discountedAmount": 1.1,
      "displayName": "string",
      "id": "string"
    }
  ],
  "discounts": [
    {
      "discountedAmount": 1.1,
      "id": "string"
    }
  ],
  "lineItems": {
    "customItems": [
      {
        "extendedListPrice": 1,
        "id": "f1f3a531-fbcf-439b-bac1-40d5ae5c2bff",
        "listPrice": 10,
        "name": "Custom Item Name",
        "quantity": 1,
        "sku": "SM-456"
      }
    ],
    "digitalItems": [
      {
        "quantity": 1.1,
        "brand": "string",
        "couponAmount": 1.1,
        "discountAmount": 1.1,
        "discounts": [
          {
            "discountedAmount": 1.1,
            "id": 1.1
          }
        ],
        "extendedListPrice": 1.1,
        "extendedSalePrice": 1.1,
        "id": "4",
        "imageUrl": "string",
        "isMutable": true,
        "isTaxable": true,
        "listPrice": 1.1,
        "name": "string",
        "options": [
          {
            "name": "string",
            "nameId": 125,
            "value": "string",
            "valueId": 127
          }
        ],
        "originalPrice": 1.1,
        "parentId": "6",
        "productId": 1.1,
        "salePrice": 1.1,
        "sku": "string",
        "stockPosition": {
          "quantityOnHand": 1,
          "quantityBackordered": 1,
          "quantityOutOfStock": 1,
          "backorderMessage": "string"
        },
        "type": "digital",
        "url": "string",
        "variantId": 7
      }
    ],
    "giftCertificates": [
      {
        "amount": 1.1,
        "recipient": {
          "email": "string",
          "name": "string"
        },
        "sender": {
          "email": "string",
          "name": "string"
        },
        "theme": "string",
        "id": "string",
        "taxable": true,
        "message": "string",
        "name": "string",
        "type": "giftCertificate"
      }
    ],
    "physicalItems": [
      {
        "quantity": 1.1,
        "brand": "string",
        "couponAmount": 1.1,
        "discountAmount": 1.1,
        "discounts": [
          {
            "discountedAmount": 1.1,
            "id": "string"
          }
        ],
        "extendedListPrice": 1.1,
        "extendedSalePrice": 1.1,
        "giftWrapping": {
          "amount": 1.1,
          "message": "string",
          "name": "string"
        },
        "id": "4",
        "imageUrl": "string",
        "isMutable": true,
        "isShippingRequired": true,
        "isTaxable": true,
        "listPrice": 1.1,
        "name": "string",
        "options": [
          {
            "name": "string",
            "nameId": 125,
            "value": "string",
            "valueId": 127
          }
        ],
        "originalPrice": 1.1,
        "parentId": 6,
        "productId": 1.1,
        "salePrice": 1.1,
        "sku": "string",
        "stockPosition": {
          "quantityOnHand": 1,
          "quantityBackordered": 1,
          "quantityOutOfStock": 1,
          "backorderMessage": "string"
        },
        "type": "physical",
        "url": "string",
        "variantId": 7
      }
    ]
  },
  "createdTime": "string",
  "updatedTime": "string",
  "locale": "string",
  "version": 1
}
```

**SDK Code**

```python Create a cart
import requests

url = "https://your_store.example.com/api/storefront/carts"

payload = {
    "lineItems": [
        {
            "optionSelections": [
                {
                    "optionId": 10,
                    "optionValue": "Some Text Value"
                }
            ],
            "productId": 230,
            "quantity": 2
        }
    ],
    "locale": "en"
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create a cart
const url = 'https://your_store.example.com/api/storefront/carts';
const options = {
  method: 'POST',
  headers: {Accept: 'application/json', 'Content-Type': 'application/json'},
  body: '{"lineItems":[{"optionSelections":[{"optionId":10,"optionValue":"Some Text Value"}],"productId":230,"quantity":2}],"locale":"en"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Create a cart
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://your_store.example.com/api/storefront/carts"

	payload := strings.NewReader("{\n  \"lineItems\": [\n    {\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Create a cart
require 'uri'
require 'net/http'

url = URI("https://your_store.example.com/api/storefront/carts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lineItems\": [\n    {\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}"

response = http.request(request)
puts response.read_body
```

```java Create a cart
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://your_store.example.com/api/storefront/carts")
  .header("Accept", "application/json")
  .header("Content-Type", "application/json")
  .body("{\n  \"lineItems\": [\n    {\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}")
  .asString();
```

```php Create a cart
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your_store.example.com/api/storefront/carts', [
  'body' => '{
  "lineItems": [
    {
      "optionSelections": [
        {
          "optionId": 10,
          "optionValue": "Some Text Value"
        }
      ],
      "productId": 230,
      "quantity": 2
    }
  ],
  "locale": "en"
}',
  'headers' => [
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Create a cart
using RestSharp;

var client = new RestClient("https://your_store.example.com/api/storefront/carts");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lineItems\": [\n    {\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a cart
import Foundation

let headers = [
  "Accept": "application/json",
  "Content-Type": "application/json"
]
let parameters = [
  "lineItems": [
    [
      "optionSelections": [
        [
          "optionId": 10,
          "optionValue": "Some Text Value"
        ]
      ],
      "productId": 230,
      "quantity": 2
    ]
  ],
  "locale": "en"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://your_store.example.com/api/storefront/carts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Create a cart with gift wrapping

**Request**

```json
{
  "lineItems": [
    {
      "giftWrapping": {
        "wrapDetails": [
          {
            "id": 1,
            "message": "Happy Birthday"
          }
        ],
        "wrapTogether": true
      },
      "optionSelections": [
        {
          "optionId": 10,
          "optionValue": "Some Text Value"
        }
      ],
      "productId": 230,
      "quantity": 2
    }
  ],
  "locale": "en"
}
```

**Response**

```json
{
  "id": "string",
  "customerId": 1,
  "email": "string",
  "currency": {
    "code": "string",
    "decimalPlaces": 1,
    "name": "US Dollar",
    "symbol": "$"
  },
  "isTaxIncluded": true,
  "baseAmount": 1.1,
  "discountAmount": 1.1,
  "cartAmount": 1.1,
  "coupons": [
    {
      "code": "string",
      "couponType": 1,
      "discountedAmount": 1.1,
      "displayName": "string",
      "id": "string"
    }
  ],
  "discounts": [
    {
      "discountedAmount": 1.1,
      "id": "string"
    }
  ],
  "lineItems": {
    "customItems": [
      {
        "extendedListPrice": 1,
        "id": "f1f3a531-fbcf-439b-bac1-40d5ae5c2bff",
        "listPrice": 10,
        "name": "Custom Item Name",
        "quantity": 1,
        "sku": "SM-456"
      }
    ],
    "digitalItems": [
      {
        "quantity": 1.1,
        "brand": "string",
        "couponAmount": 1.1,
        "discountAmount": 1.1,
        "discounts": [
          {
            "discountedAmount": 1.1,
            "id": 1.1
          }
        ],
        "extendedListPrice": 1.1,
        "extendedSalePrice": 1.1,
        "id": "4",
        "imageUrl": "string",
        "isMutable": true,
        "isTaxable": true,
        "listPrice": 1.1,
        "name": "string",
        "options": [
          {
            "name": "string",
            "nameId": 125,
            "value": "string",
            "valueId": 127
          }
        ],
        "originalPrice": 1.1,
        "parentId": "6",
        "productId": 1.1,
        "salePrice": 1.1,
        "sku": "string",
        "stockPosition": {
          "quantityOnHand": 1,
          "quantityBackordered": 1,
          "quantityOutOfStock": 1,
          "backorderMessage": "string"
        },
        "type": "digital",
        "url": "string",
        "variantId": 7
      }
    ],
    "giftCertificates": [
      {
        "amount": 1.1,
        "recipient": {
          "email": "string",
          "name": "string"
        },
        "sender": {
          "email": "string",
          "name": "string"
        },
        "theme": "string",
        "id": "string",
        "taxable": true,
        "message": "string",
        "name": "string",
        "type": "giftCertificate"
      }
    ],
    "physicalItems": [
      {
        "quantity": 1.1,
        "brand": "string",
        "couponAmount": 1.1,
        "discountAmount": 1.1,
        "discounts": [
          {
            "discountedAmount": 1.1,
            "id": "string"
          }
        ],
        "extendedListPrice": 1.1,
        "extendedSalePrice": 1.1,
        "giftWrapping": {
          "amount": 1.1,
          "message": "string",
          "name": "string"
        },
        "id": "4",
        "imageUrl": "string",
        "isMutable": true,
        "isShippingRequired": true,
        "isTaxable": true,
        "listPrice": 1.1,
        "name": "string",
        "options": [
          {
            "name": "string",
            "nameId": 125,
            "value": "string",
            "valueId": 127
          }
        ],
        "originalPrice": 1.1,
        "parentId": 6,
        "productId": 1.1,
        "salePrice": 1.1,
        "sku": "string",
        "stockPosition": {
          "quantityOnHand": 1,
          "quantityBackordered": 1,
          "quantityOutOfStock": 1,
          "backorderMessage": "string"
        },
        "type": "physical",
        "url": "string",
        "variantId": 7
      }
    ]
  },
  "createdTime": "string",
  "updatedTime": "string",
  "locale": "string",
  "version": 1
}
```

**SDK Code**

```python Create a cart with gift wrapping
import requests

url = "https://your_store.example.com/api/storefront/carts"

payload = {
    "lineItems": [
        {
            "giftWrapping": {
                "wrapDetails": [
                    {
                        "id": 1,
                        "message": "Happy Birthday"
                    }
                ],
                "wrapTogether": True
            },
            "optionSelections": [
                {
                    "optionId": 10,
                    "optionValue": "Some Text Value"
                }
            ],
            "productId": 230,
            "quantity": 2
        }
    ],
    "locale": "en"
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create a cart with gift wrapping
const url = 'https://your_store.example.com/api/storefront/carts';
const options = {
  method: 'POST',
  headers: {Accept: 'application/json', 'Content-Type': 'application/json'},
  body: '{"lineItems":[{"giftWrapping":{"wrapDetails":[{"id":1,"message":"Happy Birthday"}],"wrapTogether":true},"optionSelections":[{"optionId":10,"optionValue":"Some Text Value"}],"productId":230,"quantity":2}],"locale":"en"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Create a cart with gift wrapping
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://your_store.example.com/api/storefront/carts"

	payload := strings.NewReader("{\n  \"lineItems\": [\n    {\n      \"giftWrapping\": {\n        \"wrapDetails\": [\n          {\n            \"id\": 1,\n            \"message\": \"Happy Birthday\"\n          }\n        ],\n        \"wrapTogether\": true\n      },\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Create a cart with gift wrapping
require 'uri'
require 'net/http'

url = URI("https://your_store.example.com/api/storefront/carts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lineItems\": [\n    {\n      \"giftWrapping\": {\n        \"wrapDetails\": [\n          {\n            \"id\": 1,\n            \"message\": \"Happy Birthday\"\n          }\n        ],\n        \"wrapTogether\": true\n      },\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}"

response = http.request(request)
puts response.read_body
```

```java Create a cart with gift wrapping
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://your_store.example.com/api/storefront/carts")
  .header("Accept", "application/json")
  .header("Content-Type", "application/json")
  .body("{\n  \"lineItems\": [\n    {\n      \"giftWrapping\": {\n        \"wrapDetails\": [\n          {\n            \"id\": 1,\n            \"message\": \"Happy Birthday\"\n          }\n        ],\n        \"wrapTogether\": true\n      },\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}")
  .asString();
```

```php Create a cart with gift wrapping
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your_store.example.com/api/storefront/carts', [
  'body' => '{
  "lineItems": [
    {
      "giftWrapping": {
        "wrapDetails": [
          {
            "id": 1,
            "message": "Happy Birthday"
          }
        ],
        "wrapTogether": true
      },
      "optionSelections": [
        {
          "optionId": 10,
          "optionValue": "Some Text Value"
        }
      ],
      "productId": 230,
      "quantity": 2
    }
  ],
  "locale": "en"
}',
  'headers' => [
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Create a cart with gift wrapping
using RestSharp;

var client = new RestClient("https://your_store.example.com/api/storefront/carts");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lineItems\": [\n    {\n      \"giftWrapping\": {\n        \"wrapDetails\": [\n          {\n            \"id\": 1,\n            \"message\": \"Happy Birthday\"\n          }\n        ],\n        \"wrapTogether\": true\n      },\n      \"optionSelections\": [\n        {\n          \"optionId\": 10,\n          \"optionValue\": \"Some Text Value\"\n        }\n      ],\n      \"productId\": 230,\n      \"quantity\": 2\n    }\n  ],\n  \"locale\": \"en\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a cart with gift wrapping
import Foundation

let headers = [
  "Accept": "application/json",
  "Content-Type": "application/json"
]
let parameters = [
  "lineItems": [
    [
      "giftWrapping": [
        "wrapDetails": [
          [
            "id": 1,
            "message": "Happy Birthday"
          ]
        ],
        "wrapTogether": true
      ],
      "optionSelections": [
        [
          "optionId": 10,
          "optionValue": "Some Text Value"
        ]
      ],
      "productId": 230,
      "quantity": 2
    ]
  ],
  "locale": "en"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://your_store.example.com/api/storefront/carts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```