Test mode

Build and test your whole integration without moving real money.

Every account has a test mode and a live mode, fully separated. Requests made with a test key (kp_test_… or rk_test_…) go to a sandbox bank instead of AYA Bank, and every object they create has livemode: false. Test keys work from the moment you sign up, before your account is reviewed.

What works the same

  • Payments, refunds, payment links, events and webhooks behave exactly as in live mode.
  • The hosted checkout shows a real, scannable-looking QR and polls for the status.
  • Webhooks are signed and retried the same way. A webhook endpoint can listen to test, live or both modes.
  • The balance and payouts are tracked separately for test mode.

Simulating the customer

Nobody can pay a test QR with a real banking app. Instead, the hosted checkout of a test payment (its checkout_url) shows a Test mode banner and two buttons:

ButtonResultEvent
Simulate paymentStatus becomes succeeded, fees and net are setpayment.succeeded
Simulate failureStatus becomes failedpayment.failed

If you draw the QR yourself, open the payment's checkout_url in a browser to press the buttons. To test expiry, create a payment with a short expires_in_minutes and wait: it becomes expired and sends payment.expired. To test cancelling, call cancel.

A payment that expires in 1 minute
curl https://sandbox-api.klinkpay.net/v1/payments \
  -X POST \
  -H "Authorization: Bearer kp_test_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "reference": "expiry-test",
    "expires_in_minutes": 1
  }'

Going live

Nothing in your code changes except the key. When your account is active, create a kp_live_ key and a webhook endpoint for live mode (or one for both), and use them in production.

Never share test and live keys in the same environment variable across environments. Keep test keys in staging and live keys in production.