Skip to content

Webhooks ​

VikiPay POSTs JSON events to your HTTPS callback URL. Event types include payment.succeeded, payment.failed, payment.canceled, and payment.expired.

Signature ​

The X-Signature header is sha256= followed by hex(HMAC-SHA256(secret, "<unix_ts>." + raw_body)).

Node.js ​

js
import crypto from 'node:crypto'

function verify(secret, rawBody, signatureHeader) {
  const ts = signatureHeader.match(/^t=(\d+)/)?.[1]
  const sig = signatureHeader.match(/v1=([a-f0-9]+)/)?.[1]
  if (!ts || !sig) return false
  const expected = crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex')
  return crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))
}

Go ​

go
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(ts + "." + rawBody))
expected := hex.EncodeToString(mac.Sum(nil))

Similar HMAC patterns apply in PHP and Python (hmac.new(secret, f"{ts}.{body}".encode(), sha256)).

Retries ​

Failed deliveries retry up to 9 times with backoff from 30 seconds up to about 12 hours (±20% jitter). Use the event id header for idempotency. You can replay a delivery from the dashboard when supported.