تخطَّ إلى المحتوى

Acks

هذا المحتوى غير متوفر بلغتك بعد.

The cursor answers what changed. Acks answer what haven’t you taken yet — which survives a lost cursor, a restored database or a purged staging table.

Rejecting an order the ERP can't book

POST /orders/ord_01J9X/ack

نافذة طرفيّة
curl -X POST 'https://api.slflo.com/api/integration/v1/orders/ord_01J9X/ack' \
-H 'Authorization: Bearer $SLFLO_TOKEN' \
-H 'Idempotency-Key: SO-0012345' \
-H 'Content-Type: application/json' \
-d '{"outcome":"REJECTED","reason_code":"CUSTOMER_ON_HOLD","message":"Customer CUST-0042 is on hold in D365"}'

Response

HTTP 200
{
"data": {
"id": "ord_01J9X",
"number": "SO-000123",
"status": "ERP_FAILED",
"version": 18343,
"result": "applied",
"ack": {
"outcome": "REJECTED",
"reason_code": "CUSTOMER_ON_HOLD",
"message": "Customer CUST-0042 is on hold in D365",
"external_ref": null,
"external_number": null,
"acked_version": 18343,
"acked_at": "2026-10-05T10:42:00Z"
}
}
}
  • Order ACCEPTED → the order moves to ERP_CONFIRMED and remembers your key: it appears as the order’s external_ref, and filter[external_ref] and GET /lookup find it by it.
  • Order REJECTED → the order moves to ERP_FAILED. The office sees your message on the order and can send it again after fixing the cause (unblocking the customer, say). That makes it pending again, and your next pull sees it.
  • The ack is stored at a version — ack.acked_version in the answer. An order ack moves the order, so it is the order’s new version.
  • Invoices, payments, returns: POST /invoices/{id}/ack, /payments/{id}/ack, /returns/{id}/ack take the same body. The ack is kept at the version it answered: a document that changes after its ack — a reversed payment, a bounced cheque, and also a cheque that moves on (handed over, deposited, cleared) — is pending again until you ack its new version. That’s how you learn about it. A move that changes no money is answered with the same external_ref as before.
  • An invoice never changes once issued, and a credited return never does either, so their first ACCEPTED answer is final. A REJECTED one is not: when your office fixes the cause (links the shop, opens the period) and books the document after all, ack it ACCEPTED at the same version and SLFLO takes it (applied). The other way round is refused.
  • Your key must be unique per kind of document: an ACCEPTED external_ref that another payment already holds is 409 EXTERNAL_REF_CONFLICT. A journal number or a voucher shared by several payments is not unique — send a key of the payment’s own (for example <journal>-<line>) and put the shared number in external_number, which has no such rule. At a later version you may send a different external_ref: it replaces the one SLFLO held.

POST /acks (under Acks in the API reference) answers up to 500 documents of one kind — entity is order, invoice, payment or return — in one request:

{"entity": "payment",
"items": [{"id": "pay_01J9", "outcome": "ACCEPTED", "external_ref": "JRN-000881-3", "external_number": "JRN-000881"}]}

Each item gets its own result — applied, unchanged, or an error — and one bad item never fails the rest.

Situation Answer
The same ack again unchanged
A different answer for an order you already answered 409 ALREADY_ACKNOWLEDGED (unless the office sent it again since)
ACCEPTED after your REJECTED, for an invoice, payment or return at the same version applied
Any other different answer for an invoice, payment or return at the version you answered 409 ALREADY_ACKNOWLEDGED
Your key already used for another record 409 EXTERNAL_REF_CONFLICT
An order not waiting for the ERP 409 ORDER_NOT_AWAITING_ACK
The company isn’t in ERP mode API (orders only) 409 ERP_MODE_NOT_API — see ERP mode

A REJECTED ack says why in reason_code (capitals, digits and _, at most 64) and message (your ERP’s own text, at most 2,000; SLFLO keeps the first 500). Send at least one. For the codes below the console and the phone show the office plain words in English or Arabic, with your message beneath them as the detail — so put in message what your ERP saw (the account, the period, the infolog line). Any other code is shown as you sent it.

reason_codeThe office readsبالعربية
ALREADY_DELIVEREDThe ERP has already delivered goods for this order, so it can't change it there.سلّم نظام ERP بضاعة لهذا الطلب بالفعل، لذلك لا يمكنه تغييره هناك.
CREDIT_HOLDThis shop is over its credit limit in the ERP. Collect a payment or ask for a higher limit, then send it again.تجاوز هذا المحل حد الائتمان في نظام ERP. حصّل دفعة أو اطلب رفع الحد، ثم أرسله مرة أخرى.
CUSTOMER_ON_HOLDThis shop is on hold in the ERP. Ask the accountant to release it, then send it again.هذا المحل موقوف في نظام ERP. اطلب من المحاسب رفع الإيقاف، ثم أرسله مرة أخرى.
INVALID_DOCUMENTThe ERP can't take this document as it is. Its message says why.لا يستطيع نظام ERP قبول هذا المستند كما هو. رسالته توضّح السبب.
PERIOD_CLOSEDThe ERP's accounting period for this date is closed. Ask the accountant to open it, then send it again.الفترة المحاسبية لهذا التاريخ مغلقة في نظام ERP. اطلب من المحاسب فتحها، ثم أرسله مرة أخرى.
POSTING_FAILEDThe ERP couldn't post this. Its message says why.تعذّر على نظام ERP ترحيل هذا. رسالته توضّح السبب.
QUANTITY_EXCEEDS_INVOICEDMore is coming back than the ERP invoiced. Check the quantities against the invoice.الكمية المرتجعة أكبر مما فوترَه نظام ERP. راجع الكميات مقابل الفاتورة.
REVERSED_IN_SLFLOThis payment was reversed in SLFLO before the ERP booked it, so the ERP won't book it. Nothing more to do.عُكست هذه الدفعة في SLFLO قبل أن يسجّلها نظام ERP، لذلك لن يسجّلها. لا حاجة لأي إجراء.
TOTAL_MISMATCHThe ERP worked out a different total. Compare the prices and discounts with the ERP's.حسب نظام ERP إجماليًا مختلفًا. قارن الأسعار والخصومات بما في نظام ERP.
UNKNOWN_CUSTOMERThe ERP doesn't know this shop. Link the shop to its account in the ERP, then send it again.لا يعرف نظام ERP هذا المحل. اربط المحل بحسابه في نظام ERP، ثم أرسله مرة أخرى.
UNKNOWN_INVOICEThe ERP can't find the invoice this belongs to. Book that invoice in the ERP first.لا يجد نظام ERP الفاتورة التي يخصها هذا. سجّل تلك الفاتورة في نظام ERP أولاً.
UNKNOWN_ITEMThe ERP doesn't know one of the products. Link the product to its item in the ERP, then send it again.لا يعرف نظام ERP أحد الأصناف. اربط الصنف بصنفه في نظام ERP، ثم أرسله مرة أخرى.
UNKNOWN_METHODThe ERP has no payment method set up for this one. Ask the ERP administrator to map it.لا توجد في نظام ERP طريقة دفع مقابلة لهذه. اطلب من مسؤول نظام ERP ربطها.
UNKNOWN_UNITThe ERP doesn't know one of the units. Set the unit up for that product in the ERP, then send it again.لا يعرف نظام ERP إحدى الوحدات. أضف الوحدة لهذا الصنف في نظام ERP، ثم أرسله مرة أخرى.
UNMAPPED_REASONThe ERP has no return reason set up for this one. Ask the ERP administrator to map it.لا يوجد في نظام ERP سبب مرتجع مقابل لهذا. اطلب من مسؤول نظام ERP ربطه.
UNMAPPED_REPThis rep isn't set up in the ERP. Ask the ERP administrator to add the rep's code.هذا المندوب غير معرّف في نظام ERP. اطلب من مسؤول نظام ERP إضافة رمز المندوب.
UNMAPPED_WAREHOUSEThis van or warehouse isn't set up in the ERP. Ask the ERP administrator to link it.هذه السيارة أو هذا المخزن غير معرّف في نظام ERP. اطلب من مسؤول نظام ERP ربطه.

Today the office sees the reason on a refused order (the order page in the console, the order on the rep’s phone). A refused invoice, payment or return is kept with its ack and answered on filter[ack]=rejected, but no console screen shows it yet.

You may follow the cursor (stream style) or only filter[ack]=pending (queue style). The reference connector uses the cursor plus acks, and falls back to pending after a cursor reset.

Ack the sandbox’s first invoice with a journal number of yours, then send the same call again:

Terminal window
id=$(curl -sg "$SLFLO_BASE/invoices?filter[seq_after]=0&per_page=1" -H "Authorization: Bearer $SLFLO_TOKEN" | jq -r '.data[0].id')
for try in 1 2; do
curl -s -X POST "$SLFLO_BASE/invoices/$id/ack" -H "Authorization: Bearer $SLFLO_TOKEN" \
-H "Content-Type: application/json" -H "Idempotency-Key: ack-$id-$try" \
-d '{"outcome":"ACCEPTED","external_ref":"JRN-000001","external_number":"JRN-000001"}' | jq -c '.data | {result, acked_version: .ack.acked_version}'
done
# {"result":"applied","acked_version":…} then {"result":"unchanged","acked_version":…}

On the shared sandbox someone may have acked it already: then you see unchanged (the same answer) or 409 ALREADY_ACKNOWLEDGED (a different one), as the table above says.