Integration guide

Accept payments on any website, in any language.

Conduit handles the entire payment — channels, OTP/PIN prompts, processor routing, bridge rotation and retries — and hands your server one trustworthy JSON answer: was it paid, and how much. Plain HTTPS + JSON: if your stack can make an HTTP request, it can integrate.

How it works

01 · serverCreate sessionPOST amount, customer, referral
02 · browserCustomer paysHosted page or modal
03 · conduitRoute & settleGateway, bridge rotation, OTP/PIN, polling
04 · webhookYou're toldSigned payment.succeeded
05 · serverCredit onceDedupe by reference

Everything belongs to exactly one website. Keys, sessions, links, payments, webhook secrets — all scoped to the site that created them. A key from site A cannot read, create or settle anything on site B.

Quickstart

Create a session on your server with your secret key, then send the customer to url.

Create a checkout session

curl http://localhost:8000/api/v1/checkout/sessions \
  -H "Authorization: Bearer sk_test_••••••••" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_1042" \
  -d '{
    "amount": 150.00,
    "currency": "GHS",
    "referral": "VIP",
    "customer": {"reference": "user_88", "phone": "0241234567"},
    "metadata": {"order_id": 1042},
    "return_url": "https://yourshop.com/pay/done"
  }'
# → {"id": "cs_…", "url": "http://localhost:8000/pay/cs_…", "status": "open", …}

Keys & authentication

Send Authorization: Bearer <key>. Each website has its own keys, in two modes and two kinds:

KeyWhereCan
sk_live_… / sk_test_…Your server onlyEverything for that website: sessions, payments, referrals, signed links
pk_live_… / pk_test_…Browser / appRead site config, create browser sessions — only from your registered domains (CORS + origin check)

Keys can be rolled with a grace period (old key keeps working for up to 7 days) or revoked instantly. Removing a website revokes all its keys.

Site binding & security model

  • Database scoping — every session, link and payment row carries its website; API lookups are always filtered by the calling key's website.
  • Origin enforcement — payment links and publishable keys are refused unless the request comes from your registered domains (Referer/Origin).
  • Frame-ancestors — the checkout can only be embedded in an iframe on your domains.
  • Return URLs — return_url/cancel_url must be on your domains.
  • Signed links — optional HMAC over amount, customer, referral and expiry.
  • IP allow-list — optional per-website list for secret-key calls.
  • Secrets at rest — gateway keys, bridge secrets and webhook secrets are encrypted (Fernet); API secrets are stored only as SHA-256 hashes.

Checkout sessions

POST/api/v1/checkout/sessions
GET/api/v1/checkout/sessions/{id}
POST/api/v1/checkout/sessions/{id}/expire
FieldTypeNotes
amountnumberOmit to let the customer choose within your limits. If set, it is locked.
currencystringDefaults to the website currency (GHS).
referralstringReferral code — applies that code's minimum/maximum/quick amounts.
customerobjectreference (your user id — echoed back), phone, email, name.
metadataobjectUp to 4 KB, echoed on the payment and every webhook.
channelsstring[]Restrict to channel codes, e.g. ["momo-mtn"].
return_url / cancel_urlurlMust be on your domains. We append conduit_session, conduit_status, conduit_reference.
expires_inintSeconds, 300 – 604800. Default from platform settings.

Native in-page embed — no redirect

One script tag with your publishable key. Your button opens the payment as a modal inside your own page (a bottom sheet on phones); it sizes itself to the content, uses your website's theme or deposit-builder design, and never navigates away. Your classic payment links are unaffected — they still open the hosted page and redirect back.

<!-- 1. Once, before </body>. pk_ keys are safe in page source and only work on your domains -->
<script src="http://localhost:8000/js/v1/conduit.js" data-key="pk_live_…" async></script>

<!-- 2. Any button — the modal opens INSIDE your page. No redirect, no new tab. -->
<button data-conduit-pay data-amount="250" data-customer="{{ user.id }}" data-ref="VIP">Deposit</button>

<!-- 3. Or from code -->
<script>
  const payment = await Conduit.pay({ amount: 250, customer: { reference: user.id } });
  // → { id, reference, amount, charged }   (rejects with e.code === "closed" if dismissed)
  Conduit.on("success", p => refreshBalance());   // UI only — credit via webhook
</script>
POST/api/v1/embed/sessions

Called by the SDK with your pk_ key (origin-checked, CORS). An amount sent from the browser is a prefill the customer can change, unless the website allows browser-set amounts. Behaviour (auto-close, backdrop, drawer/centred, width, bottom sheet) is configured per website in Websites › Native embed. Events: open, success, failed, close, error; buttons also dispatch conduit:success / conduit:cancel DOM events.

conduit.js — open a server-created session as a modal

One script tag. Works with sessions created on your server, or with payment links (still origin-bound).

<!-- 1. Load once -->
<script src="http://localhost:8000/js/v1/conduit.js" defer></script>

<!-- 2a. Session created on your server -->
<button onclick="Conduit.checkout({ session: '{{ session.id }}' })">Pay now</button>

<!-- 2b. Or a payment link (works only on YOUR registered domains) -->
<button data-conduit-link="pl_yourLinkToken" data-conduit-ref="VIP">Deposit</button>

<script>
  Conduit.on("success", (p) => {
    // UI only — always confirm server-side (webhook or GET /payments/{ref})
    location.href = "/wallet?ref=" + p.reference;
  });
  Conduit.on("close",  () => console.log("closed"));
  Conduit.on("failed", (p) => console.warn(p.failure));
</script>

Events: ready, success, failed, close, return. Browser events are for UX — credit only after server-side confirmation.

Confirm a payment

After the redirect (or instead of trusting the browser), ask us. /verify also re-checks with the processor right now.

GET/api/v1/payments/{id|reference}
POST/api/v1/payments/{id|reference}/verify

Confirm the payment server-side

curl http://localhost:8000/api/v1/payments/HL-K7QX-LZ9F2K1A8Q \
  -H "Authorization: Bearer sk_test_••••••••"
# or re-check with the processor right now:
curl -X POST http://localhost:8000/api/v1/payments/HL-K7QX-LZ9F2K1A8Q/verify -H "Authorization: Bearer sk_test_••••••••"
# or fetch the session you created:
curl http://localhost:8000/api/v1/checkout/sessions/cs_… -H "Authorization: Bearer sk_test_••••••••"

Webhooks

Add endpoints per website in the console. Deliveries are signed, logged (status, latency, response) and retried with back-off: 1m → 5m → 15m → 1h → 3h → 6h → 12h → 24h. Endpoints are auto-disabled after 50 consecutive failures (you're notified). Re-deliver any event from the console.

Event types

payment.succeededMoney confirmed. Credit your customer (idempotently, by reference).
payment.failedDeclined or could not be completed. Nothing was taken.
payment.pendingWaiting for the customer to approve on their phone.
payment.action_requiredOTP / PIN / redirect needed — checkout handles it.
payment.expiredNo confirmation inside the pending window.
session.completedA checkout session was paid.
session.expiredA checkout session closed unpaid.
payment.updatedMetadata, tags or attribution changed (API or console).
payment.held / payment.releasedRisk review: money held out of payroll, then released after approval.
session.abandonedCheckout left unpaid for a while — includes recovery_url to nudge the customer.
payment.refundedA refund succeeded; amount_refunded / refund_status updated.
refund.created / refund.succeeded / refund.failedRefund lifecycle.
customer.created / customer.updatedA customer was first seen, edited, blocked or re-assigned.
partner.created / partner.updatedPartner directory changes.
commission.createdA commission line was written (referrer level or staff share).
commission.availableA held line passed its hold period — payable now.
commission.paidYou recorded a partner payout.
commission.reversedClawed back (refund) or voided.
payout.paidThe platform paid your balance (payroll).
site.paused / site.resumedYour website's payments were paused or resumed.

Verify signatures

Conduit-Signature: t=<unix>,v1=<hex> where v1 = HMAC_SHA256(whsec, t + "." + raw_body). Reject if older than 5 minutes. Dedupe on Conduit-Event-Id.

Verify webhook signatures

# Conduit POSTs JSON to your endpoint with:
#   Conduit-Signature: t=1731240000,v1=<hex HMAC-SHA256(whsec, "t.body")>
#   Conduit-Event-Id:   evt_…      (dedupe on this)
#   Conduit-Event-Type: payment.succeeded
# Verify by hand:
printf '%s' "1731240000.$BODY" | openssl dgst -sha256 -hmac "$WHSEC"
# Reply 2xx within 10 s. Anything else is retried for ~2 days.

The payment object

{
  "object": "payment",
  "id": "pay_8Hq2…",
  "reference": "HL-K7QX-LZ9F2K1A8Q",      // globally unique — your idempotency key
  "status": "succeeded",                  // initiated | action_required | pending | succeeded | failed | expired | reversed
  "paid": true,
  "livemode": true,
  "currency": "GHS",
  "amount": 150.0,                        // what you asked for
  "fee": 1.5, "fee_bearer": "merchant",
  "charged": 150.0,                       // what the customer paid
  "net": 148.5,                           // what you net
  "amount_paid": 150.0,                   // confirmed by the processor
  "underpaid": false,
  "channel": "momo-mtn", "network": "mtn",
  "customer": {"reference": "user_88", "phone": "+233241234567", "email": null},
  "referral": "VIP",
  "session": "cs_…",
  "site": {"id": "site_…", "name": "My Shop"},
  "metadata": {"order_id": 1042},
  "created_at": "2026-11-10T09:12:44+00:00",
  "paid_at": "2026-11-10T09:13:02+00:00"
}

Minimums, maximums & referral rules

The minimum a customer sees is resolved per payment, highest priority first:

  1. Referral rule — only when that code is on the payment
  2. Website minimum
  3. Organisation minimum
  4. Platform minimum

A channel's technical floor/ceiling and your plan's per-payment cap are applied on top. GET /api/v1/site returns the effective limits; the console's Referral Inspector shows the full trace.

Listing & timeframes

GET/api/v1/payments?timeframe=7d&status=succeeded&include_summary=1

timeframe: today, yesterday, 3d, 7d, 14d, 30d, 90d, this_month, last_month, this_year, 1y, all, or custom with from/to (YYYY-MM-DD or YYYY-MM-DDTHH:MM). Also q, channel, referral, min, max. Cursor pagination: limit (≤100) + starting_after.

Idempotency

Send Idempotency-Key on POST /checkout/sessions. Retries with the same key and body replay the original response (Idempotent-Replayed: true); the same key with a different body returns 409 idempotency_key_reused.

Errors

{"error": {"type": "invalid_request_error", "code": "amount_below_minimum",
           "message": "The minimum amount is 50.00.", "param": "amount",
           "doc_url": "http://localhost:8000/docs#error-amount_below_minimum"},
 "request_id": "req_…"}
CodeHTTPMeaning
missing_api_key401No Authorization header.
invalid_api_key401Key unknown, expired after a roll, or revoked.
secret_key_required403A pk_ key was used on a server endpoint.
origin_not_allowed403Browser request from a domain not registered on this website.
ip_not_allowed403Server IP not on the website's allow-list.
account_inactive403Organisation pending, suspended or closed.
site_removed410Website was removed; its keys no longer work.
site_paused423Website is paused — show your customer the paused message.
amount_below_minimum400Below the resolved minimum (referral → site → org → platform).
amount_above_maximum400Above the resolved maximum or plan cap.
referral_not_found400Unknown referral code for this website.
referral_inactive400Referral code disabled or expired.
url_not_allowed400return_url / cancel_url not on this website's domains.
idempotency_key_reused409Same Idempotency-Key, different body.
insufficient_scope403Restricted key (rk_) without the scope this endpoint needs.
site_required400Organisation key used on a site-specific call without `site`.
feature_disabled403The feature (refunds, partners, management API…) isn't on your plan.
external_id_already_paid409This external_id (your order id) was already paid on this website.
customer_blocked403The customer is blocked from paying.
invalid_refund_amount400More than the refundable amount.
already_commissioned409Re-attribution refused: void the existing commission lines first.
test_mode_only403Test helpers need a test key.
risk_blocked403Blocked by the risk engine or blocklist — show a neutral message.
route_blocked403A routing rule blocked this payment; message is customer-safe.
channel_unavailable400Unknown channel code for this website, or not allowed on this session.
channel_not_available_here403Location targeting: this method isn't offered where the payer is (or for their phone's country).
embed_disabled403The embedded dashboard isn't enabled for your account by the platform.
role_not_found404No such embed role — create roles in Developers › Embedded dashboard.
channel_closed400Channel closed now (schedule or a scheduled pause); message is customer-safe.
rate_limited429Too many requests per minute for this key.
platform_maintenance503Platform maintenance window.
no_gateway503No gateway available (none granted, all failing).

Testing

Use sk_test_ keys. Test payments run on the sandbox gateway — no money moves, webhooks still fire (to test endpoints).

Any valid numberPrompt, then succeeds after ~6 seconds
Number ending 000Declined by the network
Number ending 111Asks for OTP — use 123456
Number ending 222Asks for PIN — any 4 digits succeed
Number ending 999Stays pending until it expires
Card / bankOpens a simulated approval page

Rate limits, request ids & audit

Each key is rate-limited per minute (X-RateLimit-Remaining). Every response carries X-Request-Id; every API call is logged (redacted body, status, latency, origin, idempotency key) and searchable in Developers. Every console change is in the audit log with a field-level diff — including actions taken by platform administrators.

OpenAPI & generated SDKs

The full spec is at /api/v1/openapi.json. Import it into Postman/Insomnia, or generate a typed client for 40+ languages:

npx @openapitools/openapi-generator-cli generate \
  -i http://localhost:8000/api/v1/openapi.json -g typescript-fetch -o ./conduit-client
# -g python | php | go | ruby | java | csharp | kotlin | swift5 | dart | rust …