SeloraXDEVELOPERS

Orders

Orders API

Create, read, and update orders for the authenticated store. Orders include line items, financial totals, fulfillment status, and payment information.

List Orders

Retrieve a paginated list of orders.

GET /api/apps/v1/orders

Authentication

Required. Must include valid app credentials.

Scope

read:orders

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger50Items per page (max 250)
statusstring--Filter by order status (e.g. pending, confirmed, delivered, cancelled)
sincestring (ISO 8601)--Only return orders created on or after this date
untilstring (ISO 8601)--Only return orders created on or before this date
customer_idinteger--Filter orders by customer (user) ID
sortstringcreated_at:descSort results. Format: column or column:asc/column:desc. Allowed columns: created_at, updated_at, grand_total

Example Request

curl -X GET "https://api.selorax.io/api/apps/v1/orders?page=1&limit=10&status=confirmed" \
  -H "Authorization: Bearer <token>"

Filter by customer and sort by total:

curl -X GET "https://api.selorax.io/api/apps/v1/orders?customer_id=301&sort=grand_total:desc" \
  -H "Authorization: Bearer <token>"

Or using client credentials with a date range:

curl -X GET "https://api.selorax.io/api/apps/v1/orders?since=2025-01-01T00:00:00Z&until=2025-06-30T23:59:59Z&limit=50" \
  -H "X-Client-Id: sx_app_..." \
  -H "X-Client-Secret: sx_secret_..." \
  -H "X-Store-Id: 22"

Response

{
  "data": [
    {
      "order_id": 1045,
      "store_id": 22,
      "user_id": 301,
      "order_status": "confirmed",
      "financial_status": "paid",
      "fulfillment_status": "unfulfilled",
      "sub_total": 1500.00,
      "tax": 0.00,
      "shipping": 60.00,
      "discount": 100.00,
      "grand_total": 1460.00,
      "payment_method": "cod",
      "note": "Please deliver before 5pm",
      "created_at": "2025-06-15T10:30:00.000Z",
      "updated_at": "2025-06-15T11:00:00.000Z"
    },
    {
      "order_id": 1044,
      "store_id": 22,
      "user_id": 289,
      "order_status": "pending",
      "financial_status": "pending",
      "fulfillment_status": "unfulfilled",
      "sub_total": 800.00,
      "tax": 0.00,
      "shipping": 60.00,
      "discount": 0.00,
      "grand_total": 860.00,
      "payment_method": "online",
      "note": null,
      "created_at": "2025-06-15T09:20:00.000Z",
      "updated_at": "2025-06-15T09:20:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 2
  },
  "status": 200
}

Response Fields

FieldTypeDescription
order_idintegerUnique order identifier
store_idintegerStore the order belongs to
user_idintegerCustomer who placed the order
order_statusstringCurrent order status (pending, confirmed, processing, shipped, delivered, cancelled, returned)
financial_statusstringPayment status (pending, paid, partially_paid, refunded)
fulfillment_statusstringFulfillment status (unfulfilled, partially_fulfilled, fulfilled)
sub_totalnumberSum of line item prices before tax, shipping, and discounts
taxnumberTax amount
shippingnumberShipping charge
discountnumberDiscount applied
grand_totalnumberFinal order total (sub_total + tax + shipping - discount)
payment_methodstringPayment method used (e.g. cod, online, bkash)
notestring or nullCustomer note
created_atstring (ISO 8601)When the order was created
updated_atstring (ISO 8601)When the order was last updated

Node.js Example

const response = await fetch(
  "https://api.selorax.io/api/apps/v1/orders?status=confirmed&sort=created_at:desc",
  { headers: { Authorization: "Bearer sx_at_..." } }
);
const { data, pagination } = await response.json();
console.log(`Found ${pagination.total} orders`);

Python Example

import requests
 
response = requests.get(
    "https://api.selorax.io/api/apps/v1/orders",
    headers={"Authorization": "Bearer sx_at_..."},
    params={"status": "confirmed", "customer_id": 301, "limit": 50},
)
data = response.json()
for order in data["data"]:
    print(f"Order #{order['order_id']}: {order['grand_total']} ({order['order_status']})")

Get Order

Retrieve a single order by ID, including its line items.

GET /api/apps/v1/orders/:order_id

Authentication

Required. Must include valid app credentials.

Scope

read:orders

Path Parameters

ParameterTypeDescription
order_idintegerThe order ID to retrieve

Example Request

curl -X GET "https://api.selorax.io/api/apps/v1/orders/1045" \
  -H "Authorization: Bearer <token>"

Response

{
  "data": {
    "order_id": 1045,
    "user_id": 301,
    "store_id": 22,
    "tracking_code": "ST-2025061501",
    "order_status": "confirmed",
    "financial_status": "paid",
    "fulfillment_status": "unfulfilled",
    "sub_total": 1500.00,
    "item_discount": 0.00,
    "tax": 0.00,
    "shipping": 60.00,
    "total": 1560.00,
    "promo": null,
    "discount": 100.00,
    "grand_total": 1460.00,
    "paid_by_customer": 1460.00,
    "note": "Please deliver before 5pm",
    "address": "{\"name\":\"Rahim Ahmed\",\"phone\":\"+8801712345678\",\"address\":\"123 Main St\",\"city\":\"Dhaka\"}",
    "billing_address": null,
    "is_billing_same": 1,
    "channel": "web",
    "payment_method": "cod",
    "is_delivery_paid": 0,
    "created_at": "2025-06-15T10:30:00.000Z",
    "updated_at": "2025-06-15T11:00:00.000Z",
    "delivery_date": null,
    "tags": null,
    "processed_at": "2025-06-15T10:35:00.000Z",
    "shipped_at": null,
    "delivered_at": null,
    "courier": null,
    "courier_id": null,
    "store_serial_order_no": 1045,
    "customer_name": "Rahim Ahmed",
    "customer_phone": "+8801712345678",
    "customer_email": "[email protected]",
    "items": [
      {
        "order_item_id": 2089,
        "order_id": 1045,
        "product_id": 150,
        "variant_id": 451,
        "bundle_id": null,
        "name": "Premium Rose Bouquet - Large / Red",
        "price": 750.00,
        "discount": 0.00,
        "quantity": 2,
        "image": "products/prb-lg-red.jpg",
        "created_at": "2025-06-15T10:30:00.000Z",
        "updated_at": "2025-06-15T10:30:00.000Z"
      }
    ]
  },
  "status": 200
}

Order Detail Fields

The single order response includes all list fields plus:

FieldTypeDescription
tracking_codestring or nullCourier tracking code
item_discountnumberSum of per-item discounts
totalnumberOrder total before promo/discount
promostring or nullPromo code applied
paid_by_customernumberAmount actually paid by customer
addressstring (JSON)Shipping address as JSON string with name, phone, address, city
billing_addressstring (JSON) or nullBilling address (if different from shipping)
is_billing_sameinteger (0 or 1)Whether billing address matches shipping
channelstringOrder channel (e.g. web, pos, manual)
is_delivery_paidinteger (0 or 1)Whether delivery cost was paid
delivery_datestring or nullScheduled delivery date
tagsstring or nullOrder tags
processed_atstring or nullWhen order was confirmed
hold_atstring or nullWhen order was put on hold
cancel_atstring or nullWhen order was cancelled
shipped_atstring or nullWhen order was shipped
delivered_atstring or nullWhen order was delivered
returned_atstring or nullWhen order was returned
courierstring or nullCourier service name
courier_idstring or nullExternal courier order ID
payment_datestring or nullWhen payment was received
fulfilled_atstring or nullWhen order was fulfilled
store_serial_order_nointegerStore-specific sequential order number
shipping_typestring or nullShipping type
is_bundleinteger (0 or 1)Whether order contains bundle items
followup_datestring or nullFollow-up date for the order
printedinteger (0 or 1)Whether the order has been printed
printed_atstring or nullWhen the order was printed
customer_namestring or nullCustomer name (joined from users table)
customer_phonestring or nullCustomer phone (joined from users table)
customer_emailstring or nullCustomer email (joined from users table)

Item Fields

FieldTypeDescription
order_item_idintegerLine item ID
order_idintegerParent order ID
product_idintegerAssociated product ID
variant_idinteger or nullAssociated variant ID
bundle_idinteger or nullBundle ID (if part of a bundle)
namestringProduct and variant name
pricenumberUnit price
discountnumberDiscount on this item
quantityintegerQuantity ordered
imagestring or nullProduct image path
created_atstring (ISO 8601)When the item was added
updated_atstring (ISO 8601)When the item was last updated

Error Responses

CodeStatusMeaning
invalid_token401Token is expired or invalid
insufficient_scope403App does not have read:orders scope

If the order_id does not belong to the authenticated store, the API returns a 404 with no code field:

{
  "message": "Order not found.",
  "status": 404
}

Create Order

Create a new order with line items.

POST /api/apps/v1/orders

Scope

write:orders

Request Body

FieldTypeRequiredDescription
customer_idintegerNoCustomer user ID (must exist in this store)
addressobjectYesShipping address. Must include address field
billing_addressobjectNoBilling address (if different from shipping)
is_billing_samebooleanNoWhether billing matches shipping (default: false)
order_itemsarrayYesArray of line items (min 1)
order_statusstringNoInitial status (default: pending)
financial_statusstringNoPayment status (default: pending)
fulfillment_statusstringNoFulfillment status (default: un-fulfilled)
payment_methodstringNoPayment method (default: cod)
channelstringNoOrder channel (default: other)
notestringNoCustomer note
internal_notestringNoInternal note (not visible to customer)
tagsstringNoOrder tags
delivery_datestringNoScheduled delivery date
sub_totalnumberNoAuto-calculated from items if omitted
grand_totalnumberNoAuto-calculated if omitted
shippingnumberNoShipping charge (default: 0)
discountnumberNoDiscount amount (default: 0)
taxnumberNoTax amount (default: 0)

Order Item fields:

FieldTypeRequiredDescription
namestringYesItem name
pricenumberYesUnit price
quantityintegerYesQuantity
product_idintegerNoAssociated product ID
variant_idintegerNoAssociated variant ID (cost auto-fetched)
discountnumberNoPer-item discount
imagestringNoItem image path

Example Request

curl -X POST "https://api.selorax.io/api/apps/v1/orders" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": 301,
    "address": {
      "name": "Rahim Ahmed",
      "phone": "01712345678",
      "address": "123 Main St",
      "city": "Dhaka"
    },
    "payment_method": "cod",
    "shipping": 60,
    "order_items": [
      {
        "name": "Premium Rose Bouquet - Large / Red",
        "product_id": 150,
        "variant_id": 451,
        "price": 750,
        "quantity": 2
      }
    ]
  }'

Response (201)

{
  "data": {
    "order_id": 1050,
    "store_id": 22,
    "user_id": 301,
    "order_status": "pending",
    "financial_status": "pending",
    "fulfillment_status": "un-fulfilled",
    "sub_total": 1500,
    "grand_total": 1560,
    "items_count": 1
  },
  "status": 201
}

Auto-calculation

If sub_total or grand_total are omitted, they are auto-calculated from the items: sub_total = sum(price × quantity), grand_total = sub_total - discount + tax + shipping.


Update Order

Update order fields such as notes, tags, address, and payment details.

PUT /api/apps/v1/orders/:order_id

Scope

write:orders

Request Body

FieldTypeDescription
notestringCustomer note
internal_notestringInternal note
tagsstringOrder tags
addressobjectShipping address
billing_addressobjectBilling address
is_billing_samebooleanWhether billing matches shipping
payment_methodstringPayment method
paid_by_customernumberAmount paid
payment_datestringPayment date
payment_referencestringPayment reference
payment_remarkstringPayment remark
delivery_datestringDelivery date
followup_datestringFollow-up date
shppping_typestringShipping type (inside, subarea, outside, free)
is_delivery_paidbooleanWhether delivery is paid

Optimistic locking

Order updates use optimistic locking. If another request modifies the order simultaneously, a 409 Conflict is returned. Retry the request to pick up the latest version.

Example Request

curl -X PUT "https://api.selorax.io/api/apps/v1/orders/1045" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "Updated delivery instructions",
    "tags": "vip,express",
    "payment_method": "Bkash",
    "paid_by_customer": 1460
  }'

Update Order Status

Change the order status, financial status, or fulfillment status.

PUT /api/apps/v1/orders/:order_id/status

Scope

write:orders

Request Body

At least one status field is required.

FieldTypeValid Values
order_statusstringpending, processing, scheduled, shipped, completed, cancelled, hold, returned, refunded, exchange
financial_statusstringpending, partially_paid, paid, partially_refunded, refunded, voided
fulfillment_statusstringun-fulfilled, fulfilled, partial, processing, ongoing, delivered, cancelled, hold, in_review, delivery-in-progress, pickup-pending, returning, returned, rejected

Automatic timestamps

Status changes automatically set the corresponding timestamp field. For example, setting order_status to shipped sets shipped_at, and fulfilled sets fulfilled_at.

Example Request

curl -X PUT "https://api.selorax.io/api/apps/v1/orders/1045/status" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "order_status": "processing",
    "financial_status": "paid"
  }'

Response

{
  "data": {
    "order_id": 1045,
    "order_status": "processing",
    "financial_status": "paid",
    "fulfillment_status": "un-fulfilled",
    "updated_at": "2025-06-20T12:00:00.000Z"
  },
  "changes": {
    "order_status": { "from": "pending", "to": "processing" },
    "financial_status": { "from": "pending", "to": "paid" }
  },
  "status": 200
}