Developers
Partner API

Collections

Debits a member's savings account — money moving from the SACCO to you (for example, sweeping funds out to settle with your bank).

POST /collections

Required scope: collection:write

Body parameters

Identical shape to Disbursements:

Parameter Type Required Description
account_ref string yes The savings account number to debit.
amount number yes Must be more than 0.
currency string no Defaults to UGX. Must match the SACCO's own configured currency (see Balance Inquiry) — a mismatch is rejected as COLLECTION_FAILED rather than silently ignored. Every SACCO on the platform is single-currency today, so in practice this just needs to match what GET /balance reports back for the account.
idempotency_key string yes Same guarantee as disbursements — a retried request never double-collects.
external_reference string no Your own reference, shown on the member's statement.

What can make a collection fail

Unlike a disbursement (which only ever adds money), a collection is checked against three things before it's allowed to proceed:

  1. The account's available balance. A fixed deposit still within its locked term has an unlocked balance of 0, regardless of its total balance.
  2. The SACCO's configured minimum balance. If the SACCO requires a minimum balance to remain in an account, a collection that would take the account below that minimum is rejected — the same protection that applies to a member's own withdrawals applies here too.
  3. The currency you supplied matches the account's own. Only matters if your integration ever sends anything other than the account's real currency — see the parameter table above.

All three are real-time checks against the account's current state at the moment of the request, not the balance you last saw in a statement call.

Example request

Same signing approach as Disbursements — hash and send the exact same JSON string.

TIMESTAMP=$(date +%s)
REQUEST_URI="/api/partner/v1/collections"
BODY='{"account_ref":"SA-00123","amount":25000,"currency":"UGX","idempotency_key":"1b2c3d4e-5f6a-7b8c-9d0e-1f2a3b4c5d6e","external_reference":"SETTLE-2026-06-29"}'
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 | sed 's/^.* //')
SIGNATURE=$(printf '%s' "${TIMESTAMP}|POST|${REQUEST_URI}|application/json|${BODY_HASH}" | openssl dgst -sha256 -hmac "$API_SECRET" | sed 's/^.* //')

curl -X POST "https://prodsacco.officeug.com${REQUEST_URI}" \
  -H "X-Api-Key: $API_KEY" \
  -H "X-Timestamp: $TIMESTAMP" \
  -H "X-Signature: $SIGNATURE" \
  -H "Content-Type: application/json" \
  -d "$BODY"
<?php
$body = json_encode([
    'account_ref'        => 'SA-00123',
    'amount'             => 25000,
    'currency'           => 'UGX',
    'idempotency_key'    => '1b2c3d4e-5f6a-7b8c-9d0e-1f2a3b4c5d6e',
    'external_reference' => 'SETTLE-2026-06-29',
]);

$timestamp = (string) time();
$path      = '/api/partner/v1/collections';
$signature = hash_hmac('sha256', "{$timestamp}|POST|{$path}|application/json|" . hash('sha256', $body), $apiSecret);

$ch = curl_init("https://prodsacco.officeug.com{$path}");
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => $body,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-Api-Key: {$apiKey}",
        "X-Timestamp: {$timestamp}",
        "X-Signature: {$signature}",
        'Content-Type: application/json',
    ],
]);
echo curl_exec($ch);
import json

body = json.dumps({
    "account_ref": "SA-00123",
    "amount": 25000,
    "currency": "UGX",
    "idempotency_key": "1b2c3d4e-5f6a-7b8c-9d0e-1f2a3b4c5d6e",
    "external_reference": "SETTLE-2026-06-29",
})

timestamp = str(int(time.time()))
path = "/api/partner/v1/collections"
body_hash = hashlib.sha256(body.encode()).hexdigest()
payload = f"{timestamp}|POST|{path}|application/json|{body_hash}"
signature = hmac.new(api_secret.encode(), payload.encode(), hashlib.sha256).hexdigest()

response = requests.post(
    f"https://prodsacco.officeug.com{path}",
    data=body,
    headers={
        "X-Api-Key": api_key,
        "X-Timestamp": timestamp,
        "X-Signature": signature,
        "Content-Type": "application/json",
    },
)
print(response.json())
const body = JSON.stringify({
  account_ref: 'SA-00123',
  amount: 25000,
  currency: 'UGX',
  idempotency_key: '1b2c3d4e-5f6a-7b8c-9d0e-1f2a3b4c5d6e',
  external_reference: 'SETTLE-2026-06-29',
});

const timestamp = Math.floor(Date.now() / 1000).toString();
const path = '/api/partner/v1/collections';
const bodyHash = crypto.createHash('sha256').update(body).digest('hex');
const payload = `${timestamp}|POST|${path}|application/json|${bodyHash}`;
const signature = crypto.createHmac('sha256', apiSecret).update(payload).digest('hex');

const response = await fetch(`https://prodsacco.officeug.com${path}`, {
  method: 'POST',
  body,
  headers: {
    'X-Api-Key': apiKey,
    'X-Timestamp': timestamp,
    'X-Signature': signature,
    'Content-Type': 'application/json',
  },
});
console.log(await response.json());

Example response — completed

{
  "success": true,
  "message": "Collection completed.",
  "data": {
    "operation_id": 413,
    "status": "completed",
    "transaction_ref": "TXN-20260629-0142",
    "balance_after": 427300.00
  },
  "request_id": "..."
}

Example response — rejected (minimum balance)

{
  "success": false,
  "message": "This collection would take the account below the SACCO's required minimum balance of 50000.00.",
  "error_code": "COLLECTION_FAILED",
  "request_id": "..."
}

Errors specific to this endpoint

HTTP error_code Meaning
404 ACCOUNT_NOT_FOUND No active account with this account_ref exists for your SACCO.
422 COLLECTION_FAILED Insufficient balance, minimum-balance breach, or another reason given in message.

Member OTP confirmation (on by default for live partners)

Every live partner requires member confirmation before a collection takes effect, unless a SACCO admin has deliberately turned it off for your credential (Partner API → Partners → "Require member OTP confirmation for collections") — this is a per-partner setting they control from their own dashboard, not something you turn on or off from your side. Check whether it applies to you by looking at the status field in the response: if it's ever awaiting_confirmation instead of completed, this section applies. Sandbox partners always complete instantly regardless of this setting, so you can build and test your integration without it — see Sandbox.

Why: a collection with no OTP debits the account instantly, with only an after-the-fact notification — the member never gets a chance to stop it. With OTP on, the member gets to actually approve the specific amount before anything moves.

What changes when it's on:

  1. Your POST /collections call no longer debits anything. It validates the account and balance up front (so you still get an immediate COLLECTION_FAILED for a request that could never succeed), then texts/emails the member a 6-digit code and returns status: "awaiting_confirmation" instead of "completed".
  2. Get that code from the member through whatever channel you already use to talk to them (your own USSD menu, app screen, phone call, etc. — this API only delivers the code to the member, it does not hand it to you).
  3. Submit it to the new confirm endpoint. This is where the debit actually happens.
POST /collections/{operation_id}/confirm

Required scope: collection:write (same as /collections)

Parameter Type Required Description
otp string yes The code the member received.

The code expires 5 minutes after the original /collections call and is single-use. Wrong codes are rate-limited: after 5 incorrect submissions the operation is locked and you must start a new collection to get a fresh code.

Example — initiate

{
  "success": true,
  "message": "A confirmation code was sent to the member. Submit it to POST /collections/{operation_id}/confirm to complete the collection.",
  "data": {
    "operation_id": 413,
    "status": "awaiting_confirmation",
    "otp_expires_at": "2026-07-12T10:05:00+00:00"
  },
  "request_id": "..."
}

Example — confirm

cURL (same HMAC signing as every other write — see Disbursements for the full recipe; only the path and body change)

TIMESTAMP=$(date +%s)
REQUEST_URI="/api/partner/v1/collections/413/confirm"
BODY='{"otp":"482913"}'
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 | sed 's/^.* //')
SIGNATURE=$(printf '%s' "${TIMESTAMP}|POST|${REQUEST_URI}|application/json|${BODY_HASH}" | openssl dgst -sha256 -hmac "$API_SECRET" | sed 's/^.* //')

curl -X POST "https://prodsacco.officeug.com${REQUEST_URI}" \
  -H "X-Api-Key: $API_KEY" \
  -H "X-Timestamp: $TIMESTAMP" \
  -H "X-Signature: $SIGNATURE" \
  -H "Content-Type: application/json" \
  -d "$BODY"

Response — identical shape to a non-OTP collection's success response:

{
  "success": true,
  "message": "Collection confirmed and completed.",
  "data": {
    "operation_id": 413,
    "status": "completed",
    "transaction_ref": "TXN-20260712-0142",
    "balance_after": 427300.00
  },
  "request_id": "..."
}

Checking status while waiting

GET /operations/{operation_id} (see Operation Status) works the whole time — poll it if you'd rather not track expiry yourself. status will be one of:

status Meaning
awaiting_confirmation Code sent, waiting on /confirm. otp_expires_at tells you when it stops being valid.
completed Confirmed and debited. Terminal.
expired 5 minutes passed with no confirmation. Terminal — start a new /collections call.
failed Confirmed, but the debit itself failed (e.g. balance moved in the meantime) — see failure_reason. Terminal.

Errors specific to confirmation

HTTP error_code Meaning
404 OPERATION_NOT_FOUND No collection with that operation_id exists for your credential.
409 OPERATION_NOT_CONFIRMABLE The operation isn't in awaiting_confirmation (e.g. already failed or was never OTP-gated to begin with).
410 OTP_EXPIRED More than 5 minutes passed since /collections was called. Start a new collection.
422 INVALID_OTP The code didn't match. Each wrong attempt counts toward the 5-attempt lockout.
429 OTP_LOCKED 5 incorrect codes were submitted. Start a new collection to get a fresh code.

Idempotency still applies

Retrying the original POST /collections with the same idempotency_key — even after confirmation completed — replays the same operation_id and current status, exactly like the non-OTP flow. Retrying /confirm on an already-completed operation is also safe: it returns the same success result rather than erroring.

Sandbox mode

Sandbox partners always get the original synchronous behavior (status: "completed" on the first call) regardless of the OTP setting — there's no real member to notify behind a sandbox account, and this keeps integration testing simple. The OTP flow only ever applies to live collections.