DeriPayDeriPayDocs
DeriPayDeriPayDocs
Merchant dashboardBuild with DeriPay

Getting started

QuickstartAuthenticationEnvironments

Integration guides

Limits and input formatsIdempotency and retriesPayment lifecycleWebhooksTest your integration

API reference

Create a collectionCreate a payoutRetrieve a paymentRead balances
Errors and troubleshooting

Merchant API · v1

Endpoints

Create a collection

POST /collections: request an M-Pesa STK push.

Endpoint

POST /api/v1/collections

Required scope: collections:write. Include X-API-Key, Content-Type: application/json, and Idempotency-Key.

Request body

FieldTypeRequiredDescription
amount_minorintegerYesKES cents, divisible by 100. Between 100 and 25000000; merchant limits also apply.
currencystringYesKES
methodstringYesstk
phonestringYesKenyan M-Pesa mobile number, preferably 2547… or 2541…. Local formats are normalized.
quoted_fee_minorintegerNoExpected deposit fee in cents (10% of amount_minor); a mismatch returns 409 MERCHANT_CONFLICT.
referencestringNoYour business reference, up to 80 UTF-8 bytes after trimming

Unknown and duplicate JSON fields are rejected. The reference is not an idempotency key.

Example request

curl --fail-with-body "$DERIPAY_API_BASE_URL/collections" \
  -H "X-API-Key: $DERIPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-2026-000123" \
  --data '{"amount_minor":10000,"currency":"KES","method":"stk","phone":"254712345678","reference":"ORDER-000123"}'

Response

New payment: 202 Accepted. Idempotent replay: 200 OK.

Illustrative accepted response
{
  "data": {
    "id": "507f1f77bcf86cd799439011",
    "kind": "collection",
    "method": "stk",
    "status": "queued",
    "amount_minor": 10000,
    "currency": "KES",
    "fee_minor": 1000,
    "provider_fee_minor": 0,
    "phone": "254712345678",
    "reference": "ORDER-000123",
    "shortcode": "600000",
    "created_at": "2026-09-05T12:00:00Z",
    "updated_at": "2026-09-05T12:00:00Z"
  },
  "replayed": false
}

Fees and shortcode are illustrative. Returned values reflect your merchant policy. The response may include an account_reference.

Deposit fee

A 10% fee is deducted from the gross deposit only when payment succeeds. For a KES 100 deposit, the payer approves KES 100, the fee is KES 10, and the merchant receives KES 90 of available balance. Failed or unconfirmed payments do not earn fees. Accepted requests retain their recorded fee on retry.

Confirm payment

Store the payment ID. Read GET payment using collections:read, or receive a signed webhook. Do not fulfil an order on queued, submitted, or unknown.

Only STK push funding is supported. Bank deposits and manual C2B reconciliation are not collection methods in this API.

Errors

See errors for validation, account limits, and permission failures. Reuse the original idempotency key and body after an uncertain network outcome.

Test your integration

Verify authentication, retries, payment outcomes, and webhook handling before live use.

Create a payout

POST /disbursements: send M-Pesa from your merchant payout balance.

On this page

EndpointRequest bodyExample requestResponseDeposit feeConfirm paymentErrors