Hisab Pay Get an API key

API documentation

Verify Telebirr, CBE and CBE Birr payments and take payments through hosted checkout pages.

Introduction

Hisab Pay lets your website, app or system accept Telebirr, CBE and CBE Birr payments and know they are real. Every payment is checked against the official receipt published by Ethio telecom or the Commercial Bank of Ethiopia — never against screenshots — and each transaction can pay only once.

Money always goes straight from the customer to your own accounts (or your sellers'); Hisab Pay never holds it.

Two ways to use it

  • Checkout (easiest): create a payment with POST /v1/payments and send the customer to its checkout_url. Hisab Pay shows where to pay, checks the transaction, then sends the customer back to your success_url and your server a payment.paid webhook.
  • Verify (your own payment page): the customer pays and types the transaction ID on your site; your server sends it to POST /v1/verify and gets the answer in seconds.

Base URL: https://pay.cassiacode.com. Requests and answers are JSON. Amounts are in birr as strings with two decimals ("1500.00") plus amount_santim as an integer (1 birr = 100 santim); you may send amounts as numbers (1500, 19.99) or strings ("1,500.50").

A machine-readable description is at /openapi.json (OpenAPI 3.1 — import it into Postman, Insomnia or a code generator).

Authentication

Create keys in the dashboard under API keys. Send the key in the Authorization header (or X-Api-Key). Keys are secret: use them only on your server, never in a browser or mobile app.

  • hp_test_… — test mode: accepts only test transaction IDs, never contacts a bank, works without accounts set up.
  • hp_live_… — live mode: checks real payments.

Each key sees only its own mode: test payments and checks are invisible to live keys, and the other way round. Revoked keys stop working at once.

Test your key
curl https://pay.cassiacode.com/v1/me -H "Authorization: Bearer hp_test_YOUR_KEY"

Test mode

With a test key, use these transaction IDs. The word after TEST chooses the answer, so you can build every case without real money. Test checks and payments appear in the dashboard under Test.

WordTelebirrCBECBE BirrAnswer
OKTESTOK1234FTTESTOK1234TESTOK12345verified (paid the expected amount, 100.00 if none sent)
USEDTESTUSED12FTTESTUSED12TESTUSED123already_used
LOWTESTLOW123FTTESTLOW123TESTLOW1234amount_mismatch (pays half)
OTHERTESTOTHER1FTTESTOTHER1TESTOTHER12wrong_receiver
NONETESTNONE12FTTESTNONE12TESTNONE123not_found
PENDTESTPEND12FTTESTPEND12TESTPEND123not_completed
DOWNTESTDOWN12FTTESTDOWN12TESTDOWN123503 bank_unavailable

The test receipt pays the amount you sent. A live key refuses test IDs (test_reference) and a test key refuses real ones (live_reference).

Errors

Check outcomes (verified, not found, already used…) are normal answers with HTTP 200 — see the check object. Problems with the request itself use HTTP error codes and this body:

{
  "error": {
    "code": "invalid_request",
    "message": "amount must be at least 1 birr",
    "field": "amount"
  }
}
HTTPcodeWhen
400invalid_requestThe body isn't JSON or a field is wrong; field names it.
400invalid_referencereference isn't a Telebirr, CBE or CBE Birr transaction ID.
400test_referenceA test transaction ID was sent with a live key.
400live_referenceA real transaction ID was sent with a test key.
401invalid_keyThe key is missing, malformed, unknown or revoked.
402plan_limitYour Hisab Pay plan's checks are used up (the free trial has 200). Upgrade in the dashboard → Plan & billing; billing_url given. Test mode is always free.
402plan_expiredYour paid plan's month has ended. Renew it in the dashboard → Plan & billing; billing_url given.
403merchant_pausedThe merchant (recipient) is switched off for taking payments in the dashboard → Merchants.
403payouts_pausedPayouts to this merchant (recipient) are switched off in the dashboard → Merchants.
403merchant_keyA merchant API key can't do this (it may check payments and make / read its merchant's payments only).
403recipient_mismatchA merchant API key named another merchant in recipient; leave it out or use the key's own merchant.
403platform_onlyaccounts was sent by a business that isn't a platform; add your accounts in the dashboard instead.
404recipient_not_foundNo active recipient has that recipient ID.
404not_foundNo payment or check with that ID for this key's business and mode.
409no_accountsYour business (or the recipient) has no account for that service yet.
409not_pendingThe payment or payout isn't pending any more (paid, expired or canceled).
409not_refundableOnly paid payments can be refunded.
409refund_too_largeThe refund is more than is left to refund (refunds waiting to be sent count too).
429rate_limitedToo many checks in 24 hours; retry: true.
500internal_errorSomething failed on our side; retry: true.
503bank_unavailableThe bank's receipt service didn't answer; retry: true, check_id given.
503unavailableHisab Pay itself is briefly unavailable; retry: true.

When retry: true is present, try again later (e.g. after a minute). Never treat an error as "paid".

Check a transaction

POST /v1/verify — checks one transaction against the official receipt. The customer pays one of your accounts and gives you the transaction ID (or pastes the whole SMS — the ID is found in it).

FieldType
referencestring, requiredThe transaction ID: Telebirr 10 letters/digits (DJ10AO86X4), CBE FT + 10 (FT26274T6519), CBE Birr 11 (DIU21Q510UY). A pasted SMS or receipt link works too. CBE transfer SMS have no FT number: the customer's SMS or its mbreciept.cbe.com.et/v2-… link is matched with the CBE SMS your SMS phone forwarded (answers not_found until that SMS arrives; confirmed_by: "sms").
methodstringtelebirr, cbe or cbe_birr. Guessed from the ID's shape when left out.
amountnumber or stringExpected amount in birr. The payment must be at least this much (more is fine).
order_idstring ≤ 100Your order. The transaction is claimed for it; asking again for the same order is safe (idempotent).
recipientstringYour ID for a recipient (seller, branch, driver): the money must have reached *their* accounts instead of yours.
claimbooleanDefault true. false = only look; the transaction stays free for another order.

Note: A check can take 1–30 seconds (the bank's receipt service is slow at times). Use a 60-second timeout on your side.

curl -X POST https://pay.cassiacode.com/v1/verify \
  -H "Authorization: Bearer hp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reference": "TESTOK1234", "amount": 1500, "order_id": "1001"}'

The check object

id, object: "check", status, verified (true only for verified), livemode, method, reference; when a receipt was found: amount, amount_santim, currency, paid_on, payer, receiver, receiver_account, confirmed_by (receipt, sms or test — see SMS phones); bank_status (not completed); expected_amount; recipient {id, name}; order_id; claimed + claimed_at; used_by {order_id, at} (already used).

Fraud guard (live checks): when something looks wrong the check also has risk {flagged: true, reasons: […], hold}. Reasons: blocked_payer (the payer's name is on your blocklist — hold is true: don't deliver before you've looked; Hisab Pay's own checkout pages hold such payments), large_amount (at or above your limit, or about 10× your usual), burst (many payments from one payer within 30 minutes), reused_id / wrong_ids (checkout pages and Telegram only). Every flag is also a risk.flagged webhook event and appears in the dashboard → Fraud guard.

statusMeaning
verifiedCompleted, paid into your (or the recipient's) account, at least the expected amount. Claimed for your order unless claim: false.
already_usedThis transaction was already used for another order or payment; used_by says which.
amount_mismatchPaid to you, but less than amount. The real amount is in amount.
wrong_receiverThe money went to an account that isn't yours (or the recipient's).
not_foundThe bank has no such transaction (for your accounts). It may be a typo, or too new: try again in a minute.
not_completedThe transaction exists but isn't completed; bank_status has the bank's word.

GET /v1/checks/{id} returns a check again (for example after a 503 bank_unavailable, which includes check_id).

Payments and checkout

POST /v1/payments — asks for a payment and returns a checkout_url. Send the customer there (redirect, link, QR code, SMS). The page shows the amount and your accounts, takes the transaction ID, checks it, and sends the customer to success_url with ?payment_id=…&status=paid added.

Note: Don't trust the redirect alone — anyone can open your success URL. Confirm with the payment.paid webhook or GET /v1/payments/{id} before delivering the goods.

FieldType
amountnumber or string, requiredBirr, at least 1.
descriptionstring ≤ 200Shown to the customer.
order_idstring ≤ 100Your order; shown to the customer and searchable.
recipientstringYour recipient's ID: the customer pays into their accounts.
methodsarrayAny of telebirr, cbe, cbe_birr (default: all you have accounts for).
customerobjectname, phone, email (optional, for your records).
metadataobjectUp to 20 keys of strings/numbers/booleans; returned as given.
success_url, cancel_urlhttps URLWhere to send the customer after paying, or when they go back.
expires_inintegerMinutes until it expires: 5 to 43200 (30 days). Default: your business's setting (1 day unless changed in Settings).
curl -X POST https://pay.cassiacode.com/v1/payments \
  -H "Authorization: Bearer hp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 1500, "description": "Order #1001", "order_id": "1001",
       "success_url": "https://shop.et/thanks", "cancel_url": "https://shop.et/cart"}'

Other payment calls

  • GET /v1/payments/{id} — one payment.
  • GET /v1/payments — newest first. Query: status, order_id, limit (1–100, default 20), before (a created_at from the previous page). Answers { object: "list", data: [...], has_more }. With paid_since (a date-time) it lists paid payments from then on, oldest paid first — handy for copying payments into your books; ask again with the last paid_at while has_more.
  • POST /v1/payments/{id}/cancel — cancels a pending payment (its checkout page stops accepting payments); 409 not_pending otherwise.
statusMeaning
pendingWaiting for the customer to pay on the checkout page.
paidPaid and verified; paid_with says how.
expiredNot paid before expires_at.
canceledCanceled by you (API or dashboard).

When paid, paid_with holds method, reference, amount, amount_santim, payer and check_id. Payments made through a payment link have link_id. refunded / refunded_santim is the total of confirmed refunds.

No-typing checkout. When one of your SMS phones watches the account a customer pays into, the checkout page asks for a slightly unique amount — the price plus 0.01–0.99 ETB, e.g. 100.03 for a 100.00 payment — and the payment confirms itself as soon as the phone sees exactly that amount arrive; the customer types nothing (typing the transaction ID still works). The payment object then has exact_amount / exact_amount_santim, and paid_with.amount is what was received. Owners can switch it off in Settings.

Refunds

POST /v1/payments/{id}/refunds creates a refund — a payout (kind: "refund", payment_id) back to the customer. All fields are optional: amount (default: everything not refunded yet), method (default: how they paid), account (default: the customer's phone when it fits), name, description, external_id. Then send the money and confirm it with POST /v1/payouts/{id}/confirm, like any payout. Refunds waiting to be sent count against the limit, so a payment can never be refunded twice; when one is confirmed, the payment's refunded grows and a payment.refunded webhook is sent.

curl -X POST https://pay.cassiacode.com/v1/payments/PAYMENT_ID/refunds \
  -H "Authorization: Bearer hp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 500, "description": "Returned 1 shirt"}'

Webhooks

Add an endpoint in the dashboard under Webhooks (an https URL on your server, the events you want, live or test). Hisab Pay then POSTs a signed JSON event each time something happens.

EventWhen
payment.paidA payment was paid on its checkout page.
payment.expiredA pending payment passed expires_at.
payment.canceledA payment was canceled.
payment.createdA payment was created (API, dashboard or payment link).
payment.refundedA refund of the payment was confirmed; refunded shows the total refunded so far.
check.completedA POST /v1/verify check finished (any outcome).
check.flaggedA payment confirmed by SMS didn't match the official receipt when it was checked later (flagged.reason). Look into it before delivering more.
risk.flaggedFraud guard raised a flag: data.object is the flag (kind: reused_id, wrong_ids, large_amount, burst, blocked_payer, edited_proof; check_id, payment_id, reference, amount, payer, held, detail).
payout.createdA payout was created.
payout.paidA payout was confirmed: the receipt shows the payee got the money.
payout.canceledA payout was canceled.
Body
{
  "id": "0b8a4e3f-5c1d-4f7e-8a2b-9c6d1e0f3a7b",
  "object": "event",
  "type": "payment.paid",
  "livemode": true,
  "created_at": "2026-10-02T09:05:41.000Z",
  "data": {
    "object": {
      "id": "7dc9b6f8-1959-4c41-94fd-d51b94d3c54b",
      "object": "payment",
      "status": "paid",
      "amount": "1500.00",
      "order_id": "1001",
      "paid_with": {
        "method": "telebirr",
        "reference": "DJ10AO86X4",
        "amount": "1500.00",
        "amount_santim": 150000,
        "payer": "Abebe Kebede",
        "check_id": "6f1c2b9e-1d0a-4c55-9a43-2c1f7f0d8e21"
      }
      // … the rest of the payment object
    }
  }
}
  • Headers: Hisab-Pay-Event (the type), Hisab-Pay-Delivery (a delivery ID), Hisab-Pay-Signature.
  • Answer with any 2xx within 10 seconds (do slow work afterwards). Redirects aren't followed.
  • Otherwise it's retried after 1 min, 5 min, 30 min, 2 h, 6 h and 12 h, then marked failed. You can resend any delivery from the dashboard.
  • The same event can arrive more than once (retries, resends): use the event id to ignore repeats.
  • Payment events carry the payment as it is when sent, so a late retry shows the latest status.

Checking the signature

Hisab-Pay-Signature: t=<unix seconds>,v1=<hex> where v1 = HMAC-SHA256 of "<t>.<raw body>" with your endpoint's secret (whsec_…, shown once when you add the endpoint). Compute it over the raw body before parsing JSON, compare in constant time, and refuse timestamps older than 5 minutes.

import { createHmac, timingSafeEqual } from "node:crypto";

// rawBody: the request body exactly as received (a string), e.g. await request.text()
export function isFromHisabPay(rawBody, header, secret) {
  const t = Number(/(?:^|,)t=(\d+)/.exec(header ?? "")?.[1]);
  const v1 = /(?:^|,)v1=([0-9a-f]{64})/.exec(header ?? "")?.[1];
  if (!t || !v1 || Math.abs(Date.now() / 1000 - t) > 300) return false;
  const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
  return timingSafeEqual(expected, Buffer.from(v1, "hex"));
}

// Next.js route handler
export async function POST(request) {
  const raw = await request.text();
  if (!isFromHisabPay(raw, request.headers.get("hisab-pay-signature"), process.env.HISAB_PAY_WEBHOOK_SECRET)) {
    return new Response("bad signature", { status: 400 });
  }
  const event = JSON.parse(raw);
  if (event.type === "payment.paid") {
    // mark the order with event.data.object.order_id paid (once per event.id)
  }
  return new Response("ok");
}

Payouts (money out)

A payout is money you send — to a seller, driver, supplier or a customer. You send it yourself with your Telebirr, CBE or CBE Birr app or bank (Hisab Pay never holds money), then give Hisab Pay the transaction ID: the official receipt is read and the payout becomes paid only if the payee's account received at least the amount. Each transaction can confirm one payout (or payment) only.

  • POST /v1/payouts — create a payout.
  • POST /v1/payouts/{id}/confirm with {"reference": "…"} — after you sent the money.
  • GET /v1/payouts/{id}, GET /v1/payouts (query status, external_id, limit, before), POST /v1/payouts/{id}/cancel.
FieldType
amountnumber or string, requiredBirr, at least 1.
methodstring, requiredtelebirr, cbe or cbe_birr.
accountstringThe payee's phone (09…/07…) or 13-digit CBE account. Optional with recipient.
namestringThe payee's name. Optional with recipient.
recipientstringYour recipient's ID: their account for method and their name are used.
descriptionstring ≤ 200What it's for.
external_idstring ≤ 100Your own ID. Creating again with the same external_id returns the first payout (safe retries).
metadataobjectUp to 20 keys; returned as given.
curl -X POST https://pay.cassiacode.com/v1/payouts \
  -H "Authorization: Bearer hp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 250, "method": "telebirr", "account": "0911223344", "name": "Abebe Kebede",
       "description": "Week 40 earnings", "external_id": "w40-abebe"}'

# after sending the money:
curl -X POST https://pay.cassiacode.com/v1/payouts/PAYOUT_ID/confirm \
  -H "Authorization: Bearer hp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reference": "TESTOK1234"}'

Confirming answers 200 with the payout and last_check (the check object) whenever the receipt was read: if last_check.status isn't verified (for example wrong_receiver or amount_mismatch), the payout stays pending and you can confirm again with the right transaction. Test keys confirm with test IDs (TESTOK1234…).

merchant_fee / merchant_fee_santim: what you charge the merchant for this payout, from the payout fee set on the merchant in the dashboard (Merchants → Switches and fees). Hisab Pay never deducts it — the payout amount is what the merchant receives; the fee is for your own settlement with the merchant. It is filled in when a live payout to a recipient is confirmed paid, worked out on the amount the receipt shows, and stays null for test payouts, payouts to someone else, refunds, and payouts not yet paid.

statusMeaning
pendingTo send: you haven't confirmed a transfer yet.
paidConfirmed by the receipt; paid_with says how.
canceledCanceled before it was sent.

Many payouts at once

POST /v1/payout_batches with {"name": "Week 40", "payouts": [ … ]} — 1 to 500 payouts, each with the same fields as above. Every line is checked first: if any is wrong, nothing is saved and the answer lists them all in error.errors (index, field, message). Each line becomes a normal payout (confirm each with its own transfer). GET /v1/payout_batches/{id} returns the batch's totals (count, paid, pending) and all its payouts. In the dashboard you can paste a list from Excel or upload a CSV instead.

curl -X POST https://pay.cassiacode.com/v1/payout_batches \
  -H "Authorization: Bearer hp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Week 40", "payouts": [
        {"amount": 250, "method": "telebirr", "account": "0911223344", "name": "Abebe", "external_id": "w40-1"},
        {"amount": 400, "method": "cbe", "account": "1000123454321", "name": "Almaz", "external_id": "w40-2"},
        {"amount": 120, "method": "telebirr", "recipient": "driver-7", "external_id": "w40-3"}
      ]}'

Recipients (marketplaces)

If customers pay your sellers, drivers or branches directly, add each one in the dashboard under Recipients with your own ID for them (e.g. seller-17) and their accounts. Then send "recipient": "seller-17" with POST /v1/verify or POST /v1/payments: the money must reach *that recipient's* accounts. One account number can belong to only one place in your business, so a payment's receiver is never ambiguous.

Merchant keys

A key can belong to one merchant (dashboard → Merchants → the merchant → API keys; merchants can also make their own in their portal). Such a key works only for that merchant: POST /v1/verify and POST /v1/payments use its accounts without a recipient field, GET /v1/payments and GET /v1/checks/{id} show only its payments, and GET /v1/me names it in merchant. Payouts, payout batches and refunds answer 403 merchant_key.

SMS phones (faster, works when a bank is down)

Banks' receipt pages are sometimes slow or down. Put the SIM that receives your payment SMS in an Android phone, install the Hisab Pay SMS app and pair it in the dashboard under SMS phones. The app forwards only money SMS from the banks' and Telebirr's own sender names (never personal messages). A check then uses the SMS when it's there: same transaction ID, sent to one of that phone's accounts, at least the amount.

  • Answers confirmed this way have confirmed_by: "sms". Nothing else changes for your code.
  • Each one is checked against the official receipt a few minutes later. If the receipt disagrees (another receiver, a smaller amount, no such transaction), you get a check.flagged webhook and a warning in the dashboard.
  • A checkout payment the customer submitted while the bank was down is completed automatically when the SMS arrives.
  • The app: hisab-pay-sms.apk (Android 7+, installed from the file).

Libraries and plugins

Ready-made code so you write a few lines instead of building requests by hand. All of them check webhook signatures for you.

  • Node.js (18+, no dependencies): hisab-pay-node.zip — unzip into your project and import { HisabPay, verifyWebhook } from "./hisab-pay/index.js". Types included.
  • PHP (7.4+, curl, no dependencies): hisab-pay-php.zip — require 'hisab-pay-php/src/HisabPay.php'; then new \HisabPay\Client($key).
  • WooCommerce: hisab-pay-woocommerce.zip — Plugins → Add New → Upload. Customers pay on the Hisab Pay checkout page (English or Amharic); orders are marked paid on return, by webhook (/wp-json/hisab-pay/v1/webhook) or by re-checks. Store currency must be ETB.
import { HisabPay, verifyWebhook } from "./hisab-pay/index.js";

const hp = new HisabPay({ apiKey: process.env.HISAB_PAY_KEY });
const payment = await hp.payments.create({ amount: 1500, order_id: "1001", success_url: "https://shop.et/thanks" });
// redirect to payment.checkout_url

const check = await hp.verify({ reference: "TESTOK1234", amount: 1500, order_id: "1002" });
const payout = await hp.payouts.create({ amount: 250, method: "telebirr", account: "0911223344", name: "Abebe" });
await hp.payouts.confirm(payout.id, "TESTOK5678");

Limits and good practice

  • Up to 2,000 checks per business per 24 hours (live and test together); then 429 rate_limited.
  • The checkout page allows 10 tries per payment per 10 minutes.
  • A transaction ID can pay one order or payment only (per business and mode). Asking again for the same order_id is safe.
  • Keep keys and webhook secrets on your server. Revoke a key in the dashboard if it leaks; make a new webhook secret the same way.
  • Never mark an order paid on an error or timeout — only on verified: true or a payment.paid event.