Incpritech developers

incpesa payments API

Collect mobile money payments in Tanzania with one request, and get signed webhooks when they complete.

incpesa is for registered businesses. Open a merchant account; we review each business before it can collect payments. Pricing: 3.5% per successful payment, withdrawals TSh 1,500 (minimum TSh 10,000), partner commission 0.3%.

Endpoints

PathWhat it does
POST/paymentsSend a mobile money prompt and start a payment
GET/payments/:idOne payment, by its id or your reference
GET/payments?limit=50Recent payments (up to 200)
GET/balanceBalance and recent ledger entries
GET/pricingYour fee rate, withdrawal fee and partner commission
POST/withdrawalsWithdraw to your registered settlement account
GET/withdrawalsWithdrawal requests and their status

Request a payment

curl https://incpritech.com/api/incpesa/v1/payments \
  -H "Authorization: Bearer ip_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 15000,
    "phone": "0712345678",
    "reference": "ORDER-1001",
    "description": "Order 1001",
    "callback_url": "https://yourshop.co.tz/incpesa/webhook"
  }'
  • amount (required): whole shillings, TSh 500 to TSh 5,000,000.
  • phone (required): the customer's mobile money number.
  • reference: your order id. Sending the same reference again returns the original payment instead of prompting twice; a different amount with the same reference returns 409.
  • description, customer_name: optional.
  • callback_url: optional public https:// address for this payment's webhook. Without it we use the webhook URL set in your dashboard.

The response (201) is the payment. The customer gets a prompt and approves with their PIN; the status moves from pending to completed, failed, expired or voided.

{
  "success": true,
  "data": {
    "id": "6f1c…",
    "reference": "ORDER-1001",
    "amount": 15000,
    "fee": 525,
    "net": 14475,
    "currency": "TZS",
    "status": "pending",
    "phone": "255712•••678",
    "network": null,
    "description": "Order 1001",
    "failure_reason": null,
    "created_at": "2026-11-14T09:00:00.000Z",
    "completed_at": null
  }
}

To protect customers, a number can be prompted at most 3 times in 10 minutes per merchant; more returns 429.

Webhooks

When a payment reaches a final status we POST it to your webhook URL:

POST /incpesa/webhook
X-Incpesa-Event: payment.completed
X-Incpesa-Timestamp: 1794646000
X-Incpesa-Signature: 5f3c…  (hex HMAC-SHA256)

{ "id": "evt_6f1c…_completed", "type": "payment.completed", "created_at": "…", "data": { …payment… } }

Verify every webhook with your signing secret (Dashboard → Webhook → Show secret). The signature is HMAC-SHA256 of {timestamp}.{raw body}:

import crypto from 'node:crypto';

export function verifyIncpesa(rawBody, timestamp, signature, secret) {
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
  return signature?.length === 64 && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}
  • Use the raw request body exactly as received, before parsing JSON.
  • Reply with any 2xx quickly, then do your own processing.
  • Each result is sent once. If your server was down, check GET /payments/:id; it is always the source of truth.
  • Webhook URLs must be public https:// addresses.

Balance and withdrawals

Each completed payment adds the amount less your fee to your balance. Request a withdrawal with POST /withdrawals and { "amount": 50000 }; the amount plus the TSh 1,500 fee is set aside immediately and paid to the account you registered. Rejected withdrawals return to your balance.

Partners

Every approved merchant has a partner code in the dashboard. Businesses that sign up with your code earn you 0.3% of each of their successful payments, added to your balance automatically.