Skip to main content
POST
/
v2
/
carts
/
{cartId}
/
order-drafts
Create order draft
curl --request POST \
  --url https://prod.cart.fabric.inc/v2/carts/{cartId}/order-drafts \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data @- <<EOF
{
  "paymentDetails": [
    {
      "connectorName": "Authorizenet",
      "paymentToken": 534234543,
      "amount": 10.5,
      "currency": "USD",
      "conversion": 0.5,
      "billToAddress": {
        "street1": "100 NE 100th St.",
        "city": "Seattle",
        "state": "Washington",
        "country": "USA",
        "postalCode": "98125",
        "customerId": 98121,
        "name": {
          "first": "Pat",
          "middle": "E",
          "last": "Kake"
        },
        "phone": {
          "number": "123-456-7899",
          "kind": "MOBILE"
        },
        "email": "[email protected]",
        "street2": "Suite 710",
        "street3": "Seventh floor",
        "street4": "Attention: Pat E. Kake",
        "type": "Residence",
        "latitude": 35.294952,
        "longitude": 32.294952
      },
      "paymentMethod": "card",
      "paymentMethodType": "tamara or tabby",
      "attributes": {
        "Attribute1": "620d8896058edb0009385311"
      }
    }
  ],
  "estimatedTax": {
    "itemsTaxes": [
      {
        "type": "state_tax",
        "amount": 2.5,
        "rateType": "rateType",
        "rate": 10,
        "lineItemId": 1
      }
    ],
    "shipToTaxes": [
      {
        "shipToId": "a1b26d22-cad2-6242-a2b4-e3c4282bad4",
        "type": "state_tax",
        "amount": 2.5,
        "rateType": "rateType",
        "rate": 10
      }
    ],
    "feeTaxes": [
      {
        "feeId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",
        "type": "state_tax",
        "amount": 2.5,
        "rateType": "rateType",
        "rate": 10
      }
    ]
  },
  "orderNumber": 123123123,
  "orderSequence": {
    "sequenceName": "ORDER_NUMBER_SEQUENCE",
    "sequenceKey": "WHBM"
  },
  "customer": {
    "id": "8fb78749",
    "type": "employee",
    "segments": "{subscription: ['premium']}",
    "attributes": "{email: [email protected]}"
  },
  "orderType": "WEB",
  "orderSubType": "Android"
}
EOF
{
  "cartId": "b8a64b52-dab4-8137-8d6a-f2c2337abc1",
  "orderStatus": {
    "paymentStatus": "<unknown>",
    "ready": true
  },
  "orderTotal": 60,
  "orderSubTotal": 60,
  "taxTotal": 60,
  "orderDiscount": 60,
  "currency": "USD",
  "createdAt": "2022-02-18T15:12:40.974580",
  "items": [
    {
      "itemId": "1000000001",
      "sku": "16B2GS8LD5FDS",
      "items": [
        {
          "sku": "13B9CL6WT2SLW",
          "quantity": 15,
          "items": [
            "<unknown>"
          ],
          "cartItemId": "12gved0f-7645-40cb-y7b0-167f8bggdb3z",
          "itemId": "1730902008",
          "title": "Light Cover",
          "attributes": [
            {
              "attributeId": "60c2a358eb2ec30008ae70a1",
              "name": "gift wrapping (small)",
              "type": "GIFT",
              "price": 10,
              "description": "Gift wrapping for a small package",
              "mapping": "ITEM",
              "value": "true",
              "level": "order",
              "items": [
                "1000000001"
              ]
            }
          ],
          "createdAt": "2022-02-18T15:12:40.974580",
          "updatedAt": "2022-02-18T15:12:40.974580",
          "type": "WEB_SHIP",
          "subType": "Border-free",
          "priceListId": "108674",
          "lineItemId": 1,
          "isActive": true,
          "unitPrice": {
            "currency": "USD",
            "amount": 100,
            "discount": {
              "price": 80,
              "promosApplied": [
                {
                  "promoId": "fza065tdr787",
                  "promoCode": "coupon123",
                  "value": "20",
                  "unit": "%OFF"
                }
              ],
              "discounts": [
                {
                  "promoId": "fza065tdr787",
                  "promoCode": "coupon123",
                  "promoTitle": "New Year discount",
                  "quantity": 1,
                  "amount": 20,
                  "value": 20,
                  "groupId": "new-items",
                  "promotionType": "PROMOTION",
                  "priority": 1,
                  "stackable": false,
                  "sku": "16B2GS8LD5FDS",
                  "itemId": "1000000001",
                  "itemKey": "Key1234",
                  "message": "New Year Promotion",
                  "unit": "%OFF",
                  "proratedQuantity": 1,
                  "proratedAmount": 3.33
                }
              ],
              "discountAmount": 20
            },
            "sale": 80
          },
          "totalPrice": {
            "currency": "USD",
            "amount": 100,
            "discount": {
              "price": 80,
              "promosApplied": [
                {
                  "promoId": "fza065tdr787",
                  "promoCode": "coupon123",
                  "value": "20",
                  "unit": "%OFF"
                }
              ],
              "discounts": [
                {
                  "promoId": "fza065tdr787",
                  "promoCode": "coupon123",
                  "promoTitle": "New Year discount",
                  "quantity": 1,
                  "amount": 20,
                  "value": 20,
                  "groupId": "new-items",
                  "promotionType": "PROMOTION",
                  "priority": 1,
                  "stackable": false,
                  "sku": "16B2GS8LD5FDS",
                  "itemId": "1000000001",
                  "itemKey": "Key1234",
                  "message": "New Year Promotion",
                  "unit": "%OFF",
                  "proratedQuantity": 1,
                  "proratedAmount": 3.33
                }
              ],
              "discountAmount": 20
            },
            "sale": 80
          },
          "attributeTotalPrice": 10,
          "group": [
            "61d38e117162b7dba69c3d6d"
          ],
          "extra": {
            "productFamily": "Laptop computers"
          },
          "channel": 12,
          "isPickup": true,
          "warehouseId": "XYZ-1234",
          "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",
          "shipTo": {
            "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",
            "cartId": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",
            "createdAt": "2022-02-18T15:12:40.974580",
            "updatedAt": "2022-02-18T15:12:40.974580",
            "shipMethod": {
              "cost": {
                "amount": 10,
                "currency": "USD",
                "discount": 5
              },
              "shipMethodId": "1234",
              "shipmentCarrier": "FedEx",
              "shipmentMethod": "Next Day"
            },
            "address": {
              "attention": "Billing manager",
              "street1": "100 NE 100th St.",
              "street2": "Suite 710",
              "street3": "Seventh floor",
              "street4": "Attention: Pat E. Kake",
              "city": "Seattle",
              "state": "Washington",
              "country": "USA",
              "zipCode": "98125",
              "email": "[email protected]",
              "kind": "shipping",
              "name": {
                "first": "Pat",
                "middle": "E",
                "last": "Kake"
              },
              "phone": {
                "number": "123-456-7899",
                "kind": "MOBILE"
              }
            },
            "shipToType": "SHIP_TO_ADDRESS",
            "taxCode": "FR1000",
            "isPickup": true,
            "altPickupPerson": {
              "name": {
                "first": "Pat",
                "middle": "E",
                "last": "Kake"
              },
              "phone": {
                "number": "123-456-7899",
                "kind": "MOBILE"
              },
              "email": "[email protected]"
            },
            "pickupPerson": {
              "name": {
                "first": "Pat",
                "middle": "E",
                "last": "Kake"
              },
              "phone": {
                "number": "123-456-7899",
                "kind": "MOBILE"
              },
              "email": "[email protected]"
            },
            "warehouseId": "XYZ-1234",
            "storeId": "ABC-123"
          },
          "fulfillment": {
            "type": "WEB_SHIP",
            "networkCode": "ShipToCNC",
            "channelId": "12",
            "inventoryType": "availablePreorder",
            "inventory": {
              "virtualCounters": {
                "availableToPurchase": 10
              },
              "id": "62272e917b12209e68751d94",
              "sku": "SKU00025",
              "itemId": 4225678911,
              "locationNum": 473746,
              "channelId": 12,
              "vendorId": "vendor123",
              "leadTime": 1234,
              "inventoryType": "Safety stock",
              "infiniteInventory": true,
              "counters": {
                "on-hand": 10
              },
              "attributes": {
                "buy online, pick up in-store (bopis)": true
              },
              "backOrderDate": "2022-08-08T00:00:00.000Z",
              "preOrderDate": "2022-08-08T00:00:00.000Z",
              "backOrderLimit": 100,
              "preOrderLimit": 100,
              "safetyStock": 10,
              "lowStock": 10,
              "segment": "Clothing",
              "region": "US"
            }
          }
        }
      ],
      "quantity": 1,
      "lineItemId": 1,
      "isPickup": true,
      "cartItemId": "88cded0f-1439-40eb-a7a0-167e8bffdb3b",
      "title": "Varnet Garden Light Kit",
      "attributeTotalPrice": 10,
      "createdAt": "2022-02-18T15:12:40.974580",
      "updatedAt": "2022-02-18T15:12:40.974580",
      "priceListId": "100000",
      "isActive": true,
      "unitPrice": {
        "currency": "USD",
        "amount": 100,
        "discount": {
          "price": 80,
          "promosApplied": [
            {
              "promoId": "fza065tdr787",
              "promoCode": "coupon123",
              "value": "20",
              "unit": "%OFF"
            }
          ],
          "discounts": [
            {
              "promoId": "fza065tdr787",
              "promoCode": "coupon123",
              "promoTitle": "New Year discount",
              "quantity": 1,
              "amount": 20,
              "value": 20,
              "groupId": "new-items",
              "promotionType": "PROMOTION",
              "priority": 1,
              "stackable": false,
              "sku": "16B2GS8LD5FDS",
              "itemId": "1000000001",
              "itemKey": "Key1234",
              "message": "New Year Promotion",
              "unit": "%OFF",
              "proratedQuantity": 1,
              "proratedAmount": 3.33
            }
          ],
          "discountAmount": 20
        },
        "sale": 80
      },
      "totalPrice": {
        "currency": "USD",
        "amount": 100,
        "discount": {
          "price": 80,
          "promosApplied": [
            {
              "promoId": "fza065tdr787",
              "promoCode": "coupon123",
              "value": "20",
              "unit": "%OFF"
            }
          ],
          "discounts": [
            {
              "promoId": "fza065tdr787",
              "promoCode": "coupon123",
              "promoTitle": "New Year discount",
              "quantity": 1,
              "amount": 20,
              "value": 20,
              "groupId": "new-items",
              "promotionType": "PROMOTION",
              "priority": 1,
              "stackable": false,
              "sku": "16B2GS8LD5FDS",
              "itemId": "1000000001",
              "itemKey": "Key1234",
              "message": "New Year Promotion",
              "unit": "%OFF",
              "proratedQuantity": 1,
              "proratedAmount": 3.33
            }
          ],
          "discountAmount": 20
        },
        "sale": 80
      },
      "attributes": [
        {
          "attributeId": "60c2a358eb2ec30008ae70a1",
          "name": "gift wrapping (small)",
          "type": "GIFT",
          "price": 10,
          "description": "Gift wrapping for a small package",
          "mapping": "ITEM",
          "value": "true",
          "level": "order",
          "items": [
            "1000000001"
          ]
        }
      ],
      "priceAdjustments": [
        {
          "id": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",
          "reason": "compensation for delay",
          "amount": 20,
          "attributes": {
            "goldMember": [
              false
            ]
          }
        }
      ],
      "warehouseId": "XYZ-1234",
      "shipTo": {
        "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",
        "cartId": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",
        "createdAt": "2022-02-18T15:12:40.974580",
        "updatedAt": "2022-02-18T15:12:40.974580",
        "shipMethod": {
          "cost": {
            "amount": 10,
            "currency": "USD",
            "discount": 5
          },
          "shipMethodId": "1234",
          "shipmentCarrier": "FedEx",
          "shipmentMethod": "Next Day"
        },
        "address": {
          "attention": "Billing manager",
          "street1": "100 NE 100th St.",
          "street2": "Suite 710",
          "street3": "Seventh floor",
          "street4": "Attention: Pat E. Kake",
          "city": "Seattle",
          "state": "Washington",
          "country": "USA",
          "zipCode": "98125",
          "email": "[email protected]",
          "kind": "shipping",
          "name": {
            "first": "Pat",
            "middle": "E",
            "last": "Kake"
          },
          "phone": {
            "number": "123-456-7899",
            "kind": "MOBILE"
          }
        },
        "shipToType": "SHIP_TO_ADDRESS",
        "taxCode": "FR1000",
        "isPickup": true,
        "altPickupPerson": {
          "name": {
            "first": "Pat",
            "middle": "E",
            "last": "Kake"
          },
          "phone": {
            "number": "123-456-7899",
            "kind": "MOBILE"
          },
          "email": "[email protected]"
        },
        "pickupPerson": {
          "name": {
            "first": "Pat",
            "middle": "E",
            "last": "Kake"
          },
          "phone": {
            "number": "123-456-7899",
            "kind": "MOBILE"
          },
          "email": "[email protected]"
        },
        "warehouseId": "XYZ-1234",
        "storeId": "ABC-123"
      },
      "channel": 12,
      "group": [
        "61d38e117162b7dba69c3d6d"
      ],
      "fees": [
        {
          "feeId": "73bc09d0-874a-4c3d-84d0-df1670d03578",
          "name": "gift",
          "type": "gift_wrap",
          "amount": 10.5,
          "attributes": "{'from': 'sam', 'to': 'david' }"
        }
      ],
      "type": "WEB_SHIP",
      "subType": "Borderfree",
      "uom": "ITEM",
      "itemTaxTotal": 123,
      "taxCode": "FR1000",
      "taxDetail": {
        "type": "state_tax",
        "amount": 2.5,
        "rateType": "rateType",
        "rate": 10
      }
    }
  ],
  "shipInfo": [
    {
      "shipToId": "fef78121-bee3-4448-bf1c-d5b5461dbda2",
      "cartId": "d7e78a21-bee3-4448-bf1c-d5b5461dbda2",
      "createdAt": "2022-02-18T15:12:40.974580",
      "updatedAt": "2022-02-18T15:12:40.974580",
      "shipMethod": {
        "cost": {
          "amount": 10,
          "currency": "USD",
          "discount": 5
        },
        "shipMethodId": "1234",
        "shipmentCarrier": "FedEx",
        "shipmentMethod": "Next Day"
      },
      "address": {
        "attention": "Billing manager",
        "street1": "100 NE 100th St.",
        "street2": "Suite 710",
        "street3": "Seventh floor",
        "street4": "Attention: Pat E. Kake",
        "city": "Seattle",
        "state": "Washington",
        "country": "USA",
        "zipCode": "98125",
        "email": "[email protected]",
        "kind": "shipping",
        "name": {
          "first": "Pat",
          "middle": "E",
          "last": "Kake"
        },
        "phone": {
          "number": "123-456-7899",
          "kind": "MOBILE"
        }
      },
      "shipToType": "SHIP_TO_ADDRESS",
      "taxCode": "FR1000",
      "isPickup": true,
      "altPickupPerson": {
        "name": {
          "first": "Pat",
          "middle": "E",
          "last": "Kake"
        },
        "phone": {
          "number": "123-456-7899",
          "kind": "MOBILE"
        },
        "email": "[email protected]"
      },
      "pickupPerson": {
        "name": {
          "first": "Pat",
          "middle": "E",
          "last": "Kake"
        },
        "phone": {
          "number": "123-456-7899",
          "kind": "MOBILE"
        },
        "email": "[email protected]"
      },
      "warehouseId": "XYZ-1234",
      "storeId": "ABC-123",
      "estimatedShipDate": "2022-02-18T15:12:40.974580",
      "estimatedDeliveryDate": "2022-02-18T15:12:40.974580",
      "shipmentInstructions": "Additional user instructions for shipping"
    }
  ],
  "orderNumber": 123123123,
  "orderType": "WEB",
  "orderSubType": "Android",
  "customer": {
    "id": "8fb78749",
    "type": "employee",
    "segments": "{subscription: ['premium']}",
    "attributes": "{email: [email protected]}"
  },
  "attributes": {
    "approver": "620d8896058edb0009385311"
  },
  "payments": [
    {
      "connectorName": "Authorizenet",
      "paymentToken": 534234543,
      "amount": 10.5,
      "currency": "USD",
      "conversion": 0.5,
      "billToAddress": {
        "street1": "100 NE 100th St.",
        "city": "Seattle",
        "state": "Washington",
        "country": "USA",
        "postalCode": "98125",
        "customerId": 98121,
        "name": {
          "first": "Pat",
          "middle": "E",
          "last": "Kake"
        },
        "phone": {
          "number": "123-456-7899",
          "kind": "MOBILE"
        },
        "email": "[email protected]",
        "street2": "Suite 710",
        "street3": "Seventh floor",
        "street4": "Attention: Pat E. Kake",
        "type": "Residence",
        "latitude": 35.294952,
        "longitude": 32.294952
      },
      "paymentMethod": "card",
      "paymentMethodType": "tamara or tabby",
      "attributes": {
        "Attribute1": "620d8896058edb0009385311"
      }
    }
  ],
  "accountId": "5f689caa4216e7000750d1ef",
  "totalItems": 3,
  "totalUniqueItems": 2,
  "configuration": {
    "allowAnonymousUser": true,
    "orderNumberSource": "CART_ID",
    "softReserve": false,
    "addItemBySku": false,
    "inventory": {
      "source": "FABRIC",
      "ttl": 60,
      "newItemBehaviour": "BLOCK",
      "updateItemBehaviour": "BLOCK",
      "viewItemBehaviour": "BLOCK",
      "expiredDataBehaviour": "BLOCK"
    }
  },
  "fees": [
    {
      "feeId": "73bc09d0-874a-4c3d-84d0-df1670d03578",
      "name": "gift",
      "type": "gift_wrap",
      "amount": 10.5,
      "attributes": "{'from': 'sam', 'to': 'david' }"
    }
  ],
  "orderTotalFees": 60,
  "error": {
    "code": "UNKNOWN_ERROR",
    "detail": "Item is out of stock",
    "itemId": "1000000001",
    "sku": "16B2GS8LD5FDS",
    "lineItemId": 1
  }
}

Headers

x-site-context
string
required

The x-site-context header is a JSON object that contains information about the source you wish to pull from. The mandatory account is the 24 character identifier found in Copilot. The channel (Sales channel ID), stage (environment name), and date attributes can be used to further narrow the scope of your data source.

Example:

"{\"date\": \"2023-01-01T00:00:00.000Z\", \"channel\": 12, \"account\": \"1234abcd5678efgh9ijklmno\",\"stage\":\"production\"}"

Path Parameters

cartId
string
required

ID of the cart for which order draft will be generated

Example:

"d7e78a21-bee3-4448-bf1c-d5b5461dbda2"

Body

application/json

Request body to create order draft

Sample request to create order draft

paymentDetails
object[]
required

Payment details

estimatedTax
object
required

Estimated tax object

orderNumber
string | null

Order number

Example:

123123123

orderSequence
object

Order sequence details

customer
object

Customer details

orderType
string | null

Order type (WEB, CSC, MOBILE_APP, POS)

Example:

"WEB"

orderSubType
string | null

Order sub type (Android/IOS/International)

Example:

"Android"

Response

OK

Order draft response

cartId
string
required

Cart ID

Example:

"b8a64b52-dab4-8137-8d6a-f2c2337abc1"

orderStatus
object
required
orderTotal
number<double>
required

Total amount for the order

Example:

60

orderSubTotal
number<double>
required

Total amount for the order without discounts

Example:

60

taxTotal
number<double>
required

Total tax applied on the order

Example:

60

orderDiscount
number<double>
required

Total discount applied on the order

Example:

60

currency
string
required

Currency code

Example:

"USD"

createdAt
string<date-time>
required

Time order draft was created

Example:

"2022-02-18T15:12:40.974580"

items
object[]
required
shipInfo
object[]
required
orderNumber
string | null

Order number

Example:

123123123

orderType
string | null

Order type (WEB, CSC, MOBILE_APP, POS)

Example:

"WEB"

orderSubType
string | null

Order sub type (Android/IOS/International)

Example:

"Android"

customer
object

Customer details

attributes
object

Cart metadata

Example:
{ "approver": "620d8896058edb0009385311" }
payments
object[] | null
accountId
string | null

Customer account ID

Example:

"5f689caa4216e7000750d1ef"

totalItems
integer<int32> | null

Total number of items in the cart

Example:

3

totalUniqueItems
integer<int32> | null

Total number of unique line items in the cart

Example:

2

configuration
object

Cart configuration

fees
object[] | null

Fees associated with a specific cart or an individual line item of a cart

orderTotalFees
number<double> | null

Total fees applied on the order

Example:

60

error
object

Exception details error object