Skip to main content
This feature in Carts API enables the cart to be transformed into a schema ready for submission to the Order Management System (OMS), representing the order draft stage before the order is officially created. At this stage, the cart contains all necessary data, including items, fulfillment details, fees, taxes, and payment information. This transformation ensures that the cart aligns with OMS requirements, allowing for final review and confirmation of the order before proceeding to fulfillment.

Prerequisites

There are two types prerequisites, depending on your cart configurations. One of the following prerequisites must be completed sequentially to configure an order draft.
"configuration": {
    "order": {
        "validate": {
            "paymentsRemaining": "BLOCK",
            "taxRemaining": "BLOCK",
            "invalidItem": "BLOCK",
            "itemOutOfStock": "BLOCK"
        }
    }
}
Prerequisites
  1. Create a cart.
  2. Add item to the cart.
  3. Add taxes to the resources in the cart.
  4. Add payments to the cart, ensuring they match the cart total.
  5. Ensure that the items added to the cart are valid and in stock.
"configuration": {
    "order": {
        "validate": {
            "paymentsRemaining": "BLOCK",
            "taxRemaining": "BLOCK",
            "invalidItem": "BLOCK",
            "itemOutOfStock": "BLOCK"
        }
    }
}
Prerequisites
  1. Create a cart.
  2. Add item to the cart.

Order Drafts Initialization

The order draft captures a snapshot of the cart, which can then be converted into an order. The ability to create an order draft is controlled by cart configurations. Cart offers users the flexibility to prevent order draft creation if:
  • Payments haven’t been added to the cart.
  • Taxes are missing for resources in the cart.
  • Items are invalid.
  • Items are out of stock.
The following code sample provides the structure of order draft settings that block creation in the response:

Cart configuration

"configuration": {
    "order": {
        "validate": {
            "paymentsRemaining": "BLOCK",
            "taxRemaining": "BLOCK",
            "invalidItem": "BLOCK",
            "itemOutOfStock": "BLOCK"
        }
    }
}

Examples

Creating an order draft to send to an order management system (OMS)

Use the create an order draft endpoint to create an order draft and send it to OMS as in the following example:
    curl --location '{{orchestrator_domain}}/carts/{{cartId}}/order-draft' \
    --header 'x-fabric-tenant-id: {tenantId}' \
    --header 'x-fabric-request-id: {{requestId}}' \
    --header 'x-fabric-channel-id: {{channelId}}' \
    --header 'Authorization: {authToken}' \
    --header 'Content-Type: application/json'
    --data '{
        "orderNumber": "W0013"
    }'
Response
    {
        "order": {
            "number": "W0013",
            "currency": "USD",
            "createdAt": "2024-06-24T09:22:40.979+00:00",
            "attributes": {}
        },
        "cartId": "39ea2154-7160-4feb-ae42-1506223efd95",
        "attributes": {
            "name": "cart test",
            "description": "This cart is created by cart v2 service"
        },
        "customerContext": {
            "id": "C01",
            "segments": [
                {
                    "name": "membership",
                    "value": [
                        "premium"
                    ]
                },
                {
                    "name": "customer-type",
                    "value": [
                        "high"
                    ]
                }
            ],
            "attributes": {
                "returnRate": "high",
                "city": "london",
                "type": "regular"
            }
        },
        "status": "ACTIVE",
        "state": [
            {
                "resource": "VALIDATION",
                "resourceId": "",
                "key": "PROMOTION_REFRESH",
                "description": "Promotions require a refresh in the Cart"
            },
            {
                "resource": "CART",
                "resourceId": "HAPPY10",
                "key": "COUPON_NOT_APPLIED",
                "description": "Coupon HAPPY10 has no associated promotion"
            }
        ],
        "price": {
            "total": 1180.19,
            "subtotal": 1043,
            "tax": 97.19,
            "fulfillments": 40,
            "discounts": 0,
            "fees": 25,
            "adjustments": 12
        },
        "promotions": {
            "total": 0,
            "collection": [
                {
                    "id": "6626c179627d450008a5b202",
                    "title": "SXP Cart Promotion Fixed Price",
                    "type": "QUANTITY",
                    "value": 10,
                    "attributes": {}
                },
                {
                    "id": "64959a4b2341cd00080ca746",
                    "title": "happy10 coupon",
                    "code": "HAPPY10",
                    "type": "PRODUCT",
                    "value": 103,
                    "attributes": {}
                },
                {
                    "id": "662a7a5c65c3c7000cff7c4a",
                    "title": "SXP Cart Promotion Item Free",
                    "type": "BUYGET",
                    "value": 3.9,
                    "attributes": {}
                },
                {
                    "id": "6626e327fc29c3000858c6e6",
                    "title": "SXP Cart Promotion Percentage Off",
                    "type": "QUANTITY",
                    "value": 515,
                    "attributes": {}
                }
            ]
        },
        "fees": {
            "total": 15,
            "collection": [
                {
                    "id": "9db3ed22-9a71-47c7-844e-bd42e28319c2",
                    "name": "cart v3 fees",
                    "price": {
                        "amount": 15
                    },
                    "taxable": true,
                    "attributes": {
                        "message": "gifting-fee"
                    },
                    "tax": {
                        "total": 1.33,
                        "collection": [
                            {
                                "amount": 0.6,
                                "attributes": {
                                    "taxRate": 0.04,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "NEW YORK",
                                        "jurisdictionType": "STATE",
                                        "jurisdictionId": "24354"
                                    }
                                }
                            },
                            {
                                "amount": 0.67,
                                "attributes": {
                                    "taxRate": 0.045,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "NEW YORK",
                                        "jurisdictionType": "CITY",
                                        "jurisdictionId": "25353"
                                    }
                                }
                            },
                            {
                                "amount": 0.06,
                                "attributes": {
                                    "taxRate": 0.00375,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "METROPOLITAN COMMUTER TRANSPORTATION DISTRICT",
                                        "jurisdictionType": "DISTRICT",
                                        "jurisdictionId": "79774"
                                    }
                                }
                            }
                        ]
                    },
                    "updatedAt": "2024-06-24T09:07:50.155Z",
                    "createdAt": "2024-06-24T09:07:50.155Z"
                }
            ]
        },
        "adjustments": {
            "total": 7,
            "collection": [
                {
                    "id": "c18aa476-97a7-4f31-a2ae-528adb3d6e84",
                    "price": {
                        "amount": 7
                    },
                    "reason": "DelayedOrder",
                    "attributes": {
                        "reasonDescription": "Price Adjustment due to delayed shipping"
                    },
                    "updatedAt": "2024-06-24T09:07:51.960Z",
                    "createdAt": "2024-06-24T09:07:51.960Z"
                }
            ]
        },
        "addresses": {
            "476e673c-10c1-4bd6-b83d-26d403b5a735": {
                "id": "476e673c-10c1-4bd6-b83d-26d403b5a735",
                "name": {
                    "first": "Jane",
                    "last": "Doe"
                },
                "email": "jane.doe@gmail.com",
                "phone": {
                    "number": "9050123102",
                    "type": "MOBILE"
                },
                "addressLine1": "888 Broadway",
                "addressLine2": "Street 2",
                "addressLine3": "Stars Hollow",
                "city": "New York",
                "region": "NY",
                "country": "US",
                "postalCode": "10003",
                "updatedAt": "2024-06-24T09:07:41.463Z",
                "createdAt": "2024-06-24T09:07:41.463Z"
            },
            "9f615749-35ef-43e7-adfc-3369eb3b05e8": {
                "id": "9f615749-35ef-43e7-adfc-3369eb3b05e8",
                "name": {
                    "first": "Joe",
                    "last": "Cooper"
                },
                "email": "joe.cooper@mail.com",
                "phone": {
                    "number": "+1-5807769338",
                    "type": "MOBILE"
                },
                "addressLine1": "92 Landon",
                "addressLine2": "Street 1",
                "addressLine3": "5th Avenue",
                "city": "New York",
                "region": "NY",
                "country": "US",
                "postalCode": "10006",
                "updatedAt": "2024-06-24T09:07:43.138Z",
                "createdAt": "2024-06-24T09:07:43.138Z"
            }
        },
        "lineItems": {
            "total": 1035,
            "collection": [
                {
                    "id": "75c41689-7bc5-4775-8d72-c7821d38ed9c",
                    "sku": "SKU2",
                    "refId": "41",
                    "quantity": 2,
                    "priceListId": "100000",
                    "position": 1,
                    "price": {
                        "unit": 500,
                        "amount": 1000
                    },
                    "fees": {
                        "total": 10,
                        "collection": [
                            {
                                "id": "e3a734c6-d496-43e2-8912-881b44d5f083",
                                "name": "giftingFee",
                                "price": {
                                    "amount": 10
                                },
                                "taxable": true,
                                "attributes": {
                                    "message": "regular"
                                },
                                "tax": {
                                    "total": 0.89,
                                    "collection": [
                                        {
                                            "amount": 0.4,
                                            "attributes": {
                                                "taxRate": 0.04,
                                                "taxType": "SALES",
                                                "taxJurisdiction": {
                                                    "jurisdictionValue": "NEW YORK",
                                                    "jurisdictionType": "STATE",
                                                    "jurisdictionId": "24354"
                                                }
                                            }
                                        },
                                        {
                                            "amount": 0.45,
                                            "attributes": {
                                                "taxRate": 0.045,
                                                "taxType": "SALES",
                                                "taxJurisdiction": {
                                                    "jurisdictionValue": "NEW YORK",
                                                    "jurisdictionType": "CITY",
                                                    "jurisdictionId": "25353"
                                                }
                                            }
                                        },
                                        {
                                            "amount": 0.04,
                                            "attributes": {
                                                "taxRate": 0.00375,
                                                "taxType": "SALES",
                                                "taxJurisdiction": {
                                                    "jurisdictionValue": "METROPOLITAN COMMUTER TRANSPORTATION DISTRICT",
                                                    "jurisdictionType": "DISTRICT",
                                                    "jurisdictionId": "79774"
                                                }
                                            }
                                        }
                                    ]
                                },
                                "updatedAt": "2024-06-24T09:07:53.712Z",
                                "createdAt": "2024-06-24T09:07:53.712Z"
                            }
                        ]
                    },
                    "adjustments": {
                        "total": 5,
                        "collection": [
                            {
                                "id": "b36d4bf0-3e10-40fb-b629-7f7760bbadcc",
                                "price": {
                                    "amount": 5
                                },
                                "reason": "Item was a sale item 2 days ago",
                                "attributes": {
                                    "type": "retail"
                                },
                                "updatedAt": "2024-06-24T09:07:55.423Z",
                                "createdAt": "2024-06-24T09:07:55.423Z"
                            }
                        ]
                    },
                    "fulfillment": {
                        "id": "e8d9d243-80cf-48a3-bf3d-765b55c2bca9",
                        "inventory": {
                            "type": "availableToPurchase",
                            "channels": {
                                "type": "WEB_PICKUP",
                                "locationNumber": "15",
                                "channelId": "12"
                            }
                        }
                    },
                    "attributes": {},
                    "tax": {
                        "total": 88.75,
                        "collection": [
                            {
                                "amount": 40,
                                "attributes": {
                                    "taxRate": 0.04,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "NEW YORK",
                                        "jurisdictionType": "STATE",
                                        "jurisdictionId": "24354"
                                    }
                                }
                            },
                            {
                                "amount": 45,
                                "attributes": {
                                    "taxRate": 0.045,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "NEW YORK",
                                        "jurisdictionType": "CITY",
                                        "jurisdictionId": "25353"
                                    }
                                }
                            },
                            {
                                "amount": 3.75,
                                "attributes": {
                                    "taxRate": 0.00375,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "METROPOLITAN COMMUTER TRANSPORTATION DISTRICT",
                                        "jurisdictionType": "DISTRICT",
                                        "jurisdictionId": "79774"
                                    }
                                }
                            }
                        ]
                    },
                    "updatedAt": "2024-06-24T09:07:53.712Z",
                    "createdAt": "2024-06-24T09:07:48.783Z"
                },
                {
                    "id": "9a45a494-0cc5-49aa-b339-88e4659ede8b",
                    "sku": "SKU3",
                    "refId": "44",
                    "quantity": 3,
                    "priceListId": "100000",
                    "position": 2,
                    "price": {
                        "unit": 10,
                        "amount": 30
                    },
                    "fees": {
                        "total": 0,
                        "collection": []
                    },
                    "adjustments": {
                        "total": 0,
                        "collection": []
                    },
                    "fulfillment": {
                        "id": "94b538bb-713f-464d-aa2e-d23ae6fd3115",
                        "inventory": {
                            "type": "availablePreorder",
                            "channels": {
                                "networkCode": "ShipToHome",
                                "type": "WEB_SHIP",
                                "channelId": "12"
                            }
                        }
                    },
                    "attributes": {},
                    "tax": {
                        "total": 2.66,
                        "collection": [
                            {
                                "amount": 1.2,
                                "attributes": {
                                    "taxRate": 0.04,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "NEW YORK",
                                        "jurisdictionType": "STATE",
                                        "jurisdictionId": "24354"
                                    }
                                }
                            },
                            {
                                "amount": 1.35,
                                "attributes": {
                                    "taxRate": 0.045,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "NEW YORK",
                                        "jurisdictionType": "CITY",
                                        "jurisdictionId": "25353"
                                    }
                                }
                            },
                            {
                                "amount": 0.11,
                                "attributes": {
                                    "taxRate": 0.00375,
                                    "taxType": "SALES",
                                    "taxJurisdiction": {
                                        "jurisdictionValue": "METROPOLITAN COMMUTER TRANSPORTATION DISTRICT",
                                        "jurisdictionType": "DISTRICT",
                                        "jurisdictionId": "79774"
                                    }
                                }
                            }
                        ]
                    },
                    "updatedAt": "2024-06-24T09:07:48.783Z",
                    "createdAt": "2024-06-24T09:07:48.783Z"
                }
            ]
        },
        "summary": {
            "totalItems": 5,
            "totalUniqueItems": 2
        },
        "fulfillments": {
            "e8d9d243-80cf-48a3-bf3d-765b55c2bca9": {
                "type": "SHIP_TO",
                "refId": "6622d50d2eee4e4e124c7467",
                "attributes": {
                    "dropOffMethod": false,
                    "WEB_CARRIER_MODE": "2DAY",
                    "proOrderShipDays": 2,
                    "shipmentInstructions": "Ring doorbell for 2nd Floor",
                    "radialShippingID": "ANY_2 DAY",
                    "promisedShipDate": "2023-02-10T18:31:31.784Z",
                    "taxCode": "FR1000",
                    "WEB_CARRIER_CODE": "ANY",
                    "storePickupEnabled": false
                },
                "originAddress": "",
                "destinationAddress": "476e673c-10c1-4bd6-b83d-26d403b5a735",
                "price": {
                    "amount": 10
                },
                "fees": {
                    "total": 0,
                    "collection": []
                },
                "adjustments": {
                    "total": 0,
                    "collection": []
                },
                "tax": {
                    "total": 0.89,
                    "collection": [
                        {
                            "amount": 0.4,
                            "attributes": {
                                "taxRate": 0.04,
                                "taxType": "SALES",
                                "taxJurisdiction": {
                                    "jurisdictionValue": "NEW YORK",
                                    "jurisdictionType": "STATE",
                                    "jurisdictionId": "24354"
                                }
                            }
                        },
                        {
                            "amount": 0.45,
                            "attributes": {
                                "taxRate": 0.045,
                                "taxType": "SALES",
                                "taxJurisdiction": {
                                    "jurisdictionValue": "NEW YORK",
                                    "jurisdictionType": "CITY",
                                    "jurisdictionId": "25353"
                                }
                            }
                        },
                        {
                            "amount": 0.04,
                            "attributes": {
                                "taxRate": 0.00375,
                                "taxType": "SALES",
                                "taxJurisdiction": {
                                    "jurisdictionValue": "METROPOLITAN COMMUTER TRANSPORTATION DISTRICT",
                                    "jurisdictionType": "DISTRICT",
                                    "jurisdictionId": "79774"
                                }
                            }
                        }
                    ]
                }
            },
            "94b538bb-713f-464d-aa2e-d23ae6fd3115": {
                "type": "BOPIS",
                "refId": "64b985ef9e16365c4d2b0083",
                "attributes": {
                    "warehouseId": "6126819ec326fe0009f473ba",
                    "isPickup": true,
                    "taxCode": "FR1000"
                },
                "originAddress": "9f615749-35ef-43e7-adfc-3369eb3b05e8",
                "destinationAddress": "476e673c-10c1-4bd6-b83d-26d403b5a735",
                "locationId": "15",
                "pickupPerson": {
                    "primary": {
                        "name": {
                            "first": "Jay",
                            "last": "Cooper"
                        },
                        "email": "jay.cooper@gmail.com",
                        "phone": {
                            "number": "+1-1153202801",
                            "type": "MOBILE"
                        }
                    }
                },
                "price": {
                    "amount": 30
                },
                "fees": {
                    "total": 0,
                    "collection": []
                },
                "adjustments": {
                    "total": 0,
                    "collection": []
                },
                "tax": {
                    "total": 2.67,
                    "collection": [
                        {
                            "amount": 1.2,
                            "attributes": {
                                "taxRate": 0.04,
                                "taxType": "SALES",
                                "taxJurisdiction": {
                                    "jurisdictionValue": "NEW YORK",
                                    "jurisdictionType": "STATE",
                                    "jurisdictionId": "24354"
                                }
                            }
                        },
                        {
                            "amount": 1.35,
                            "attributes": {
                                "taxRate": 0.045,
                                "taxType": "SALES",
                                "taxJurisdiction": {
                                    "jurisdictionValue": "NEW YORK",
                                    "jurisdictionType": "CITY",
                                    "jurisdictionId": "25353"
                                }
                            }
                        },
                        {
                            "amount": 0.12,
                            "attributes": {
                                "taxRate": 0.00375,
                                "taxType": "SALES",
                                "taxJurisdiction": {
                                    "jurisdictionValue": "METROPOLITAN COMMUTER TRANSPORTATION DISTRICT",
                                    "jurisdictionType": "DISTRICT",
                                    "jurisdictionId": "79774"
                                }
                            }
                        }
                    ]
                }
            }
        },
        "coupons": [
            {
                "code": "HAPPY10",
                "updatedAt": "2024-06-24T09:07:57.295Z"
            }
        ],
        "appliedCoupons": [
            {
                "code": "HAPPY10",
                "updatedAt": "2024-06-24T09:07:57.295Z"
            }
        ],
        "notAppliedCoupons": [],
        "payments": {
            "authorized": 1180.19,
            "collection": [
                {
                    "id": "43eaf31a-2ef6-403a-ace7-0cca0dee9d97",
                    "provider": "fabricmock",
                    "processor": "fabricmock",
                    "method": "CREDIT_CARD",
                    "methodType": "VISA",
                    "state": "AUTHORIZED",
                    "authorization": {
                        "amount": 1180.19,
                        "expiry": "",
                        "verifier": {
                            "type": "PAYMENT_TOKEN",
                            "key": "123"
                        }
                    },
                    "billToAddress": "476e673c-10c1-4bd6-b83d-26d403b5a735",
                    "cardDetails": {},
                    "attributes": {}
                }
            ]
        },
        "channelId": "12",
        "updatedAt": "2024-06-24T09:22:40.907Z",
        "createdAt": "2024-06-24T09:07:37.140Z",
        "errors": []
    }
I