Appearance
Quickstart
This guide shows how to accept payments with a Bearer API key (pk_…), send payers to the hosted checkout page, and verify webhooks.
Quick start
Get an API key — Merchant admin → Settings → API keys. Create a key with
payments:readandpayments:write. Store the secret once; only the hash is kept server-side.Configure a webhook — Set your HTTPS callback URL and copy the signing secret when you rotate it.
Create a payment (one call; confirm runs automatically by default):
bash
export API_BASE="https://api.vikipay.io"
export API_KEY="pk_your_secret"
curl -sS -X POST "$API_BASE/api/v1/payments" \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: order-$(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"amount": 57000,
"currency": "ARS",
"external_id": "order-1001",
"success_url": "https://merchant.example/paid",
"fail_url": "https://merchant.example/failed"
}'The response includes checkout_url — redirect the payer there (or open it in a browser):
json
{
"id": "pi_…",
"status": "requires_action",
"checkout_url": "https://pay.vikipay.io/r/pi_…",
"amount_minor": 57000,
"currency": "ARS"
}- Receive webhooks when the payment reaches a terminal state (
payment.succeeded,payment.failed,payment.canceled, orpayment.expired).
To use the legacy two-step flow, send "auto_confirm": false on create and call POST /api/v1/payments/{id}/confirm with a new Idempotency-Key.
Payment statuses
| Status | Meaning |
|---|---|
pending | Created, not yet confirmed (only when auto_confirm is false) |
requires_action | Payer must complete transfer on the checkout page |
processing | Provider is processing |
succeeded | Paid and captured |
failed | Definitive failure |
expired | Order lifetime elapsed |
canceled | Canceled before capture |
Errors
Errors are JSON: {"error":{"code":"…","message":"…","request_id":"…"}}.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_argument | Bad body, missing Idempotency-Key |
| 401 | unauthorized | Missing or invalid API key |
| 403 | access_denied | Scope or suspended merchant |
| 404 | not_found | Unknown payment id |
| 409 | duplicate_external_id / conflict | Idempotency or order clash |
| 422 | no_capable_provider | Merchant has no active terminal |
Webhooks
Event types
payment.succeeded— funds captured (including manual review acceptance)payment.failed— terminal failure (including manual review rejection)payment.canceled— payer or provider canceled before capturepayment.expired— checkout window ended
Envelope:
json
{
"id": "evt_…",
"type": "payment.succeeded",
"created_at": "2026-01-15T12:00:00Z",
"data": {
"id": "pi_…",
"status": "succeeded",
"amount_minor": 57000,
"currency": "ARS",
"merchant_id": "mer_…",
"captured_minor": 57000,
"external_id": "order-1001"
}
}data is provider-neutral (no provider name or upstream ids).
Headers
| Header | Description |
|---|---|
X-Webhook-Id | Event id (use for idempotency) |
X-Webhook-Timestamp | Unix seconds when the delivery was signed |
X-Webhook-Signature | sha256=<hex> HMAC of timestamp + "." + raw_body |
Reject requests when |now - timestamp| > 5 minutes.
Verify with curl (OpenSSL)
bash
BODY='…raw body…'
TS='1736935200'
SECRET='whsec_…'
SIG=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //')
# compare to header value without the sha256= prefixNode.js
javascript
const crypto = require('crypto');
function verify(secret, rawBody, timestamp, signatureHeader) {
const expected = crypto.createHmac('sha256', secret)
.update(`${timestamp}.${rawBody}`)
.digest('hex');
const got = signatureHeader.replace(/^sha256=/, '');
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(got));
}Python
python
import hmac, hashlib
def verify(secret: str, raw_body: bytes, timestamp: str, signature: str) -> bool:
msg = f"{timestamp}.".encode() + raw_body
expected = hmac.new(secret.encode(), msg, hashlib.sha256).hexdigest()
got = signature.removeprefix("sha256=")
return hmac.compare_digest(expected, got)PHP
php
function verify_webhook(string $secret, string $rawBody, string $timestamp, string $signature): bool {
$expected = hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret);
$got = str_starts_with($signature, 'sha256=') ? substr($signature, 7) : $signature;
return hash_equals($expected, $got);
}Retries and ACK
Return 2xx quickly. Non-2xx responses are retried on a fixed schedule (delays after failed attempts 1–8: 30s, 2m, 10m, 30m, 1h, 3h, 6h, 12h), with a small jitter on each delay, for up to 9 delivery attempts (~23 hours of retry spacing after the first try). Operations Resend bypasses the schedule and requeues immediately. Duplicates share the same X-Webhook-Id — treat processing as idempotent.
Idempotency (API)
Every POST that creates or confirms a payment requires Idempotency-Key. Repeating the same key with the same body returns the original result without double-charging.
API reference
See docs/api/openapi-v1.yaml for paths, Bearer auth (pk_), scopes, and schemas.