Webhooks

Receive real-time transaction results on your own server via HMAC-SHA256-signed webhook URLs.

Webhooks deliver the final result of a transaction to your server in real time. Because POST /api/payments/performTransaction returns only PROCESS/100, a registered webhook is how you learn whether a transaction was approved or declined.

The flow is: generate a signed URL, register it for a terminal, then receive callbacks on your server. A testing endpoint lets you fire a simulated notification before going live.

Generate webhook URL — POST /api/webhooks/generate-url

Generates a signed webhook URL with HMAC-SHA256 authentication.

Request parameters

ParameterTypeRequiredDescription
clientIdstringYesYour client identifier
terminalIdstringYesTerminal to receive notifications for
secretKeystringYesSecret key for URL signing
baseUrlstringYesYour server's base URL
webhookPathstringYesPath to receive webhook callbacks
signatureAlgorithmstringYesSigning algorithm (HMAC_SHA256)
tokenExpiryHoursstringYesToken validity in hours
retryAttemptsstringYesNumber of retry attempts on failure

Request

{
  "clientId": "merchant1",
  "terminalId": "8184000200000077",
  "secretKey": "pos123",
  "baseUrl": "https://app.hooklistener.com",
  "webhookPath": "w/my-first-endpoint-2mtj",
  "signatureAlgorithm": "HMAC_SHA256",
  "tokenExpiryHours": "24",
  "retryAttempts": "3"
}

Response

{
  "success": true,
  "message": "Webhook URL generated successfully",
  "webhookUrl": "https://app.hooklistener.com/w/my-first-endpoint-2mtj?token=...",
  "generatedAt": "2026-03-25T12:24:38.997616332",
  "expiresAt": "2026-03-26T12:24:38.997616332",
  "details": {
    "webhookPath": "w/my-first-endpoint-2mtj",
    "baseUrl": "https://app.hooklistener.com",
    "clientId": "merchant1",
    "terminalId": "8184000200000077",
    "tokenExpiryHours": 24,
    "retryAttempts": 3,
    "algorithm": "HMAC_SHA256"
  }
}

Register webhook — POST /api/webhooks/register

Registers a webhook URL to receive transaction notifications for a terminal.

Request parameters

ParameterTypeRequiredDescription
terminalIdstringYesTerminal to register webhook for
callbackUrlstringYesGenerated webhook URL with token
secretKeystringYesSecret key for verification

Request

{
  "terminalId": "8184000200000077",
  "callbackUrl": "https://app.hooklistener.com/w/my-first-endpoint-2mtj?token=...",
  "secretKey": "pos_secret_123"
}

Response

{
  "status": "SUCCESS",
  "message": "Webhook URL registered successfully",
  "terminalId": "8184000200000077",
  "callbackUrl": "https://app.hooklistener.com/w/my-first-endpoint-2mtj?token=...",
  "registeredAt": "2025-12-26T05:50:29.928462500Z",
  "instructions": "You will receive webhook notifications at this URL",
  "registrationInfo": {
    "clientIdentifier": "merchant1",
    "terminalId": "8184000200000077",
    "registeredAt": "2025-12-26T05:50:29.927467300Z",
    "expiresAt": "2025-12-27T05:50:29.927467300Z",
    "isExpired": "false",
    "secretPresent": "true"
  }
}

Receive webhook notification — POST /api/webhooks/receive?token={token}

This is the endpoint on your server that receives real-time transaction notifications from the middleware. The token query parameter is required for authentication and is included automatically in the generated webhook URL. The middleware calls this endpoint when a transaction completes.

Request parameters (all optional; populated per transaction)

ParameterTypeDescription
transactionIdstringTransaction identifier
transactionTypestringType of transaction (e.g. PURCHASE)
panNumberstringMasked card PAN number
transactionAmountstringTransaction amount
responseCodestringResponse code from the terminal
responseMessagestringResponse message
rrnstringRetrieval Reference Number
authCodestringAuthorization code
tidstringTerminal ID
midstringMerchant ID
batchNostringBatch number
dateTimestringTransaction date and time
cardEntryModestringHow the card was entered
merchantNamestringMerchant name
merchantAddressstringMerchant address
signaturestringTransaction signature

Request

{
  "transactionId": "TXN1001",
  "transactionType": "PURCHASE",
  "panNumber": "455********676",
  "transactionAmount": "150"
}

Notify webhook (testing) — POST {registeredWebhookUrl}

For testing only. Call this using the full registered webhook URL (including its token) as the endpoint — the same URL returned by Generate Webhook URL and stored during Register Webhook. Sending a POST with a simulated transaction body lets you verify your receiver processes notifications correctly before live transactions occur.

POST https://app.hooklistener.com/w/my-first-endpoint-2mtj?token=bmFtaTo4MTg0MD...

Request parameters (all optional)

ParameterTypeDescription
transactionIdstringTransaction identifier to simulate
transactionTypestringType of transaction (e.g. PURCHASE)
panNumberstringMasked card PAN number
transactionAmountstringTransaction amount
responseCodestringResponse code
responseMessagestringResponse message
rrnstringRetrieval Reference Number
authCodestringAuthorization code
tidstringTerminal ID
midstringMerchant ID

Request

{
  "transactionId": "TXN1001",
  "transactionType": "PURCHASE",
  "panNumber": "455********676",
  "transactionAmount": "150"
}

Response

{
  "message": "Notification sent successfully",
  "status": "SUCCESS"
}

📘

Verify the signature on every callback

Webhook URLs are signed with HMAC-SHA256 using your secretKey. Validate the signature on each received notification before trusting its contents, and have your receiver tolerate retries (retryAttempts) idempotently using transactionId / rrn.