DUMA/ API

Quote a basket

Prices a basket exactly as the order will be — catalogue prices, the promo code, VAT and delivery — and records nothing. Show the shopper total, charge it, then send it as the order’s expectedTotal.

POSThttps://api.duma-business.com/v1/store/orders/quote

orders:writeSecret key only

A promo code that cannot be used comes back as promo: { code, valid: false, reason } and the basket is priced without it. A code is only reserved when the order is placed, so it can still run out in between.

An unknown product or size, or a sized product without its size, is a 400. A line not for sale is 409 unavailable; a line with no price in currency is 409 price_unavailable.

Request example

Example request
curl -X POST "https://api.duma-business.com/v1/store/orders/quote" \
  -H "Authorization: Bearer dk_sec_…" \
  -H "Content-Type: application/json" \
  -d '{
  "items": [
    {
      "variantId": "3d7e9b1a-6c4f-4e2d-b8a5-9f0c1e2d3a4b",
      "quantity": 2
    }
  ],
  "fulfilment": {
    "type": "shipping",
    "method": "Royal Mail Tracked 48",
    "fee": "4.95",
    "address": {
      "recipientName": "Amelia Hart",
      "phone": "07700 900123",
      "line1": "14 Elm Grove",
      "city": "Bristol",
      "postcode": "BS6 6AH",
      "country": "GB"
    }
  },
  "promoCode": "AUTUMN20",
  "customerEmail": "[email protected]"
}'

Request body

JSON, sent with Content-Type: application/json.

itemsarrayRequired
The basket, 1 to 100 lines. Name each line’s product with productId, variantId or sku — prices always come from DUMA.
items[].quantitynumberRequired
A whole number from 1 to 999.
fulfilmentobjectRequired
How the order reaches the shopper.
fulfilment.typestringRequired
Shipping and delivery need an address; collection does not.
shippingdeliverycollection
fulfilment.address.recipientNamestringRequired
Up to 200 characters.
fulfilment.address.line1stringRequired
Up to 200 characters.
fulfilment.address.citystringRequired
Up to 120 characters.
fulfilment.address.postcodestringRequired
Up to 20 characters.
fulfilment.address.countrystringRequired
A two-letter country code, such as GB. Upper-cased for you.

Optional

items[].productIdstring (uuid)
The product. A product that comes in sizes also needs variantId or sku.
items[].variantIdstring (uuid)
The size. On its own it names its product.
items[].skustring
The size by SKU, instead of variantId. Up to 100 characters.
items[].discountCodestring
Deprecated: a catalogue discount’s code for this line. Use promoCode instead.
fulfilment.methodstring
Your name for the service, e.g. “Royal Mail Tracked 48”. Up to 100 characters.
fulfilment.feestringDefault "0"
Delivery fee as a decimal string such as "4.95". Shipping and delivery only; collection is always free.
fulfilment.addressobject
Required for shipping and delivery.
fulfilment.address.phonestring
Up to 30 characters.
fulfilment.address.line2string
Up to 200 characters.
fulfilment.address.regionstring
Up to 120 characters.
currencystring
The three-letter currency the shopper pays in; the workspace’s if omitted. Every line needs a price in it, or the request fails with 409 price_unavailable.
promoCodestring
A promo code for the whole order (promotions module). Case and spaces do not matter. Up to 60 characters.
customerEmailstring
The shopper’s email, when known, so a once-per-customer or first-order promo code can be checked.

Response

Response · 200
{
  "data": {
    "currency": "GBP",
    "items": [
      {
        "productId": "8f1c2a4e-3b6d-4c1e-9a7f-2d5b8e0c4a13",
        "variantId": "3d7e9b1a-6c4f-4e2d-b8a5-9f0c1e2d3a4b",
        "sku": "HOOD-BLK-M",
        "name": "Oversized Hoodie — M / Black",
        "quantity": 2,
        "unitPrice": "48.00",
        "listPrice": "60.00",
        "subtotal": "76.80",
        "adjustments": [
          {
            "kind": "markdown",
            "label": "Markdown",
            "amount": "24.00"
          },
          {
            "kind": "discount",
            "label": "Autumn 20% off",
            "amount": "19.20"
          }
        ]
      }
    ],
    "itemsTotal": "76.80",
    "deliveryFee": "4.95",
    "discount": "19.20",
    "tax": "12.80",
    "total": "81.75",
    "promo": {
      "code": "AUTUMN20",
      "valid": true,
      "summary": "20% off",
      "discount": "19.20"
    }
  }
}