Merchant APIs · v1.1

Merchant APIs integration guide.

Connect your shop to the Modon Express network. Create orders, follow every status, manage invoices and receive webhook updates in real time.

JSON responses Max 60 requests / 30 sec Order webhooks

Guide

Before you start

GUIDE

The Merchant API connects your shop to the Modon Express network. Every call uses a merchant token, returns JSON and is limited to 60 requests per 30 seconds for each user.

The token is returned by the login endpoint and must be sent with every request. Invoice APIs accept a merchant token only; a merchant user token is rejected.
Import the collection into Postman to try every endpoint with your own token: https://documenter.getpostman.com/view/5889333/2sA3XY6xXu

Endpoint 01

Login

01

Authenticate a merchant and receive the token used by every other call.

POST

Login endpoint

/v1/merchant/login

Submit the merchant username and password and receive a merchant token.

The token resets after a password change. Use the merchant account for a merchant token. Invoice APIs require that token.

username stringrequired
The merchant's username.
password stringrequired
The merchant's password.
Request sample
{
  "username": "username",
  "password": "password"
}
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": {
    "token": "@@d71480ycdmp9...."
  }
}

Endpoint 02

Supplementary data

02

Order creation needs a city, a region and a package size. Read each list first and keep the IDs.

GET

Cities

/v1/merchant/citys

Returns every city by name and ID.

Request sample
Query parameters: none
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": [
    { "id": "1", "city_name": "name" }
  ]
}
GET

Regions

/v1/merchant/regions?city_id=ID

Returns the regions for one city by name and ID.

city_id intrequired
The city whose regions you need.
Request sample
Query parameters: "city_id":"ID"
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": [
    { "id": "1", "region_name": "name" }
  ]
}
GET

Package sizes

/v1/merchant/package-sizes

Returns the supported package sizes by name and ID.

Request sample
Query parameters: none
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": [
    { "id": "1", "size": "name" }
  ]
}

Endpoint 03

Create an order

03

Submit the customer, city, region, package size and price. The response returns the order and its QR link.

POST

Order creation

/v1/merchant/create-order?token=loginToken

Creates an order and returns its data, status and receipt PDF link.

client_name stringrequired
Name of the client.
client_mobile stringrequired
Iraqi mobile in the format +9647000000000.
client_mobile2 stringoptional
A second client mobile in the same format.
city_id intrequired
The client's city ID from the Cities API.
region_id intrequired
The client's region ID from the Regions API.
location stringrequired
A description of the delivery location.
type_name stringrequired
The type of goods in the order.
items_number intrequired
Number of items in the order.
price intrequired
Total price including delivery.
package_size intrequired
Package size ID from the Package Sizes API.
merchant_notes stringoptional
A note or instruction for the order.
replacement 0 or 1required
Whether the order is a replacement.
Request sample
{
  "client_name": "name",
  "client_mobile": "+964700000000",
  "client_mobile2": "+964700000000",
  "city_id": 5,
  "region_id": 2,
  "location": "text",
  "type_name": "text",
  "items_number": 1,
  "price": 25000,
  "package_size": 1,
  "merchant_notes": "text",
  "replacement": 0
}
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": [
    {
      "client_name": "client name",
      "client_mobile": "+9647700000000",
      "client_mobile2": "+9647700000000",
      "city_id": "5",
      "region_id": "2",
      "type_id": 1,
      "merchant_mobile": "07700000000",
      "items_number": "1",
      "price": "25000",
      "package_size": "1",
      "cash_fee": 0,
      "location": "market",
      "merchant_id": "5",
      "current_city": "1",
      "merchant_city": "1",
      "company_price": 4000,
      "merchant_price": 21000,
      "type_name": "ملابس",
      "merchant_created_at": "2024-08-10 23:59:59",
      "merchant_notes": "عدم فتح القطعة",
      "qr_id": 38799216,
      "pickup_id": "1",
      "pickup_created_at": "2024-08-10 04:30:10pm",
      "delivery_price": "9000",
      "package_size": "عادي",
      "merchant_invoice_id": "-1",
      "urgent": "0",
      "urgent_datetime_to_deliver": "0000-00-00 00:00:00",
      "deliver_estimation_datetime": "0000-00-00 00:00:00",
      "id": "103",
      "qr_link": "https://modon-express.net/merchant/print-single-tcpdf?id=ID&token=Merchant_Token"
    }
  ]
}

Endpoint 04

Edit an order

04

Update an order while it is still in the merchant’s possession. Send the order ID and the same fields as creation.

POST

Edit an order

/v1/merchant/edit-order?token=loginToken

Updates the order details and returns a success message.

qr_id stringrequired
The order number.
client_name stringrequired
Name of the client.
client_mobile stringrequired
Iraqi mobile in the format +9647000000000.
client_mobile2 stringoptional
A second client mobile in the same format.
city_id intrequired
The client's city ID.
region_id intrequired
The client's region ID.
location stringrequired
A description of the delivery location.
type_name stringrequired
The type of goods in the order.
items_number intrequired
Number of items in the order.
price intrequired
Total price including delivery.
package_size intrequired
Package size ID.
merchant_notes stringoptional
A note or instruction for the order.
replacement 0 or 1required
Whether the order is a replacement.
Request sample
{
  "qr_id": "6942069",
  "client_name": "name",
  "client_mobile": "+964700000000",
  "city_id": 5,
  "region_id": 2,
  "location": "text",
  "type_name": "text",
  "items_number": 1,
  "price": 25000,
  "package_size": 1,
  "merchant_notes": "text",
  "replacement": 0
}
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok"
}

Endpoint 05

Retrieve orders

05

Read every order for the merchant and follow its current status. Use the batch endpoint when you already know the IDs.

GET

Retrieve orders

/v1/merchant/merchant-orders?token=loginToken

Returns the merchant orders with their current status and collection data.

Request sample
Query parameters: "token":"token"
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": [
    {
      "client_name": "client name",
      "client_mobile": "+9647700000000",
      "client_mobile2": "+9647700000000",
      "city_id": "5",
      "region_id": "2",
      "type_id": 1,
      "merchant_mobile": "07700000000",
      "items_number": "1",
      "price": "25000",
      "package_size": "1",
      "cash_fee": 0,
      "location": "market",
      "merchant_id": "5",
      "current_city": "1",
      "merchant_city": "1",
      "company_price": 4000,
      "merchant_price": 21000,
      "type_name": "ملابس",
      "merchant_created_at": "2024-08-10 23:59:59",
      "merchant_notes": "عدم فتح القطعة",
      "qr_id": 38799216,
      "pickup_id": "1",
      "pickup_created_at": "2024-08-10 04:30:10pm",
      "delivery_price": "9000",
      "package_size": "عادي",
      "merchant_invoice_id": "-1",
      "urgent": "0",
      "urgent_datetime_to_deliver": "0000-00-00 00:00:00",
      "deliver_estimation_datetime": "0000-00-00 00:00:00",
      "id": "103",
      "qr_link": "https://modon-express.net/merchant/print-single-tcpdf?id=ID&token=Merchant_Token"
    }
  ]
}
POST

Retrieve specific orders by IDs

/v1/merchant/get-orders-by-ids-bulk?token=loginToken

Returns specific orders from a comma-separated list of IDs. A maximum of 25 IDs is allowed.

ids stringrequired
Comma-separated order IDs; extra IDs above 25 are discarded.
Request sample
{
  "ids": "11,23,75,29"
}
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": [
    {
      "client_name": "client name",
      "client_mobile": "+9647700000000",
      "client_mobile2": "+9647700000000",
      "city_id": "5",
      "region_id": "2",
      "type_id": 1,
      "merchant_mobile": "07700000000",
      "items_number": "1",
      "price": "25000",
      "package_size": "1",
      "cash_fee": 0,
      "location": "market",
      "merchant_id": "5",
      "current_city": "1",
      "merchant_city": "1",
      "company_price": 4000,
      "merchant_price": 21000,
      "type_name": "ملابس",
      "merchant_created_at": "2024-08-10 23:59:59",
      "merchant_notes": "عدم فتح القطعة",
      "qr_id": 38799216,
      "pickup_id": "1",
      "pickup_created_at": "2024-08-10 04:30:10pm",
      "delivery_price": "9000",
      "package_size": "عادي",
      "merchant_invoice_id": "-1",
      "urgent": "0",
      "urgent_datetime_to_deliver": "0000-00-00 00:00:00",
      "deliver_estimation_datetime": "0000-00-00 00:00:00",
      "id": "103",
      "qr_link": "https://modon-express.net/merchant/print-single-tcpdf?id=ID&token=Merchant_Token"
    }
  ]
}

Endpoint 06

Delete an order

06

Delete an order while it is still in the merchant’s possession. The order status must be 1 (new order).

POST

Delete an order

/v1/merchant/delete-orders?token=loginToken

Deletes a new order that has not yet left the merchant.

qr_id stringrequired
The order number.
Request sample
{
  "qr_id": "6942069"
}
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok"
}

Endpoint 07

Manage invoices

07

Read merchant invoices, list the orders inside one invoice, then confirm receipt. Invoice APIs accept a merchant token only.

GET

Get merchant invoices

/v1/merchant/get_merchant_invoices?token=loginToken

Returns every invoice related to the merchant.

Request sample
Query parameters: none
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": [
    {
      "id": "3",
      "merchant_price": "170000",
      "delivered_orders_count": "7",
      "replacement_delivered_orders_count": "0",
      "status": "تم الاستلام من قبل التاجر",
      "merchant_id": "5",
      "updated_at": "2023-12-20 17:01:46"
    }
  ]
}
GET

Get orders for an invoice

/v1/merchant/get_merchant_invoice_orders?token=loginToken&invoice_id=invoiceID

Returns the invoice and every order included in it.

invoice_id stringrequired
The ID of the invoice.
Request sample
Query parameters: "invoice_id":"ID"
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok",
  "data": {
    "invoice": [
      {
        "id": "3",
        "merchant_price": "170000",
        "delivered_orders_count": "7",
        "replacement_delivered_orders_count": "0",
        "status": "تم الاستلام من قبل التاجر",
        "merchant_id": "5",
        "updated_at": "2023-12-20 17:01:46"
      }
    ],
    "orders": [
      {
        "client_name": "محمد",
        "client_mobile": "+9647704723599",
        "items_number": "1",
        "city_name": "بغداد",
        "region_name": "شارع فلسطين",
        "status": "تم استلام الطلب من قبل المندوب",
        "price": "20000",
        "qr_id": 38799216,
        "deliver_confirmed_fin": 1,
        "delivery_price": "9000",
        "package_size": "عادي",
        "merchant_invoice_id": "8",
        "id": "103"
      }
    ]
  }
}
GET

Receive an invoice

/v1/merchant/receive_merchant_invoice?token=loginToken&invoice_id=invoiceID

Marks the invoice as received. The app confirms the same action by scanning the invoice QR code.

invoice_id stringrequired
The ID of the invoice.
Request sample
Query parameters: "invoice_id":"ID"
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok"
}

Guide

Response handling

GUIDE

Every endpoint returns JSON. A failed request keeps the same shape, with an error number and a message you can show the merchant.

Success: { "status": true, "errNum": "S000", "msg": "ok", "data": [ ... ] } Failure: { "status": false, "errNum": "999", "msg": "error message" }

Webhooks

Webhooks

Webhooks

Receive order status updates in real time instead of polling. Provide an endpoint URL, and Modon Express sends a POST request whenever the order status changes.

Max failed attempts: 4. Request timeout: 3 seconds. You may provide an auth header in the format "auth-key-name:token". Successful logs are kept for 3 days; failed logs for 21 days.
POST

Order status update

Your webhook endpoint

Sends the order state, customer details, collection data and delivery result to your endpoint.

Request sample
Headers:
Content-Type: application/json
auth-key-name: token

Body:
{
  "client_name": "محمد",
  "client_mobile": "+9647712345678",
  "items_number": "1",
  "created_at": "2023-08-13 22:12:18",
  "city_name": "بغداد",
  "region_name": "شارع فلسطين",
  "status_id": "2",
  "deliver_done": 0,
  "status": "تم استلام الطلب من قبل المندوب",
  "price": "20000",
  "location": "market",
  "issue_notes": "لا يوجد",
  "merchant_notes": "لا يوجد",
  "client_mobile2": "+9647712345678",
  "updated_at": "2024-06-22 11:28:53",
  "city_id": "13",
  "region_id": "1043",
  "replacement": "0",
  "type_name": "ملابس",
  "id": "103",
  "has_merchant_fin_record": 0,
  "deliver_confirmed_fin": 0,
  "delivery_price": "9000",
  "package_size": "عادي",
  "merchant_invoice_id": "-1"
}
Response sample
{
  "status": true,
  "errNum": "S000",
  "msg": "ok"
}