Backend API
Create a new order from an active cart. This call will map items and other properties from a cart while creating the order and mark the cart as converted. Returns an error if any of the required order properties are missing from the cart, or if product stock is unavailable.
Arguments
cart_idobjectId
ID of the cart to convert.
POST/orders
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.post('/orders', {
cart_id: '5cad15bc9b14d1990724663a',
});
Response
{
"id": "5cad15bc9b14d1990724663b",
"account_id": "5a9ea7ba3f95740a914267f1",
"billing": {...},
"cart_id": "5cad15bc9b14d1990724663a",
"shipping": {...},
"items": [
{
"id": "5a9ea7ba3f95740a914267f2",
"product_id": "5cad15bc9b14d1990724663b",
"quantity": 2,
"price": 9.99,
"price_total": 18.98,
"shipment_weight": 1.5,
...
}
],
"coupon_code": "FREESHIPPING",
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"delivered": false,
"discount_total": 0,
"grand_total": 18.98,
"item_quantity": 2,
"item_shipment_weight": 3.0,
"item_tax": 0,
"number": "100101",
"paid": false,
"payment_balance": -18.98,
"payment_total": 0,
"refund_total": 0,
"refunded": false,
"shipment_price": 0,
"shipment_total": 0,
"status": "payment_pending",
"sub_total": 0,
"tax_total": 0,
...
}