Order Endpoints
Orders are WooCommerce orders scoped to an organization. The Order domain acts as an adapter over WooCommerce with Stripe integration for payment processing.
Base path: /wp-json/middag-account/v1/orders
Endpoints
| Method | Endpoint | Auth | Scope | Description |
|---|---|---|---|---|
| GET | /orders | JWT + Org | orders | List organization orders |
| GET | /orders/{id} | JWT + Org | orders | Full order details |
| POST | /orders/{id}/cancel | JWT + Org | orders | Cancel pending order |
| POST | /orders/{id}/refund | JWT + Org | orders + finances | Request refund |
GET /orders
List orders for the current organization.
Headers: X-Middag-Organization: {org_id}
Query filters:
| Parameter | Type | Values |
|---|---|---|
status | string | pending, processing, completed, cancelled, refunded |
date_from | string | ISO 8601 date (e.g., 2026-01-01) |
date_to | string | ISO 8601 date |
Response (200):
{
"success": true,
"data": [
{
"id": 501,
"status": "completed",
"total": "1250.00",
"currency": "BRL",
"date_created": "2026-04-01T14:30:00Z",
"date_completed": "2026-04-01T14:35:00Z",
"payment_method": "stripe",
"items_count": 2
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 1,
"pages": 1
}
}GET /orders/:id
Full order details including line items, billing/shipping addresses, linked entitlement data, and payment information.
Response fields: id, status, total, subtotal, tax_total, currency, date_created, date_completed, payment_method, billing_address, line_items[], entitlements[], notes.
POST /orders/:id/cancel
Cancel a pending or processing order.
Response (200):
{
"success": true,
"message": "Order cancelled"
}Returns 409 CONFLICT if the order is already completed or in a non-cancellable state.
POST /orders/:id/refund
Request a refund for a completed order. Requires both orders and finances scopes.
Request:
{
"reason": "Customer requested cancellation",
"amount": "1250.00"
}Response (200):
{
"success": true,
"data": {
"refund_id": 88,
"amount": "1250.00",
"status": "processing"
}
}Stripe Status Mapping
Orders from Stripe map statuses as follows (charge_automatically collection):
| Stripe Status | WooCommerce Status |
|---|---|
active | completed |
trialing | processing |
incomplete | on-hold |
past_due | failed |
canceled | cancelled |
Related
- Core Concepts: Orders
- Invoice Endpoints -- Invoices linked to orders
- Entitlement Endpoints -- Entitlements provisioned from orders