Skip to main content
INRA can notify your system when an offline order is identified, completed, or cancelled, so you do not have to poll continuously. Database orders complete in the place-order response and do not depend on a callback, though you can still read them from GET /v1/orders.

Registering a URL

Callbacks are configured by INRA, not through the API. Email the HTTPS URL you want to use to inraasth@inra.co.th. After a short review we register:
  • the URL
  • any extra allowed hosts (for a test destination)
  • a signing secret, which we send to you once, out of band
There is one callback URL per client. It cannot be set per order. v1 has no self-service endpoint for changing the URL or rotating the signing secret; ask us to do that. GET /v1/webhook shows what is configured and the last delivery. The signing secret is never returned (secret_configured is a boolean).

Request shape

Event types currently sent: Each callback is an HTTPS POST with a JSON body:
Headers you should read:

Verify the signature

The signed string is <X-INRA-Timestamp>.<raw body> (the exact bytes of the body, not a re-serialised JSON document). The header value is v1= followed by the hex digest of HMAC-SHA256 over that string, using the signing secret.
Rules:
  • Reject timestamps older than five minutes (clock skew included).
  • De-duplicate on X-INRA-Event-Id (or event_id in the body).
  • Answer with a 2xx within 10 seconds. Other answers, and timeouts, are retried with backoff for about 35 hours.
  • Fetch the order and the report from the API after you accept the event. Treat the callback as a signal, not as the only copy of the data.

Test ping

POST /v1/webhook/test queues a signed webhook.ping to the configured URL. You may pass a url whose host is on the allowed-hosts list. Check the outcome with GET /v1/webhook.
If no callback URL has been registered, or the optional test url is not on the allowed-hosts list, the API returns 422 with the code callback_url_not_allowed. If the delivery path is temporarily unavailable you may see 503 with the code service_unavailable.