Konbit payment API
Collect a payment from your customers' Konbit wallet. Integrate in a few lines, free sandbox.
How it works
Your server creates a payment intent. The customer pays it in their Konbit app with their PIN. You get a signed webhook and deliver your digital service.
1. Create an intent
One server call with the amount. You get a payment link and an id.
2. The customer pays
They open the link, confirm with their PIN. No fee for them: they pay the shown amount.
3. You get notified
A signed webhook confirms the payment. You deliver the service. The money lands on your Konbit balance.
amountMinor is an integer in the smallest unit: 10000 = 100.00 DOP. Never use decimals.
5-minute quickstart
Three steps: your server creates an intent, the customer pays it in Konbit, your server confirms the payment before delivering. Here is the full call and the real, annotated response.
curl -X POST https://app.getkonbit.com/api/v1/payment_intents \
-H "Authorization: Bearer sk_test_..." \
-H "Idempotency-Key: order-123" \
-H "Content-Type: application/json" \
-d '{"amountMinor":10000,"description":"Order 123","metadata":{"orderId":"order-123"},"returnUrl":"https://mon-site.com/merci"}'
{
"id": "9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d", // konbitRef · keep it
"object": "payment_intent",
"status": "REQUIRES_PAYMENT",
"testMode": true, // true in sandbox
"amountMinor": 10000, // 100,00 DOP
"currency": "DOP",
"description": "Order 123",
"metadata": { "orderId": "order-123" },
"feeMinor": 200, // our fee
"code": "562183", // manual entry / QR
"checkoutUrl": "https://app.getkonbit.com/pay/9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d",
"returnUrl": "https://mon-site.com/merci",
"expiresAtMs": 1792512900000, // milliseconds
"createdAtMs": 1792512000000
}
checkoutUrl: the page where the customer pays. code: manual entry or QR. feeMinor: our fee, withheld from your balance (the customer pays amountMinor). testMode: true with a test key. expiresAtMs: after this the intent becomes EXPIRED.
The redirect to returnUrl happens in the customer's browser and can be forged (just open the URL). NEVER deliver your service on the strength of the return alone. Always confirm server-side: signed webhook or a GET on the status.
Getting your access
Two levels, presented honestly.
Test key · instant
Generate an sk_test_ key below: valid 7 days, sandbox, no real money. Add a webhook URL to also get a whsec_ secret and signed webhooks; without a URL, track your payments by polling.
Merchant key · within 24 h
Write to us with your company and use case. We create a dedicated merchant: persistent key + signed webhook. Usually answered within 24 business hours. (Merchant self-service is coming; today we open it for you, for compliance.)
Keep the secret secret
The sk_ key is shown ONCE and lives server-side only: never in a browser, a mobile app, a Git repo or a URL. Store it in a secrets manager. Compromised? Ask for a rotation: the old one is revoked immediately.
Generate a test key
Try it right now, no account needed. A test key valid for 7 days, sandbox mode.
Valid 7 days. Test mode only.
Could not generate a key right now. Try again.
Pay a test intent (sandbox)
No Konbit account needed: call POST /v1/test/pay with the intent id. A synthetic payer settles it: it moves to SUCCEEDED, the signed webhook goes out (if you gave a URL) and your test balance grows. To test expiry, create an intent with expiresInSeconds: 60, wait, then call /test/pay again: 409 intent_expired.
curl -X POST https://app.getkonbit.com/api/v1/test/pay \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"intentId":"9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d"}'
# the intent moves to SUCCEEDED, the webhook goes out, GET /balance grows
The key generated here lives 7 days, in sandbox: no real money. It covers creating, reading and canceling intents, test payments (POST /v1/test/pay), signed webhooks, the balance and the exchange rate. Refunds, payouts, the card rail and resale are refused in sandbox (test_balance, merchant_key_required…): this is intended, and your code should handle these refusals. All keys start with sk_test_ today, production included: the mode is your account's, and every intent states it in testMode. For a persistent key and going live, write to us.
Payment intents
REQUIRES_PAYMENT: pending · SUCCEEDED: paid · EXPIRED: expired · CANCELED: canceled by you · REFUNDED: refunded.
Amounts
amountMinor is an integer in minor units (10000 = 100.00 DOP). Default bounds: 1,000 to 5,000,000, i.e. 10 to 50,000 DOP, adjustable for your account; the amount_out_of_bounds error states your bounds. DOP only. Lifetime: 60 to 3,600 s, 900 by default.
Idempotency-Key (required)
Required on creation. The SAME key (for your account) ALWAYS returns the same intent, with status 200, even under concurrent requests: no duplicate, no double charge. Use your order number: a network retry becomes harmless.
Reconciliation via metadata
Attach your identifiers (orderId, userId…) in metadata (20 keys max). They come back as-is in responses and webhooks, to match a payment to your order. They are never shown to the payer nor printed on their receipt (receiptLines does that); still, never put a secret in them.
API reference
Authenticate every request with your secret key in the Authorization header.
/v1/payment_intentsCreate a payment intent
curl -X POST https://app.getkonbit.com/api/v1/payment_intents \
-H "Authorization: Bearer sk_test_..." \
-H "Idempotency-Key: order-123" \
-H "Content-Type: application/json" \
-d '{"amountMinor":10000,"description":"Order 123","returnUrl":"https://mon-site.com/merci"}'
{
"id": "9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d",
"object": "payment_intent",
"status": "REQUIRES_PAYMENT",
"testMode": true,
"amountMinor": 10000,
"currency": "DOP",
"feeMinor": 200,
"code": "562183",
"checkoutUrl": "https://app.getkonbit.com/pay/9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d",
"expiresAtMs": 1792512900000,
...
}
Redirect your customer to checkoutUrl (or show the QR) so they can pay.
/v1/payment_intents/{id}Get a payment status
{ "id": "9f0c...", "object": "payment_intent", "status": "SUCCEEDED", "amountMinor": 10000, "feeMinor": 200, ... }
/v1/payment_intents/{id}/cancelCancel an intent still awaiting payment (webhook payment_intent.canceled). A second call returns 409 not_cancelable.
curl -X POST https://app.getkonbit.com/api/v1/payment_intents/9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d/cancel \
-H "Authorization: Bearer sk_test_..."
/v1/refundsRefund a SUCCEEDED payment in full (no partial refunds). The amount goes back to the customer's wallet, your balance is debited the same amount, our fee is kept. Window: 30 days by default.
curl -X POST https://app.getkonbit.com/api/v1/refunds \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"payment_intent":"9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d"}'
/v1/balanceGet your balance
{ "object": "balance", "balanceMinor": 9800, "totalFeesMinor": 200, "currency": "DOP" }
GET /v1/balance adds pendingPayoutsMinor: what your pending payouts have committed and is not debited yet.
/v1/payoutsPay part of your balance to the wallet of a driver or beneficiary, by their Konbit code (9 characters). Idempotency-Key required. Synchronous by default: 201 and SUCCEEDED, the money moves during the call.
Merchant key required (Konbit contract): portal test keys cannot pay out to a real wallet · their sandbox balance is fictitious.
curl -X POST https://app.getkonbit.com/api/v1/payouts \
-H "Authorization: Bearer sk_..." \
-H "Idempotency-Key: driver-42-2026-W42" \
-H "Content-Type: application/json" \
-d '{"konbitCode":"K7M2P9QRS","amountMinor":85000,"metadata":{"driverId":"drv_42"}}'
{ "id": "4c1b9e0d...", "object": "payout", "status": "SUCCEEDED", "amountMinor": 85000, "feeMinor": 0, "currency": "DOP", "konbitCode": "K7M2P9QRS", "metadata": { "driverId": "drv_42" }, "createdAtMs": 1792512000000 }
/v1/payoutsList your 100 most recent payouts, newest first (no pagination).
{ "object": "list", "data": [ { "id": "4c1b9e0d...", "object": "payout", ... } ] }
/v1/payouts/{id}Read a payout by id. Available to merchants in queue (asynchronous) mode, and to everyone once queue mode is opened platform-wide; otherwise 404 unknown_route: use the list.
{ "id": "4c1b9e0d...", "object": "payout", "status": "FAILED", "failureCode": "insufficient_balance", "processedAtMs": 1792512004000, ... }
/v1/fx_rateGet the USD to DOP rates set by Konbit, in DOP per 1 USD (micros: 58500000 = 58.50). "user" applies when the customer pays a DOP intent by card; "reference", the market rate, is for information and absent when not set. A DOP wallet payment converts nothing.
{ "object": "fx_rate", "base": "USD", "quote": "DOP", "rates": [ { "kind": "user", "rateMicros": 58500000, "updatedAtMs": 1794006605355 }, { "kind": "reference", "rateMicros": 59500000, "updatedAtMs": 1794006600609 } ] }
/v1/fx_quotesLock the "user" rate for ttlSeconds (60 to 3600, 3600 when omitted). Pass the id as fxQuoteId to POST /v1/payment_intents: a card payment is credited at that rate, even if Konbit has changed it since.
curl -X POST https://app.getkonbit.com/api/v1/fx_quotes \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"ttlSeconds":1800}'
{ "id": "q1Xb...", "object": "fx_quote", "kind": "user", "rateMicros": 58500000, "expiresAtMs": 1794008405355, ... }
The quote must last longer than the intent (expiresInSeconds).
For high payout volume (one per ride, for instance), Konbit can switch your account to asynchronous mode:
- POST /v1/payouts runs the same checks, except the balance, and answers 202 with status: PENDING.
- Konbit runs the queue within seconds, in acceptance order. The result arrives by webhook dop_payout.succeeded or dop_payout.failed, and can be read with GET /v1/payouts/{id}.
- A failure (failureCode: insufficient_balance, recipient_blocked…) is final and moves no money. To retry, send a NEW payout with a NEW Idempotency-Key: the same key returns the failed payout, and a key reused for another amount or beneficiary returns 409 idempotency_key_reused.
- GET /v1/balance adds pendingPayoutsMinor: what your pending payouts have committed and is not debited yet.
Idempotency
Idempotency-Key is required on every creation: intent, payout, card intent, Zelle batch, top-up order (128 characters max). The same key returns the resource already created, with status 200, without creating a second one, unless the content differs: the same key with other recipients or amounts returns 409 idempotency_key_reused (queued DOP payouts and USD batches). A refused request creates nothing: the same key can be retried. Refunds and cancellations take no key: a second call returns 409, so read the intent again.
Rate limit
Each key has a per-minute request quota. Beyond it: 429 too_many_requests, with no Retry-After header; retry in the next minute, with the same Idempotency-Key.
Other routes
USD rail (on activation, live accounts): POST /v1/card_payment_intents, GET /v1/card_payment_intents/{id}, POST /v1/card_payments/{id}/refund, POST /v1/usd_payouts, GET /v1/usd_payouts/{id}. Airtime resale (resellers under contract): /v1/airtime/operators, /credit, /quote, /orders. Keyless health probe: GET /v1/warm. Everything is described in the OpenAPI specification.
Specification and tools
The full contract (every route, every error code, the webhooks) is published as OpenAPI 3.1. Import it into your tool, or start from the Postman collection.
OpenAPI specification (YAML) Postman collection Full Node.js example
Payment statuses
REQUIRES_PAYMENT: pending · SUCCEEDED: paid · EXPIRED: expired · CANCELED: canceled by you · REFUNDED: refunded.
Error codes
Every error returns the same object: a stable code (to test against) and a readable message.
{ "error": { "code": "amount_out_of_bounds", "message": "..." } }
| Code | When |
|---|---|
401 unauthorized | Key missing, invalid, revoked or expired (a test key lives 7 days). |
429 too_many_requests | Per-minute request quota exceeded. Retry in the next minute. |
500 internal | Unexpected error at Konbit. Retry with the same Idempotency-Key. |
503 service_unavailable | Konbit Pay temporarily disabled. |
404 unknown_route | Unknown path or method. |
400 idempotency_key_required | Idempotency-Key header missing, empty or too long on a creation. |
400 invalid_amount400 amount_out_of_bounds | Amount outside the configured bounds, or not an integer. |
400 unsupported_currency | Currency other than DOP. |
400 invalid_return_url | returnUrl provided but not https. |
400 invalid_metadata400 invalid_receipt_lines400 invalid_payer_email | metadata over 20 keys, invalid receiptLines (6 lines max, non-empty label and value) or invalid payerEmail. |
400 invalid_request | Required field missing (payment_intent, intentId). |
404 not_found | Unknown resource, or one belonging to another merchant. |
409 not_cancelable409 not_refundable409 not_payable | Incompatible status: intent already paid, canceled, expired or refunded. |
409 card_paid_use_card_refund | Intent paid by card: refund through POST /v1/card_payments/{cardIntentId}/refund. |
409 refunds_disabled409 window_expired | Refunds disabled, or refund window exceeded. |
409 insufficient_balance | Merchant balance too low for the refund or payout. |
403 test_balance409 test_balance | Sandbox balance: it never leaves as a refund or a payout. |
403 merchant_key_required | Portal test key: payouts require a merchant key. |
400 invalid_code404 code_not_found | Beneficiary Konbit code malformed (400) or not found (404). |
409 recipient_blocked | Beneficiary account suspended or blocked. |
409 idempotency_key_reused | Asynchronous payout: key already used for another amount or beneficiary. |
403 test_only | POST /v1/test/pay called by a live merchant. |
409 intent_expired | The intent expired before the test payment; it becomes EXPIRED. |
503 fx_rate_unavailable | No USD to DOP rate is set. |
400 fx_quote_not_found400 fx_quote_expired400 fx_quote_expires_before_intent | fxQuoteId unknown for this account, expired, or expiring before the intent. |
The USD rail and airtime resale have their own codes too (card_collection_not_enabled, payouts_frozen, insufficient_credit…): the complete list, route by route, is in the OpenAPI specification.
Webhooks
Every state change triggers a signed JSON POST to your webhookUrl (public https). Header Konbit-Signature: t=<ms>,v1=<hmac>. Here is the exact envelope:
POST {webhookUrl}
Konbit-Signature: t=1720000000000,v1=<hmac_sha256>
{
"id": "Xq3vB8kR2mT6wY1zA4cE", // EVENT id · dedup
"type": "payment_intent.succeeded",
"createdAtMs": 1792512030000, // milliseconds
"data": {
"id": "9f0c2d1e7a4b5c6d8e9f0a1b2c3d4e5f6a7b8c9d", // intent id
"status": "SUCCEEDED",
"amountMinor": 10000,
"currency": "DOP",
"feeMinor": 200,
"description": "Order 123",
"metadata": { "orderId": "order-123" }
}
}
Event types
| Event | When |
|---|---|
payment_intent.succeeded | Payment succeeded. Re-check amount and currency, then deliver. |
payment_intent.payment_failed | An attempt failed (data.failureCode: insufficient_balance, payer_refused or card_declined). The intent stays payable: offer another method right away. |
payment_intent.expired | The intent expired unpaid. Close the order. |
payment_intent.canceled | You canceled the intent. |
payment_intent.refunded | Payment refunded. |
dop_payout.succeeded | Asynchronous payout executed. The event id is dop_payout_ followed by the payout id. |
dop_payout.failed | Asynchronous payout refused (data.failureCode). Final: resend with a new Idempotency-Key. |
card_payment.succeededcard_payment.refunded | USD rail: card payment captured or refunded (data = card intent). |
payout.paidpayout.failed | USD rail: Zelle line paid or failed (data.failureReason). |
The signature's t AND createdAtMs are in milliseconds since the epoch (13 digits). Pitfall #1: treating them as seconds fails the 5-minute window and you reject valid webhooks.
Verify the signature, step by step
1. Read the RAW body (unparsed). 2. Extract t and v1 from the header. 3. Reject if |now − t| > 5 min. 4. Compute HMAC-SHA256(webhook_secret, "<t>.<raw_body>"). 5. Compare to v1 in constant time. 6. Deduplicate on id (the EVENT id, not data.id).
Verification · copy-paste snippets
const crypto = require("crypto");
// IMPORTANT: raw body, not express.json() on this route
app.post("/konbit/webhook",
express.raw({ type: "application/json" }),
(req, res) => {
const raw = req.body; // raw body
const sig = req.get("Konbit-Signature") || "";
const parts = Object.fromEntries(sig.split(",").map(p => p.split("=")));
const t = Number(parts.t); // MILLISECONDS
if (!t || Math.abs(Date.now() - t) > 5 * 60 * 1000) return res.sendStatus(401);
const expected = crypto.createHmac("sha256", process.env.KONBIT_WEBHOOK_SECRET)
.update(t + "." + raw.toString("utf8")).digest("hex");
const a = Buffer.from(expected), b = Buffer.from(parts.v1 || "");
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) return res.sendStatus(401);
const event = JSON.parse(raw.toString("utf8"));
if (alreadyProcessed(event.id)) return res.sendStatus(200); // dedup on event.id
// re-check amountMinor and currency against your order
markProcessed(event.id);
fulfill(event.data.metadata.orderId);
res.sendStatus(200);
});
<?php
$raw = file_get_contents("php://input"); // raw body
$sig = $_SERVER["HTTP_KONBIT_SIGNATURE"] ?? "";
parse_str(str_replace(",", "&", $sig), $p); // t=...&v1=...
$t = (int)($p["t"] ?? 0); // MILLISECONDS
if (!$t || abs(round(microtime(true)*1000) - $t) > 300000) { http_response_code(401); exit; }
$expected = hash_hmac("sha256", $t . "." . $raw, getenv("KONBIT_WEBHOOK_SECRET"));
if (!hash_equals($expected, $p["v1"] ?? "")) { http_response_code(401); exit; }
$event = json_decode($raw, true);
if (already_processed($event["id"])) { http_response_code(200); exit; } // dedup on event.id
// re-check amountMinor and currency against your order
mark_processed($event["id"]);
fulfill($event["data"]["metadata"]["orderId"]);
http_response_code(200);
import hmac, hashlib, time, os
from flask import request, abort
@app.post("/konbit/webhook")
def konbit_webhook():
raw = request.get_data() # raw body
parts = dict(p.split("=", 1) for p in request.headers.get("Konbit-Signature", "").split(","))
t = int(parts.get("t", 0)) # MILLISECONDS
if not t or abs(time.time() * 1000 - t) > 300000:
abort(401)
expected = hmac.new(os.environ["KONBIT_WEBHOOK_SECRET"].encode(),
f"{t}.".encode() + raw, hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, parts.get("v1", "")):
abort(401)
event = request.get_json()
if already_processed(event["id"]): # dedup on event.id
return "", 200
# re-check amountMinor and currency against your order
mark_processed(event["id"])
fulfill(event["data"]["metadata"]["orderId"])
return "", 200
Retry policy
Immediate delivery. If your endpoint does not answer 2xx within 10 s (redirects are not followed and count as failures), Konbit retries 5 times, after 1, 5, 30, 120 then 720 minutes, i.e. 6 attempts over about 14.5 hours, before giving up on the event. Each attempt is RE-SIGNED with a current t: your 5-minute window therefore accepts retries. The event id never changes: deduplicate on it. Without a webhookUrl, no events are sent.
Or by polling
Two ways to know a payment succeeded: receive the webhook, or poll the intent until its status is SUCCEEDED.
curl https://app.getkonbit.com/api/v1/payment_intents/{id} \
-H "Authorization: Bearer sk_test_..."
# repeat until "status": "SUCCEEDED"
Webhook AND reconciliation polling, never one without the other. The webhook notifies you fast; a periodic GET of recent intents catches any missed delivery (endpoint briefly down, "dead" event). Never depend on a single channel.
Pay a test intent
In sandbox, the checkoutUrl shows a test banner and refuses payment: use POST /v1/test/pay. In production, the customer pays from their Konbit wallet with their PIN. If card collection is enabled for your account, the same checkoutUrl also offers “Pay by card” (no Konbit account): the intent then carries paidViaCard, the money goes to your USD balance, and you receive card_payment.succeeded then payment_intent.succeeded (deduplicate by intent id).
Go-live checklist
Eleven points before you switch. The three in bold are the ones 90% of integrators forget · and that cost money or open a hole.
- Merchant sk_ key obtained and stored server-side (secrets manager), never client-side.
- Idempotency-Key set on every creation (your order or payout number…).
- Amounts in minor units, within bounds; DOP currency.
- RAW body preserved for the HMAC check (no parsing before the signature).
- Webhook endpoint on https, replies 2xx in under 10 s, heavy work done asynchronously.
- Signature verified in constant time, t handled as milliseconds, requests older than 5 min rejected.
- Reconciliation polling as a safety net, on top of the webhook.
- EXPIRED / CANCELED / REFUNDED statuses, 202 PENDING responses (asynchronous payouts), 429 and error codes handled cleanly.
- Deduplication on the EVENT id (at-least-once delivery).
- Re-verify the webhook's amount AND currency against your order · don't trust the event type alone.
- No client-side path marks "paid": returnUrl is not proof, only server confirmation is.
USD rail: collect by card, pay out by Zelle
For platforms operating in dollars (investment, payroll, marketplaces): your customers pay by card on a Konbit-hosted checkout · no Konbit account needed · and you distribute USD by Zelle, in batches, with per-line webhook confirmation.
1. Card collection
Your server creates the intent (amount locked server-side), the payer enters their card on /cpay. Konbit's fee is added on top; your USD balance receives the net.
2. Funds secured
Every payment goes through an anti-fraud settlement hold before it becomes distributable. Three-state balance: pending, available, reserved.
3. Zelle payouts
You submit the list (up to 200 recipients per batch). Konbit executes each transfer and notifies you by signed webhook: paid or failed, line by line.
Card collection (USD rail) is a PER-MERCHANT activation, approved by Konbit (compliance, chargeback clause) · never on a test key. Once enabled, your DOP payment links also offer the card option to payers, no Konbit account needed. Contact us to enable it.