How do I create an order via the Shopblocks API?

Learn the Shopblocks Orders API with an example JSON request. Perfect for developers needing a step-by-step tutorial on using the POST /api/v2/orders endpoint.

Full Documentation

Example Request JSON:


This request shows how to create an order which is:

  • In a 'pending' status (order status ID 2)
  • Fully Paid (payment status ID 2)
  • Has full customer information
  • Has a delivery address (which will be used as the billing address too automatically)
Endpoint: POST /api/v2/orders
{
  "date": "2024-01-01 12:00:00",
  "order_status_id": 2,
  "customer": {
    "email": "test@example.com",
    "title": "Mrs",
    "firstname": "Sally",
    "lastname": "Smith",
    "telephone": "0123 456 7890",
    "company_name": "ExampleCo",
    "reference": "C123456"
  },
  "delivery_address": {
    "firstname": "Sally",
    "lastname": "Smith",
    "company_name": "ExampleCo",
    "address_1": "Example House, Testway Avenue",
  "address_2": "Testly",
    "city": "Testington",
    "area": "Testshire",
    "postcode": "TE5 TTT",
    "country": "GB"
  },
  "items": [
    {
      "custom": true,
      "name": "60\" OLED Television",
      "quantity": 2,
      "price": 500.00,
    "sku": "TV12345",
      "tax_rate": 20
    }
  ],
  "payments": [
    {
      "amount": "1000.00",
      "method": "cash",
      "payment_status_id": 2
    }
  ]
}

Order Statuses

ID STATUS
1  Awaiting Payment 
2  Pending 
3  Processing 
4  Awaiting Dispatch 
5  Dispatched 
6  Refunded  
7  Cancelled 
8  Partially Refunded