Skip to content

Order Management

Order Management

Create, view, and manage orders for your pharmacy. Track order status from placement through delivery, and handle special requests.

List All Orders

View all orders across your pharmacy.

Terminal window
# Get orders with filters
getAllProviderOrder({
page: 1,
status: "pending",
startDate: "2026-04-01",
endDate: "2026-04-30"
})

Parameters:

ParameterTypeRequiredDescription
pagenumberNoPage number (default: 1)
limitnumberNoResults per page (default: 20)
statusstringNoFilter by status
startDatestringNoFilter from date (YYYY-MM-DD)
endDatestringNoFilter to date (YYYY-MM-DD)
customerIdstringNoFilter by customer

Response:

{
"orders": [
{
"orderId": "ORD-789",
"customerId": "CUST-123",
"customerName": "John Doe",
"status": "pending",
"total": 8500,
"items": 3,
"deliveryType": "delivery",
"createdAt": "2026-04-18T10:30:00Z",
"address": "12 Admiralty Way, Lekki"
},
{
"orderId": "ORD-790",
"customerId": "CUST-124",
"customerName": "Jane Smith",
"status": "processing",
"total": 12000,
"items": 5,
"deliveryType": "pickup",
"createdAt": "2026-04-18T09:15:00Z"
}
],
"total": 156,
"page": 1,
"hasMore": true,
"summary": {
"pending": 12,
"processing": 8,
"completed": 136
}
}

Create New Order

Create an order for a customer.

Terminal window
# Create order for customer
createNewProviderOrderController({
customerId: "CUST-123",
pharmacyId: "PH-456",
items: [
{ medicationId: "MED-789", quantity: 2 },
{ medicationId: "MED-790", quantity: 1 }
],
deliveryType: "delivery",
address: "12 Admiralty Way, Lekki, Lagos",
notes: "Patient prefers evening delivery after 5pm",
isPaid: false,
paymentMethod: "cash_on_delivery"
})

Parameters:

ParameterTypeRequiredDescription
customerIdstringYesCustomer ID
pharmacyIdstringYesYour pharmacy ID
itemsarrayYesArray of medication items
items[].medicationIdstringYesMedication ID
items[].quantitynumberYesQuantity to order
deliveryTypestringYes"delivery" or "pickup"
addressstringNoRequired for delivery
notesstringNoSpecial instructions
isPaidbooleanNoPayment status (default: false)
paymentMethodstringNoPayment method

Response:

{
"success": true,
"orderId": "ORD-791",
"status": "pending",
"total": 12500,
"breakdown": {
"subtotal": 12000,
"deliveryFee": 500,
"tax": 0
},
"items": [
{
"medicationId": "MED-789",
"name": "Amoxicillin 500mg",
"quantity": 2,
"unitPrice": 2500,
"total": 5000
},
{
"medicationId": "MED-790",
"name": "Paracetamol 500mg",
"quantity": 1,
"unitPrice": 7000,
"total": 7000
}
],
"customer": {
"id": "CUST-123",
"name": "John Doe",
"phone": "+2348012345678"
},
"delivery": {
"type": "delivery",
"address": "12 Admiralty Way, Lekki, Lagos",
"eta": "30-45 minutes"
},
"createdAt": "2026-04-18T14:00:00Z"
}

Get Order Details

View complete information about a specific order.

Terminal window
# Get full order details
getProviderOrderDetails({
orderId: "ORD-789"
})

Response:

{
"orderId": "ORD-789",
"status": "processing",
"statusHistory": [
{ "status": "pending", "time": "2026-04-18T10:30:00Z" },
{ "status": "processing", "time": "2026-04-18T10:35:00Z" }
],
"customer": {
"id": "CUST-123",
"name": "John Doe",
"phone": "+2348012345678",
"address": "12 Admiralty Way, Lekki"
},
"items": [
{
"medicationId": "MED-789",
"name": "Amoxicillin 500mg",
"quantity": 2,
"price": 2500,
"instructions": "Take 3 times daily after meals"
}
],
"payment": {
"total": 8500,
"subtotal": 8000,
"deliveryFee": 500,
"status": "pending",
"method": "cash_on_delivery"
},
"delivery": {
"type": "delivery",
"address": "12 Admiralty Way, Lekki, Lagos",
"riderName": "Michael",
"riderPhone": "+2348076543210",
"eta": "20 minutes"
},
"notes": "Call before arrival",
"createdAt": "2026-04-18T10:30:00Z"
}

Update Order Status

Change the status of an order as it progresses.

Terminal window
# Update order status
updateProviderOrderStatus({
orderId: "ORD-789",
status: "out_for_delivery",
notes: "Order packed and with rider"
})

Status Values:

StatusWhen to Use
pendingNew order, awaiting processing
confirmedOrder accepted
processingPreparing medications
ready_for_pickupReady for customer collection
out_for_deliveryWith delivery partner
deliveredSuccessfully delivered
completedOrder finished
cancelledOrder cancelled

Cancel Order

Cancel an order before it’s completed.

Terminal window
# Cancel order with reason
cancelProviderOrder({
orderId: "ORD-789",
reason: "Customer requested cancellation",
refundCustomer: true
})

Example: Order Workflow

Terminal window
# Step 1: View pending orders
getAllProviderOrder({ status: "pending" })
# → Shows orders awaiting processing
# Step 2: Get order details
getProviderOrderDetails({ orderId: "ORD-789" })
# → Shows full order information
# Step 3: Update status when processing
updateProviderOrderStatus({
orderId: "ORD-789",
status: "processing"
})
# Step 4: Mark ready for delivery
updateProviderOrderStatus({
orderId: "ORD-789",
status: "out_for_delivery"
})

Order Notifications

Customers receive automatic notifications at each status change via SMS and push notifications.

Next steps