Orders Domain

Orders API

Account order operations covering fetch, detail, acceptance, rejection, and settlement flows.

Base Path

https://api.niyantha.in/api/v1/session

Authentication

Authorization: Bearer <token>

Use these routes to power account order dashboards, store-specific order views, and downstream fulfillment workflows. The same operations are available via S2S for backend-to-backend integrations.

GET/orders

Fetch account orders with pagination and status filters.

Bearer Token

Query Parameters

FieldTypeRequiredDescription
pageintNoDefaults to 1.
countintNoDefaults to 10.
statusstringNocreated, accepted, rejected, completed, failed.
is_pending_acknowledgementboolNoFetch orders still awaiting account action.
Sample Response
{
  "items": [
    {
      "id": 991,
      "store_id": 12,
      "status": "created",
      "payment_status": "paid",
      "total_amount": 145,
      "delivery_method": "home_delivery"
    }
  ],
  "page": 1,
  "count": 1
}
GET/orders/:id

Fetch the full order detail, including items and locations.

Bearer Token
Sample Response
{
  "id": 991,
  "buyer_id": 5,
  "store_id": 12,
  "status": "created",
  "payment_status": "paid",
  "delivery_method": "home_delivery",
  "items": [
    {
      "id": 77,
      "store_product_id": 501,
      "quantity": 2,
      "price_per_unit": 40
    }
  ]
}
POST/orders/:id/accept

Accept an order and optionally declare estimated delivery time.

Bearer Token

Request Fields

FieldTypeRequiredDescription
estimated_delivery_minutesintNoEstimated delivery SLA in minutes.
Sample Request
{
  "estimated_delivery_minutes": 35
}
Sample Response
{
  "id": 991,
  "status": "accepted",
  "estimated_delivery_minutes": 35
}
POST/orders/:id/decline

Decline an order with a reason.

Bearer Token

Request Fields

FieldTypeRequiredDescription
reasonstringYesHuman-readable decline reason.
Sample Request
{
  "reason": "Out of stock"
}
Sample Response
{
  "id": 991,
  "status": "rejected",
  "reason": "Out of stock"
}
PATCH/orders/:id/mark-paid-and-delivered

Mark the order settled and delivered.

Bearer Token

Request Fields

FieldTypeRequiredDescription
payment_referencestringNoSettlement reference.
delivered_atint64NoUnix delivery timestamp.
Sample Request
{
  "payment_reference": "razorpay_abc",
  "delivered_at": 1736764200
}
Sample Response
{
  "id": 991,
  "status": "completed",
  "payment_status": "paid"
}

Notes

1

Use /stores/:store_id/orders when you want store-scoped dashboards or multi-store account views.

2

The same routes are exposed under /api/v1/s2s/accounts/orders for server-side partner integrations.