Transactions

Every payment, STK or C2B, is a transaction. Look one up by your reference, or list and filter them. This is the source of truth; webhooks only tell you sooner.

Look up a payment

GET/api/v1/transactions/{reference_or_transaction_uuid}

Scope transactions:read. Pass your reference, or the transaction_uuid the STK response gave you.

# Paste your API key once (it starts with mpk_):
export MYPAYMENTS_KEY="mpk_your_key_here"

curl "https://api.mypayments.co.ke/api/v1/transactions/INV-001" \
  -H "Authorization: Bearer $MYPAYMENTS_KEY"
json
{
  "success": true,
  "data": {
    "uuid": "1d6aea1c-6911-455b-8300-2d347cc2a6e4",
    "account_uuid": "5e2989df-905b-40e9-a056-8251c2e34a37",
    "provider": "mpesa",
    "direction": "collection",
    "kind": "stk",
    "amount": "100.00",
    "reported_amount": "100.00",
    "amount_mismatch": false,
    "currency": "KES",
    "phone": "254712345678",
    "phone_sha256": "7132104d6aae9c3fac82095a42c2817952bca48e09d98d5bf4ac08218982fb90",
    "reference": "INV-001",
    "tracking_id": "order-8842",
    "provider_receipt": "TL3BD2ZK1P",
    "status": "settled",
    "result_code": "0",
    "result_desc": "The service request is processed successfully.",
    "verified": true,
    "settled_at": "2026-12-03T17:59:20.102059Z",
    "created_at": "2026-12-03T17:59:11.806152Z",
    "source": "provider"
  }
}

Why the reference and not the tracking id?

Your reference is unique in your business, so it names exactly one payment, and it is what we use to refuse a duplicate prompt. tracking_id is free-form and may repeat (one order, several attempts), so it can match many payments: find them with the list filter below.

List payments

GET/api/v1/transactions
# Paste your API key once (it starts with mpk_):
export MYPAYMENTS_KEY="mpk_your_key_here"

curl "https://api.mypayments.co.ke/api/v1/transactions?tracking_id=order-8842" \
  -H "Authorization: Bearer $MYPAYMENTS_KEY"

Query

FieldTypeRequiredDescription
tracking_idstringNoExact match on the tracking_id you sent.
statusstringNopending, settled, failed or success.
kindstringNostk or c2b.
accountstringNoAn account id.
qstringNoPart of a reference, or the last digits of the payer's phone.
page, per_pageintegerNoNewest first; pagination.
json
{
  "success": true,
  "data": [
    {
      "uuid": "1d6aea1c-6911-455b-8300-2d347cc2a6e4",
      "account_uuid": "5e2989df-905b-40e9-a056-8251c2e34a37",
      "provider": "mpesa",
      "direction": "collection",
      "kind": "stk",
      "amount": "100.00",
      "reported_amount": "100.00",
      "amount_mismatch": false,
      "currency": "KES",
      "phone": "254712345678",
      "phone_sha256": "7132104d6aae9c3fac82095a42c2817952bca48e09d98d5bf4ac08218982fb90",
      "reference": "INV-001",
      "tracking_id": "order-8842",
      "provider_receipt": "TL3BD2ZK1P",
      "status": "settled",
      "result_code": "0",
      "result_desc": "The service request is processed successfully.",
      "verified": true,
      "settled_at": "2026-12-03T17:59:20.102059Z",
      "created_at": "2026-12-03T17:59:11.806152Z",
      "source": "provider"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 25,
    "total": 1
  }
}

Statuses

pendingAn STK prompt is out. Normally settles or fails within two minutes; we keep asking Safaricom for up to 24 hours if its callback never comes.
settledPaid, and confirmed with the provider (verified: true). Fulfil the order.
failedNot paid: cancelled, timed out, insufficient funds, refused. result_code and result_desc say why.
successA forwarded C2B payment your server relayed, not yet confirmed with Safaricom. Don't fulfil yet; it becomes settled once confirmed.

The transaction object

Fields

FieldTypeRequiredDescription
uuidstringNoThe transaction id.
account_uuidstringNoThe account it was paid into.
providerstringNompesa or kopokopo.
directionstringNocollection.
kindstringNostk or c2b.
amountstringNoWhat you asked for: the STK amount, or the expected_amount of the account number paid. For a C2B payment without one, what was paid.
reported_amountstringNoWhat the provider says was paid.
amount_mismatchbooleanNoamount and reported_amount differ. We flag it and correct neither; decide what to do.
currencystringNoKES.
phonestringNoThe payer as 2547XXXXXXXX (no +), when known.
masked_phonestringNoThe payer as Safaricom masked it (2547•••678), when that is all we got.
phone_sha256stringNoSHA-256 hex of the payer's number as 2547XXXXXXXX (no +). Safaricom often sends only this for C2B payers; hash a number you know the same way to match it.
payer_namesstringNoNames Safaricom sent for a C2B payer.
referencestringNoYour STK reference, or for C2B the account number the customer typed (BillRef). Falls back to the receipt when they typed none.
tracking_idstringNoYour tracking id, STK only.
provider_receiptstringNoThe M-PESA receipt (TL3BD2ZK1P). Unique: one payment, one receipt.
statusstringNoSee statuses.
result_code, result_descstringNoThe provider's outcome, STK.
verifiedbooleanNoConfirmed with the provider server to server.
settled_atstringNoWhen it settled.
created_atstringNoWhen we recorded it.
sourcestringNoprovider (from Safaricom/KopoKopo) or forward (relayed by your server).
account_number, external_refstringNoC2B to an issued account number: the number and your external_ref for it.

Fields without a value are left out of the JSON. List by account: ?account=5e2989df-905b-40e9-a056-8251c2e34a37.