Detecting Duplicate Requests

You can enable checking for duplicate requests by including the Simphony-Features header and value detect-duplicate-request as follows:

Simphony-Features:detect-duplicate-request

When enabled, you must provide a unique idempotentcyId value for each request.

Duplicate request detection can be enabled for:

  • POST/checks
  • POST/checks/{checkRef}/round

The system detects duplicate requests by comparing the idempotencyId of each incoming request against those from previous requests, which are retained for 300 seconds. If the same idempotencyId matches a prior successful request, the system does not process the new request and instead returns the original response. If a duplicate request is received while the initial request is still pending, the system waits up to 30 seconds for the first request to complete. If the response is available within that time, it is returned. Otherwise, an error message is sent. When a cached response is returned due to duplicate detection, the checks header includes the isCachedResponse property set to true, which is only provided if the feature is enabled.

POS Error Detail

If the transaction was sent but not yet processed by the POS, and you send another request with the same idempotencyId, the system returns the following error if key-value Simphony-Features: detect-duplicate-request was used in the header:

{
    "title": "POS Error",
    "status": 400,
    "detail": "The POS system is unable to process the request.",
    "instance": "error:pos-error",
    "posDetails": [
        {
            "code": "duplicate_request",
            "message": "duplicate request detected, no response found"
        }
    ]
}