From sandbox to live
The checks to pass in the sandbox, then the switch to production keys.
30 minScope: readWhat you get
- A go-live checklist your team can tick.
- Production keys and a production webhook secret, separate from the sandbox ones.
- A first production call and a way to watch deliveries.
Pass the checks in the sandbox
Before going live, each of these works in the sandbox:
GET /merchants?limit=1answers200· everyPOSTandPATCHsends anIdempotency-Key· creating a merchant withoutregistry_idanswers422 invalidand creating the same merchant twice answers409 exists·a review started,review.readyreceived with its signature checked,GET /reviews/{id}read · your receiver accepts every signed sample and refuses a changed byte · it ignores a repeated deliveryid(press Send a test twice) · it handlesreview.failed· on429it waitsRetry-Afterseconds · it accepts alert kinds and reason codes it doesn't know yet.Make production keys
Switch to your real organisation in Kvali and create new keys there: sandbox keys never touch your real merchants. Add your production webhook endpoint and copy its new secret. Store both in your secret store under new names.
Switch your settings, not your code
Your code reads the key, the secret and the address from its settings, so going live is a change of settings.
# production settings (your secret store) KVALI_KEY="kv_live_…" # a key of your real organisation KVALI_WEBHOOK_SECRET="whsec_…" # the production endpoint's secretMake the first production call
Read one merchant with the production key. Then let your back office tell Kvali when a merchant goes live:
PATCH /merchants/{id}withstatus: livestarts its daily checks.curl -X PATCH "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10" \ -H "Authorization: Bearer $KVALI_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"status":"live"}'const res = await fetch("https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", { method: "PATCH", headers: { Authorization: `Bearer ${process.env.KVALI_KEY}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() }, body: JSON.stringify({ "status": "live" }), }); if (!res.ok) throw new Error((await res.json()).error.message); const { data } = await res.json();import os, uuid import requests res = requests.patch( "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", headers={"Authorization": f"Bearer {os.environ['KVALI_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "status": "live", }, timeout=30, ) if not res.ok: raise RuntimeError(res.json()["error"]["message"]) data = res.json()["data"]Watch the first deliveries
For the first days, look at what your receiver answered.
GET /webhooks/deliveries?status=failedshould stay empty.curl "https://aikvali.com/api/v1/webhooks/deliveries?status=failed&limit=25" \ -H "Authorization: Bearer $KVALI_KEY"const res = await fetch("https://aikvali.com/api/v1/webhooks/deliveries?status=failed&limit=25", { headers: { Authorization: `Bearer ${process.env.KVALI_KEY}` }, }); if (!res.ok) throw new Error((await res.json()).error.message); const { data } = await res.json();import os import requests res = requests.get( "https://aikvali.com/api/v1/webhooks/deliveries?status=failed&limit=25", headers={"Authorization": f"Bearer {os.environ['KVALI_KEY']}"}, timeout=30, ) if not res.ok: raise RuntimeError(res.json()["error"]["message"]) data = res.json()["data"]