ShillingPay Merchant API
Accept deposits and send payouts over Telebirr (and, as they are switched on, M-Pesa and bank transfers) with a few calls and one webhook endpoint.
- Base URL: provided when your account is created
- Format: JSON,
snake_casefields. Amounts are strings with up to 2 decimals ("100","250.50"), currency ETB. - Auth: send your secret key in
X-Api-Keyon every request. Keep it on your server only.
X-Api-Key: shp_XXXXXXXXXX_...
Integrate in five steps
- Get a test key. No account yet? Get a sandbox key at
/sandboxon our site, no sign-up, valid for 7 days, or click through the checkout yourself at/try. With an account, open Developers in your dashboard and tap Create test key (shp_test_...). Either way it never moves real money. - Set your webhook URL with the test key:
PUT /v1/webhook {"url": "https://your-site/shillingpay/webhook"}. Keep thesecretit returns; every event is signed with it (see Webhooks).POST /v1/webhook/testsends atestevent so you can check your endpoint. - Take a deposit. Ask the customer for the number they will pay from on your own site, then on your server call
POST /v1/depositswith it assender_accountand redirect the customer tocheckout_url. Save the depositid(or yourreference) against the order before you redirect. - Credit on the webhook, not the redirect. When
deposit.completedarrives, verify the signature, find the order bydata.referenceand credit it once.deposit.expiredanddeposit.cancelledclose it. - Pay out with
POST /v1/payoutsand settle onpayout.completed(or release the money onpayout.failed).
When everything passes in the sandbox, create a live key, set the webhook URL again with it (live and test have separate webhook settings and secrets) and swap the key in your configuration. Nothing else changes.
Testing in the sandbox
A test key works exactly like a live key, kept apart from live payments: no real phones, no real money. Webhooks are sent and signed exactly as in live mode, and test transactions are listed under Transactions, Test in the dashboard. Test deposits show ShillingPay Test, 0900000000 as the number to pay.
Test numbers
Use these as the customer's number (sender_account) for deposits, and as
account_number for payouts. They settle on their own about 3 seconds later, like a real payment:
| Number | Deposit | Payout |
|---|---|---|
0900000001 | Paid: deposit.completed | Sent: payout.completed |
0900000002 | Not paid: deposit.expired | Fails: payout.failed |
| any other number | Waits for you (see Simulating below) | Waits for you |
Try a deposit
curl -X POST https://API_HOST/v1/deposits \
-H "X-Api-Key: shp_test_..." -H "Content-Type: application/json" \
-d '{"reference": "order-1001", "customer_id": "user-42", "amount": "100", "sender_account": "0900000001"}'
The response is pending with a checkout_url. About 3 seconds later your webhook receives deposit.completed
for reference order-1001, GET /v1/deposits/{id} shows completed.
To test your checkout page and redirect instead, send any other number as sender_account and open checkout_url in a
browser: the payment waits there, with buttons to simulate it being paid or expiring.
Try a payout
curl -X POST https://API_HOST/v1/payouts \
-H "X-Api-Key: shp_test_..." -H "Content-Type: application/json" \
-d '{"reference": "withdraw-77", "customer_id": "user-42", "amount": "50", "account_number": "0900000001"}'
payout.completed arrives a few seconds later. With 0900000002 you get payout.failed.
Simulating
For any other number, nothing happens until you play out the customer's or phone's side:
POST /v1/deposits/{id}/simulate{ "outcome": "paid" }(or"expired"), or the Simulate payment and Simulate expiry buttons on the test checkout pagePOST /v1/payouts/{id}/simulate{ "outcome": "completed" }(or"failed")
Simulation with a live key returns 422 test_mode_only.
Checklist before going live
- Your webhook handler verifies the signature and the timestamp, and ignores an event it has already handled
(
X-ShillingPay-Delivery), so a resend never credits twice. - You credit on
deposit.completed, never on the checkout redirect. deposit.expiredandpayout.failedrelease whatever you reserved.- A webhook your server could not take is retried for about 11 hours;
POST /v1/webhook/events/{id}/resendsends one again. - You tested a paid, an expired, a completed and a failed case with the test numbers.
SDKs
Ready-made clients for Node.js, Python and PHP live in sdks/. The OpenAPI spec is at /openapi/merchant.json on the API host.
Payment methods
GET /v1/payment-methods lists what is available right now, with your limits from Settings:
[{ "code": "telebirr", "name": "Telebirr", "kind": "mobile_money",
"deposits": { "min": "10.00", "max": "50000.00" }, "payouts": { "min": "10.00", "max": "1000.00" } }]
Methods are switched on by the gateway operator; show your customers only what this returns. method defaults to
telebirr when omitted.
Deposits
1. Create a deposit
POST /v1/deposits
| Field | Required | Notes |
|---|---|---|
reference | yes | Your order/transaction id, unique per deposit. Retrying with the same body returns the same deposit (200). |
customer_id | yes | Your id for the customer |
amount | yes | Exact amount the customer will send |
method | no | A code from /v1/payment-methods (default telebirr) |
sender_account | yes | The customer's own number/account they will pay from, used to recognise the payment automatically. Ask for it on your own site; the hosted checkout does not ask for it |
metadata | no | Up to 20 string keys, 4 KB; echoed back on every webhook |
return_url | no | HTTPS page the hosted checkout returns the customer to |
{
"reference": "order-88213",
"customer_id": "user-1042",
"amount": "500",
"method": "telebirr",
"sender_account": "0912345678",
"metadata": { "channel": "web" }
}
201 Created:
{
"id": "01937c6e-…",
"reference": "order-88213",
"status": "pending",
"amount": "500.00",
"method": "telebirr",
"sender_account": "0912345678",
"pay_to": { "method": "telebirr", "account_number": "0911223344", "account_name": "…" },
"expires_at": "2026-11-29T14:30:00Z",
"checkout_url": "https://pay.example.et/pay/01937c6e-…?token=…"
}
2. Send the customer to pay
Hosted checkout (recommended). Redirect the customer to checkout_url from the response. It shows the number
to pay, the amount and the steps (with a button that opens the Telebirr app on Android); it never asks the customer
for their number, so always send sender_account. Add
"return_url": "https://your-site/…" (HTTPS) when creating the deposit and we send them back there when it finishes,
with ?deposit_id=…&status=… appended. Always trust the webhook, not the redirect. The link is signed for that
one deposit and stops working an hour after the deposit expires.
Your own screen.
Tell the customer to send exactly amount to pay_to.account_number from sender_account
before expires_at (30 minutes). Warn them that payments from another number, to another number, or to an
old number are not matched automatically.
3. Get the result
The deposit becomes completed within seconds of the payment. You receive a deposit.completed webhook;
you can also poll GET /v1/deposits/{id} or GET /v1/deposits?reference=order-88213.
Listing and searching
GET /v1/deposits?status=completed&from=2026-12-01T00:00:00Z&to=2026-12-02T00:00:00Z&q=0911&limit=50 returns
{ "data": [...], "next_cursor": "…" }, newest first. Pass cursor= with next_cursor for the next page.
q matches your reference, customer id, the payer's number, the payer's name or the transaction number.
GET /v1/payouts takes the same parameters (statuses pending, processing, completed, failed, cancelled).
The dashboard can export the same lists as CSV.
Statuses: pending → completed | expired | cancelled. Cancel an unpaid one with POST /v1/deposits/{id}/cancel.
A deposit our team is checking stays pending until they decide, even after expires_at; a payment that arrives
late (for example after the receiving phone was offline) is checked by a person and can still complete an
expired deposit, so keep listening for deposit.completed.
from and to take any ISO 8601 time with an offset (2026-12-01T00:00:00+03:00 or …Z).
Customer paid but it was not recognised
If the customer paid from a different number, give them a field to paste the payment SMS, the transaction number or the receipt link, and send it (the hosted checkout already has this field):
POST /v1/deposits/{id}/verify { "proof": "…pasted text…" }
The deposit completes as soon as the matching payment is on the phone it was paid to (immediately if it already
arrived). It works for deposits that expired within the last 24 hours too. Anything that can't be confirmed
automatically goes to our team with the pasted text, and the deposit stays pending until they decide. Each deposit
accepts one paste (409 proof_already_sent after that). A transaction already used for another deposit returns
409 transaction_already_used.
The money is on your own SIM.
Refunds
POST /v1/deposits/{id}/refund sends a completed deposit's money back to the customer, all of it or in parts:
{ "amount": "100", "reason": "order cancelled", "reference": "refund-88213-1" }
Send a reference so a retry after a timeout returns the same refund instead of a second one. amount defaults
to the whole remaining amount. Refunds always go back to the number the deposit was paid from: a different
account_number returns 422 refund_account_mismatch, and a deposit with no known payer number returns
422 refund_account_unknown. If the payment SMS shows another number paid, send that full number as account_number.
A refund is a payout (same statuses and payout.* webhooks) with refund_of_deposit_id set. Refunds together
never exceed the deposit (422 refund_exceeds_deposit); a failed or cancelled refund frees its amount again. Only a
completed deposit can be refunded (409 not_refundable). Whole birr only.
Payouts
POST /v1/payouts
| Field | Required | Notes |
|---|---|---|
reference | yes | Your withdrawal id; idempotent like deposits |
customer_id | yes | |
amount | yes | Whole birr only (USSD transfers do not send cents) |
method | no | Default telebirr |
account_number | yes | The receiving number/account for that method |
metadata | no |
A payout is sent from one of your own phones, and one SIM must hold the whole amount. If none does, the payout waits
up to 30 minutes for a top-up, then fails. If your account has a payout limit per 24 hours, going over it returns
422 daily_payout_limit. A payout to a number that already received a lot in the last 24 hours waits for
you to check it in the dashboard (it stays pending). Statuses: pending → processing → completed | failed | cancelled.
A pending payout can be cancelled (POST /v1/payouts/{id}/cancel).
Webhooks
Set your endpoint with PUT /v1/webhook {"url": "https://…"}. It must be a public HTTPS address; private and
internal addresses are refused, and redirects are not followed. GET /v1/webhook shows the signing secret (you can
create a new one in the dashboard); POST /v1/webhook/test sends a test event.
GET /v1/webhook/events?limit=50 returns { "data": [...] } with recent events with their delivery status (pending, retrying,
delivered, failed) and last error. POST /v1/webhook/events/{id}/resend sends one again with the same
X-ShillingPay-Delivery id. The dashboard shows the same log with a Resend button.
Events: deposit.completed, deposit.expired, deposit.cancelled, payout.completed, payout.failed,
payout.cancelled.
{
"id": "01937c70-…",
"type": "deposit.completed",
"created_at": "2026-11-29T14:02:11Z",
"data": { "id": "…", "reference": "order-88213", "status": "completed", "amount": "500.00", "transaction_id": "DKT4TI6VZ0", "metadata": { "channel": "web" } }
}
Headers: X-ShillingPay-Event, X-ShillingPay-Delivery (unique per event; use it to ignore duplicates),
X-ShillingPay-Timestamp (unix seconds), X-ShillingPay-Signature.
Verify every webhook: hex(HMAC_SHA256(secret, timestamp + "." + raw_body)) must equal the signature,
and the timestamp must be within 5 minutes.
const crypto = require('crypto')
function verify(secret, rawBody, headers) {
const ts = headers['x-shillingpay-timestamp']
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false
const expected = crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex')
const given = headers['x-shillingpay-signature'] || ''
return given.length === expected.length && crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected))
}
Reply with any 2xx within 10 seconds. Failed deliveries are retried for about 11 hours
(30 s, 2 m, 10 m, 30 m, 1 h, 3 h, 6 h), then marked failed; ShillingPay sees failing webhooks and contacts you. Resend them once your server is fixed.
Errors
RFC 7807 problem JSON with a stable code:
| HTTP | code | Meaning |
|---|---|---|
| 400 | validation_error | A field or query parameter is missing or malformed (also an unknown cursor) |
| 401 | unauthorized | Missing, invalid or revoked API key |
| 403 | forbidden | Your role can't do this |
| 404 | not_found | Not found, or belongs to another merchant |
| 409 | reference_conflict | reference already used with different details |
| 409 | duplicate_open_deposit | Same amount from the same number is already waiting |
| 409 | not_cancellable | Already paid, processing or finished |
| 409 | not_verifiable | Deposit is not waiting for a payment |
| 409 | not_pending | Withdrawal already paid, rejected or cancelled |
| 409 | transaction_already_used | That transaction already completed another deposit |
| 409 | not_refundable | Only a completed deposit can be refunded |
| 409 | proof_already_sent | Payment details were already sent for this deposit |
| 409 | not_pending | Simulation: the test deposit or payout is already final |
| 413 | payload_too_large | Request body over 64 KB |
| 422 | amount_out_of_range | Below the minimum or above the maximum |
| 422 | method_unavailable | That payment method is not switched on for deposits/payouts |
| 422 | refund_exceeds_deposit | More than is left to refund on that deposit |
| 422 | daily_payout_limit | This payout would go over your payout limit per 24 hours |
| 422 | test_mode_only | Simulation needs a test key |
| 422 | refund_account_mismatch | Refunds only go back to the number that paid |
| 422 | refund_account_unknown | The paying number is not known; contact support |
| 422 | customer_limit | This customer or paying number reached its 24-hour deposit limit |
| 422 | no_webhook_url | Set a webhook URL before sending a test event |
| 429 | rate_limited | Rate limit (600 requests/minute per merchant by default); wait for Retry-After seconds |
| 503 | no_receiving_number | You have no receiving phone set up for this method. Deposits are still taken while phones are offline or busy |