HivePay Docs v1.0
Sign In Get API Keys
POST /api/v1/collect-money MTN • Airtel

Collect Money (Mobile Money Deposit)

Requests mobile money from a customer. When invoked, HivePay dispatches an interactive USSD push prompt directly to the customer's phone screen. The customer enters their Mobile Money PIN to approve the transaction.

Want to test this endpoint right now?

Launch an actual USSD prompt directly to your phone using our interactive live test runner.

Run Live Test →

Payment Lifecycle

1. API Request

Your server calls /collect-money with amount & phone.

2. USSD Prompt

Customer sees PIN prompt on their mobile screen instantly.

3. PIN Entered

Customer approves. Funds settle to your merchant wallet.

4. Webhook Fired

HivePay delivers a signed webhook to your callback URL.

Deposit Fee Policy & Settlement

You can configure who pays the collection fee in your merchant portal under Settings → Pass Collection Fee to Customer:

  • When ON (Customer bears fee): HivePay adds the collection fee to the customer's phone prompt. Your merchant wallet is credited with 100% net of the requested amount (0% deducted).
  • When OFF (Merchant bears fee): The customer is prompted for the exact amount, and the collection fee is deducted when crediting your wallet.

Request Parameters (JSON Body)

Parameter Type Required Description
phone_number string Required Customer's mobile money phone number in international format without plus e.g. 256701234567 (strongly recommended for Airtel & MTN) or local 0777123456. Supported on MTN & Airtel Uganda, and Tanzanian networks (Vodacom, Airtel, Tigo, Halopesa).
amount number Required Amount to collect from the customer in account currency. Minimum is 500 UGX (or 1,000 TZS), maximum is 5,000,000 UGX.
description string Required Payment reason shown to the customer (e.g. "Order #1001"). Max 100 characters.
reference string Optional Your unique internal transaction identifier. Stored and returned in all responses and webhooks. Max 30 chars, no spaces.
currency string Optional Currency code (UGX, TZS, USD). Defaults to UGX.
network string Conditional Mobile network code (MTN, AIRTEL, VODACOM, TIGO, HALOPESA). Auto-detected on UGX, but strictly required for non-UGX currencies (e.g. TZS). Strongly recommended for Airtel Uganda.
webhook_url string Optional Custom callback endpoint to override your default merchant webhook for this transaction.

Code Example

curl -X POST https://hivepay.site/api/v1/collect-money \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-API-Secret: YOUR_API_SECRET" \
  -H "X-Account-Number: YOUR_ACCOUNT_NUMBER" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "0777123456",
    "amount": 50000,
    "reference": "ORDER-98765",
    "description": "Order #98765 payment"
  }'

Success Response (200 OK)

Response JSON
{
  "success": true,
  "message": "Collection request initiated. Prompt sent to customer phone.",
  "reference": "ORDER-98765",
  "gateway_reference": "HP-COL-AB12CD34EF",
  "amount": 50000,
  "net_credited": 48500,
  "currency": "UGX",
  "status": "pending",
  "network": "MTN"
}

Note: The transaction begins in pending status. When the customer enters their PIN, your webhook endpoint receives a signed transaction.success notification.