Orders
Push an order when it is created and again every time it changes: payment, delivery, cancellation or edited items. Each push is the full order as it is now (a snapshot). The CRM updates the same record every time and keeps the customer's totals current.
Push an order#
POST /v1/integrations/orders. This needs the orders.write scope.
{
"externalId": "1001",
"customer": {
"externalId": "C-42",
"fullName": "Selam Bekele",
"phone": "+251911234567",
"email": "selam@example.com",
"address": { "city": "Addis Ababa", "country": "ET" }
},
"items": [
{ "productExternalId": "P-7", "sku": "LAMP-BLK", "name": "Desk lamp", "category": "Lighting", "qty": 2, "unitPrice": 1200 }
],
"total": 2400,
"currency": "ETB",
"paymentStatus": "paid",
"deliveryStatus": "pending",
"status": "confirmed",
"channel": "website",
"placedAt": "2026-10-06T09:30:00Z",
"updatedAt": "2026-10-06T09:31:00Z",
"metadata": { "shippingMethod": "express", "couponCode": "WELCOME10" },
"attribution": { "source": "facebook", "medium": "paid", "campaignCode": "OCT-LAUNCH", "adRef": "video-a" }
}
Fields#
| Field | Type | Required | Notes |
|---|---|---|---|
externalId | string ≤ 100 | yes | Your order number or id. Unique within your platform. |
customer | object | yes | Same fields as a customer push, but externalId is optional here. Needs a name and a phone or email. |
items[] | array ≤ 500 | Defaults to []. | |
items[].name | string ≤ 300 | yes | |
items[].qty | integer ≥ 1 | yes | |
items[].unitPrice | number ≥ 0 | yes | Major units (1200.50). |
items[].productExternalId, items[].sku, items[].category | string | Products are added to the CRM catalogue the first time they appear. | |
total | number ≥ 0 | yes | What the customer pays, after discounts, tax and shipping. |
currency | ISO 4217 | e.g. KES. Defaults to the tenant's currency. | |
paymentStatus | enum | pending (default), partial, paid, failed, refunded | |
deliveryStatus | enum | pending (default), dispatched, delivered, returned | |
status | enum | placed (default), confirmed, completed, cancelled | |
channel | string ≤ 40 | Where it was placed: website, android, ios, app, showroom, phone, telegram, whatsapp… Also the fallback marketing source. | |
placedAt | ISO 8601 | yes | When the customer placed the order. |
updatedAt | ISO 8601 | strongly recommended | When the order last changed on your side; decides which snapshot is newest. |
metadata | object | Up to 50 flat keys (strings, numbers, booleans, null) for your own data. Returned as-is. | |
attribution | object | See Attribution. |
Response#
{ "status": "processed", "eventId": "clx…", "orderId": "clx…", "customerId": "clx…", "leadId": "clx…", "created": true, "stale": false }
| Field | Meaning |
|---|---|
created | true the first time this order was seen |
stale | true when this snapshot was not newer than the stored one, so nothing changed |
duplicate | present and true when this exact delivery was already processed; the original result is returned |
leadId | the open sales lead the order was linked to, if there was one |
Orders are processed straight away and answer 200. If the CRM has a temporary problem, it may answer 202 {"status":"accepted"}. It has then kept the order and will finish it in the background, so you do not need to resend.
Snapshots and ordering#
- Send everything, every time. A push replaces the stored items, total and statuses. Fields you leave out go back to their defaults, so always send the current statuses.
updatedAtdecides. A snapshot whoseupdatedAtis not newer than the stored one is ignored (stale: true). A slow retry can therefore never move an order backwards, such as fromdeliveredback topending. WithoutupdatedAt,placedAtis used, which means only the first push counts. Always sendupdatedAt.- Retries are safe. The same order with the same
updatedAtis recognised as a duplicate. - The customer is fixed at creation. Later snapshots can fill blanks on that customer's profile, but they cannot move the order to a different customer.
Statuses and the sales pipeline#
When an order arrives for a customer with an open sales lead in the CRM, the lead moves forward on its own:
| Order state | Lead moves to |
|---|---|
| any new order | Order placed |
paymentStatus: "paid" | Paid |
deliveryStatus: "delivered" or status: "completed" | Delivered (closes the lead) |
status: "cancelled" | no change |
Customer totals use non-cancelled orders. Revenue counts only paid orders.
Attribution#
Optional. It tells the CRM which campaign or channel brought the order in. Send what you captured when the visitor arrived (UTM parameters, click ids):
| Field | Example | Notes |
|---|---|---|
source | facebook, tiktok, google, newsletter | Unknown values are kept as other until an admin maps them. direct / none mean no source. |
medium | paid, social, email | |
campaignCode | OCT-LAUNCH | Matches a campaign code set up in the CRM |
adRef | video-a | Ad or creative within the campaign |
term | desk lamp | Search term |
referralCode | SELAM10 | Influencer, affiliate or salesperson code |
clickIds | { "fbclid": "…", "gclid": "…", "ttclid": "…" } | |
landingUrl, referrer | URLs | |
firstTouchAt, lastTouchAt | ISO 8601 |
The CRM decides the source by checking the referral code first, then the campaign code, the source value, the click ids and finally channel. A customer's original source is set by their first contact and is never overwritten by later orders.
Read orders#
These need the orders.read scope. Responses are paged the same way as customers.
# By your own order id (your key's platform is assumed)
curl "https://api.abbaycrm.com/v1/integrations/orders?externalId=1001" -H "x-api-key: am_…"
# One order by CRM id
curl https://api.abbaycrm.com/v1/integrations/orders/clx… -H "x-api-key: am_…"
# A customer's orders, or everything that changed since a time
curl "https://api.abbaycrm.com/v1/integrations/orders?customerId=clx2…" -H "x-api-key: am_…"
curl "https://api.abbaycrm.com/v1/integrations/orders?updatedSince=2026-10-01T00:00:00Z&paymentStatus=paid" -H "x-api-key: am_…"
Filters: externalId (with optional platform), platform (crm = entered by staff in the CRM), customerId, status, paymentStatus, deliveryStatus, updatedSince, cursor, limit (1–200, default 50).
The order object#
{
"object": "order",
"id": "clx…",
"platform": "shopify",
"externalId": "1001",
"customerId": "clx2…",
"status": "confirmed",
"paymentStatus": "paid",
"deliveryStatus": "pending",
"total": 2400,
"currency": "ETB",
"channel": "website",
"items": [
{ "productExternalId": "P-7", "sku": "LAMP-BLK", "name": "Desk lamp", "category": "Lighting", "quantity": 2, "unitPrice": 1200, "lineTotal": 2400 }
],
"attribution": { "source": "facebook", "campaignCode": "OCT-LAUNCH", "referralCode": null, "adRef": "video-a" },
"metadata": { "shippingMethod": "express", "couponCode": "WELCOME10" },
"placedAt": "2026-10-06T09:30:00.000Z",
"platformUpdatedAt": "2026-10-06T09:31:00.000Z",
"createdAt": "2026-10-06T09:31:01.020Z",
"updatedAt": "2026-10-06T09:31:01.020Z"
}
Orders entered by staff in the CRM have platform: "crm" and an externalId like M-20261006-4F2A. Subscribe to webhooks to hear about them.