Skip to content

Webhooks and events ​

EndpointDescription
POST /v1/webhook_endpointsRegister a webhook endpoint
GET /v1/webhook_endpointsList webhook endpoints
GET /v1/ws/eventsBrowser realtime events (WebSocket)

Payment, refund, settlement and other outcomes are produced asynchronously. Kuvex delivers events on two channels:

ChannelReceiverReliabilityPurpose
WebhookYour serverSigned, retried on failureAuthoritative source for business state
WebSocketBrowser pageNo retryRealtime UI updates

Register a webhook endpoint ​

http
POST /v1/webhook_endpoints

Registers a URL that receives all events of the account.

ItemValue
AuthLive secret key, or the test key of an anonymous sandbox. Test mode of a real account is configured in the Dashboard under Developers → Webhooks

Request body

ParameterTypeRequiredDescription
urlStringYesPublic HTTPS URL

Response: 201 Created

json
{ "id": "we_2kN8qT5wX1mV7pL4sR9b", "url": "https://yourapp.com/hooks/kuvex", "enabled": true,
  "created_at": "2026-11-30T12:00:00Z", "secret": "whsec_..." }
FieldTypeDescription
secretStringSigning secret, whsec_ prefix. Returned only on creation; store it on your server

GET /v1/webhook_endpoints lists registered endpoints without secret.

Errors

HTTPCodeDescriptionRetriable
400webhook_url_blockedURL is localhost, a private network or non-public addressNo
403webhook_account_key_requiredTest key of a real account; configure in the DashboardNo

Delivery format ​

Kuvex sends a POST with a JSON body:

json
{
  "id": "evt_6tR2kW9nQ4xM1pV8sL3b",
  "type": "payment.completed",
  "created_at": "2026-11-30T18:24:11Z",
  "data": {
    "payment": { "id": "pay_3kTq9xV2mB7nL4pR8sWz", "status": "succeeded", "amount_cents": 3000 }
  }
}
FieldTypeDescription
idStringEvent ID, evt_ prefix; use it for deduplication
typeStringEvent type, see Event types
created_atStringEvent time, ISO 8601 (UTC)
dataObjectEvent data. For payment, refund, void, capture and tip events, data.payment holds the full payment fields

Acknowledgement and retries: respond 2xx within 10 seconds. On timeout or non-2xx, Kuvex retries after 10 s, 1 min, 5 min, 30 min and 2 h. An event can be delivered more than once; process it idempotently by id.

Signature verification ​

Each delivery carries a kuvex-signature header:

http
kuvex-signature: t=1764527051,v1=5f2b8c...e9a1
PartDescription
tSigning time, Unix seconds
v1HMAC-SHA256(secret, "{t}.{raw body}"), hex

Requirements:

  1. Compute over the raw request bytes; do not parse and re-serialize the JSON.
  2. Compare v1 in constant time.
  3. Reject requests whose t differs from your clock by more than 300 seconds.
  4. Record the event id and apply the business change in one database transaction, then respond 200.
js
import crypto from 'node:crypto';

function verifyKuvexSignature(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false;
  const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest('hex');
  const a = Buffer.from(expected);
  const b = Buffer.from(parts.v1 || '');
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

Complete example with PostgreSQL: /examples/webhook-receiver/.

Required events ​

A payment integration must handle at least: payment.completed, payment.partially_approved, payment.failed, payment.canceled, payment.review_required, payment.refunded. Handle others according to the features you use.

Event types ​

Payments ​

EventTrigger
payment.completedPayment succeeded. Also when an offline approval is confirmed, a payment under review resolves as paid, or a capture succeeds
payment.partially_approvedPartial approval
payment.offline_approvedOffline approval, not yet sent to the issuer
payment.offline_declinedOffline approval declined on upload; reason in data.processor_code
payment.failedPayment failed, nothing charged: declined, card not read, or never reached the terminal
payment.canceledCanceled before card read, or voided. reason=authorization_expired when an expired authorization is voided automatically
payment.review_requiredOutcome unknown; do not charge again. Ends with payment.completed or payment.failed. Also sent when a capture outcome is unknown (with data.capture_id)
payment.refundedRefund succeeded; data.refund_id identifies it
payment.signature_capturedCardholder signature uploaded; data.signature has captured_at, sha256

Refunds, voids, captures, tips ​

EventTrigger
refund.failedRefund failed
refund.review_requiredRefund outcome unknown; do not refund again
void.failedVoid declined (e.g. already settled); refund instead
void.review_requiredVoid outcome unknown; do not void or refund again
capture.failedCapture failed
tip.failedTip adjustment failed. A successful adjustment sends no event
tip.review_requiredTip adjustment outcome unknown (data.tip_id); do not adjust again until resolved

Collections ​

EventTrigger
collection.completedCollection fully paid (data.collection, data.final_payment_id); sent once
EventTrigger
print.succeededPrinted
print.failedNot printed; data.reason: printer_unreachable, printer_not_configured, printer_needs_attention, print_rejected, print_failed
print.delivery_unknownTerminal lost power or crashed while printing; output unknown, confirm with staff before reprinting

data: { id, object: "print_job", terminal_id, payment_id, status, reason }. Terminals without a printer send no print events.

Settlements ​

EventTrigger
settlement.completedSettlement succeeded (data.settlement)
settlement.failedSettlement failed
settlement.review_requiredSettlement outcome unknown; do not treat as failed

Reconciliation ​

reconciliation.daily.*, reconciliation.merchant_daily.*, reconciliation.settlement.*, reconciliation.case.resolved, reconciliation.incident.opened / acknowledged / resolved. See Reconciliation.

Unknown outcomes ​

When a terminal cannot confirm whether a capture, void, refund, tip adjustment or settlement succeeded (for example after losing connection mid-operation), Kuvex does not infer a result. It sends the corresponding *.review_required event, keeps verifying, and sends the final event once known. A payment that times out also receives payment.review_required first, then payment.completed or payment.failed.

Local testing ​

Kuvex does not deliver to localhost or private addresses, including in the sandbox. For local testing, expose the development port through a temporary public HTTPS tunnel such as Cloudflare Quick Tunnel or ngrok and register that URL. Do not use live keys through the tunnel; close it afterwards.

Browser realtime events ​

http
GET /v1/ws/events?token=kvs_...

WebSocket connection streaming one terminal's events for realtime UI updates. The browser SDK (kuvex.js) manages this connection.

ItemValue
AuthQuery parameter token: a browser session token. Never put a secret key in a URL

WebSocket delivery is not guaranteed; order state must be driven by server-side webhooks.

Errors

HTTPCodeDescriptionRetriable
401session_token_requiredToken is not a kvs_ browser session tokenNo
401session_expiredToken expiredNo

Store hosts ​

Store hosts in companion mode do not receive webhooks; they poll Retrieve a payment at about 1-second intervals.