Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.pesahub.co/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Sends a USSD push prompt to the customer’s phone, asking them to authorize a payment from their mobile money wallet. Supports M-Pesa, Airtel Money, Halopesa, Mixx by Yas, and TIPS Dynamic QR.

Endpoint

POST /v1/payments/ussd

Authentication

Requires a Bearer token in the Authorization header.
Authorization: Bearer {{api_key}}

Request Headers

HeaderValue
Acceptapplication/json
Content-Typeapplication/json

Request Body

FieldTypeRequiredDescription
amountintegerAmount to charge in the specified currency
currencystringCurrency code (e.g., TZS)
phone_numberstringCustomer’s phone number (e.g., 0692993353)
metadataobjectArbitrary key-value pairs for your reference
metadata.order_idstringYour internal order identifier
metadata.customer_notestringA note about the payment

Example Request

curl -X POST https://pesahub.test/api/v1/payments/ussd \
  -H "Authorization: Bearer {{api_key}}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1000,
    "currency": "TZS",
    "phone_number": "0692993353",
    "metadata": {
      "order_id": "5656",
      "customer_note": "Test payment"
    }
  }'

Request Body Example

{
  "amount": 1000,
  "currency": "TZS",
  "phone_number": "0692993353",
  "metadata": {
    "order_id": "5656",
    "customer_note": "Test payment"
  }
}
The customer will receive a USSD prompt on their phone to confirm the payment. Ensure the phone number matches an active mobile money account.