Trite logo
Seamless payments across Africa and beyond
Back to Home

API Reference

Detailed information about endpoints, parameters, and responses.

SDKs & Libraries

Official libraries for Node.js, Python, PHP, and more.

API Documentation

Accept payments programmatically: create payment sessions, share checkout links with your customers, and receive signed webhooks when money moves.

Getting started

The API is served from https://api.trite.tech. Create an API key in the dashboard under Settings → Integrations → API Management.

Format Info

All requests and responses are JSON. Amounts are decimal major units (e.g. 25.50) with an ISO currency code.

Authentication

Pass your key as a bearer token on every request. Your merchant account is derived from the key — there is no merchant ID parameter.

Header
Authorization: Bearer trite_sk_...

Keep your API key secure

Missing or invalid keys receive 401. The full key is shown exactly once at creation — store it securely. Keys look like trite_sk_… and can be revoked at any time. Never use your API key in browser or mobile code — server-side only.

Merchant verification

API access requires your merchant account to be fully verified. This means:

  1. Email verified — confirm your email address via the link sent at registration.
  2. KYC approved — submit identity verification documents in the merchant portal under Settings and receive approval.

If either requirement is not met, all payment API calls will return 403 with a machine-readable code field:

HTTP 403 — Email Not Verified
{
  "error": "Merchant account email is not verified. Please verify your email in the merchant portal.",
  "code": "EMAIL_NOT_VERIFIED"
}
HTTP 403 — KYC Not Approved
{
  "error": "Merchant KYC verification is required. Please complete identity verification in the merchant portal.",
  "code": "KYC_NOT_APPROVED",
  "kyc_status": "PENDING"
}

KYC Status Values

The kyc_status field will be one of: PENDING, IN_REVIEW, APPROVED, REJECTED, EXPIRED, or null (no KYC record submitted yet). Only APPROVED grants API access.

Create a payment session

Creates a checkout session and returns a payment_url to hand to your customer. Sessions expire after 24 hours.

POST /api/v1/payments/initiate
curl https://api.trite.tech/api/v1/payments/initiate \
  -H "Authorization: Bearer trite_sk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 25.50,
    "currency": "GHS",
    "description": "Order #1234",
    "redirect_url": "https://yourstore.com/thank-you"
  }'
HTTP 201 Created
{
  "session_id": "3f6b1c9e-...",
  "payment_url": "https://pay.trite.tech/pay/3f6b1c9e-...",
  "amount": 25.5,
  "currency": "GHS",
  "expires_at": "2026-07-08T12:00:00.000Z"
}
Body Parameters
FieldTypeNotes
amountnumberRequired. Positive, major units.
currencystringOptional, default USD.
descriptionstringOptional, shown at checkout.
redirect_urlstringOptional, payer is sent here after payment.
Errors: 400 invalid input, 401 bad key, 403 unverified merchant (see Merchant verification), 429 rate limited, 500 server error.

Check session status

Returns the session and its latest transaction. Prefer webhooks over polling for real-time updates.

GET /api/v1/payments/{session_id}/status
curl https://api.trite.tech/api/v1/payments/3f6b1c9e-.../status \
  -H "Authorization: Bearer trite_sk_..."
HTTP 200 OK
{
  "session_id": "3f6b1c9e-...",
  "status": "COMPLETED",
  "amount": 25.5,
  "currency": "GHS",
  "description": "Order #1234",
  "expires_at": "2026-07-08T12:00:00.000Z",
  "created_at": "2026-07-07T12:00:00.000Z",
  "transaction": {
    "transaction_id": "9a2d...",
    "tx_id_display": "TX-8F3K2M",
    "status": "SETTLED",
    "method": "MOBILE_MONEY",
    "amount": 25.5,
    "currency": "GHS",
    "failure_reason": null
  }
}
Sessions belonging to a different merchant return 404.

Webhooks

Configure your endpoint URL and event subscriptions in Settings → Integrations → Webhook Configuration. Events are delivered as POST requests with a JSON envelope:

POST (To your server)
{
  "id": "evt_5c1a...",
  "type": "payment.success",
  "created_at": "2026-07-07T12:03:41.000Z",
  "data": {
    "tx_id_display": "TX-8F3K2M",
    "session_id": "3f6b1c9e-...",
    "amount": 25.5,
    "currency": "GHS",
    "method": "MOBILE_MONEY",
    "status": "SETTLED"
  }
}
Events payload
EventFires when
payment.successA payment settles (funds credited to your balance).
payment.failedA payment fails or expires. data.failure_reason explains why.
payout.successA settlement to your payout account completes.
payout.failedA settlement is declined; funds return to your balance.

Webhook Delivery Retry

Respond with any 2xx quickly (under 10 seconds) — do your processing async. Failed deliveries retry with backoff (1m, 5m, 30m, 2h, 8h, 24h) before being marked exhausted; you can redeliver manually from the dashboard.

Verifying signatures

Every delivery carries an X-Trite-Signature header: t=<unix>,v1=<hex>. Compute HMAC-SHA256 of `${t}.${rawBody}` with your signing secret (Settings → Integrations), compare timing-safely, and reject if the timestamp is more than 5 minutes old.

import crypto from "crypto";

function verifyTriteSignature(rawBody, header, secret) {
  const { t, v1 } = Object.fromEntries(
    header.split(",").map((p) => p.split("="))
  );
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const expected = crypto
    .createHmac("sha256", secret)
    .update(`${t}.${rawBody}`)
    .digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}

Rate limits

60 requests per minute per merchant per endpoint. Exceeding the limit returns 429 with a Retry-After header (seconds). Back off and retry after that interval.

Deprecations

Endpoint Deprecation

POST /api/payments/initiate is a deprecated alias of POST /api/v1/payments/initiate and now requires the same API-key authentication. Migrate to the v1 path; a removal date will be announced in advance.

SDKs

Coming Soon

SDKs & Libraries

We're working on official libraries for Node.js, Python, PHP, and more.