K-LINK Pay Docs · K-LINK Pay · llms.txt

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 a real one, 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.
  • Refunds are requests in test mode too: a test refund is created with status manual and sends refund.pending. It is not refunded instantly; it stays manual until it is marked done, then sends refund.succeeded.
  • 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:

Button Result Event
Simulate payment Status becomes succeeded, fees and net are set payment.succeeded
Simulate failure Status becomes failed payment.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.

curl https://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.

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