Webhooks and events
| Endpoint | Description |
|---|---|
POST /v1/webhook_endpoints | Register a webhook endpoint |
GET /v1/webhook_endpoints | List webhook endpoints |
GET /v1/ws/events | Browser realtime events (WebSocket) |
Payment, refund, settlement and other outcomes are produced asynchronously. Kuvex delivers events on two channels:
| Channel | Receiver | Reliability | Purpose |
|---|---|---|---|
| Webhook | Your server | Signed, retried on failure | Authoritative source for business state |
| WebSocket | Browser page | No retry | Realtime UI updates |
Register a webhook endpoint
POST /v1/webhook_endpointsRegisters a URL that receives all events of the account.
| Item | Value |
|---|---|
| Auth | Live 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
| Parameter | Type | Required | Description |
|---|---|---|---|
url | String | Yes | Public HTTPS URL |
Response: 201 Created
{ "id": "we_2kN8qT5wX1mV7pL4sR9b", "url": "https://yourapp.com/hooks/kuvex", "enabled": true,
"created_at": "2026-11-30T12:00:00Z", "secret": "whsec_..." }| Field | Type | Description |
|---|---|---|
secret | String | Signing secret, whsec_ prefix. Returned only on creation; store it on your server |
GET /v1/webhook_endpoints lists registered endpoints without secret.
Errors
| HTTP | Code | Description | Retriable |
|---|---|---|---|
| 400 | webhook_url_blocked | URL is localhost, a private network or non-public address | No |
| 403 | webhook_account_key_required | Test key of a real account; configure in the Dashboard | No |
Delivery format
Kuvex sends a POST with a JSON body:
{
"id": "evt_6tR2kW9nQ4xM1pV8sL3b",
"type": "payment.completed",
"created_at": "2026-11-30T18:24:11Z",
"data": {
"payment": { "id": "pay_3kTq9xV2mB7nL4pR8sWz", "status": "succeeded", "amount_cents": 3000 }
}
}| Field | Type | Description |
|---|---|---|
id | String | Event ID, evt_ prefix; use it for deduplication |
type | String | Event type, see Event types |
created_at | String | Event time, ISO 8601 (UTC) |
data | Object | Event 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:
kuvex-signature: t=1764527051,v1=5f2b8c...e9a1| Part | Description |
|---|---|
t | Signing time, Unix seconds |
v1 | HMAC-SHA256(secret, "{t}.{raw body}"), hex |
Requirements:
- Compute over the raw request bytes; do not parse and re-serialize the JSON.
- Compare
v1in constant time. - Reject requests whose
tdiffers from your clock by more than 300 seconds. - Record the event
idand apply the business change in one database transaction, then respond200.
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
| Event | Trigger |
|---|---|
payment.completed | Payment succeeded. Also when an offline approval is confirmed, a payment under review resolves as paid, or a capture succeeds |
payment.partially_approved | Partial approval |
payment.offline_approved | Offline approval, not yet sent to the issuer |
payment.offline_declined | Offline approval declined on upload; reason in data.processor_code |
payment.failed | Payment failed, nothing charged: declined, card not read, or never reached the terminal |
payment.canceled | Canceled before card read, or voided. reason=authorization_expired when an expired authorization is voided automatically |
payment.review_required | Outcome 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.refunded | Refund succeeded; data.refund_id identifies it |
payment.signature_captured | Cardholder signature uploaded; data.signature has captured_at, sha256 |
Refunds, voids, captures, tips
| Event | Trigger |
|---|---|
refund.failed | Refund failed |
refund.review_required | Refund outcome unknown; do not refund again |
void.failed | Void declined (e.g. already settled); refund instead |
void.review_required | Void outcome unknown; do not void or refund again |
capture.failed | Capture failed |
tip.failed | Tip adjustment failed. A successful adjustment sends no event |
tip.review_required | Tip adjustment outcome unknown (data.tip_id); do not adjust again until resolved |
Collections
| Event | Trigger |
|---|---|
collection.completed | Collection fully paid (data.collection, data.final_payment_id); sent once |
Printing
| Event | Trigger |
|---|---|
print.succeeded | Printed |
print.failed | Not printed; data.reason: printer_unreachable, printer_not_configured, printer_needs_attention, print_rejected, print_failed |
print.delivery_unknown | Terminal 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
| Event | Trigger |
|---|---|
settlement.completed | Settlement succeeded (data.settlement) |
settlement.failed | Settlement failed |
settlement.review_required | Settlement 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
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.
| Item | Value |
|---|---|
| Auth | Query 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
| HTTP | Code | Description | Retriable |
|---|---|---|---|
| 401 | session_token_required | Token is not a kvs_ browser session token | No |
| 401 | session_expired | Token expired | No |
Store hosts
Store hosts in companion mode do not receive webhooks; they poll Retrieve a payment at about 1-second intervals.