M-Token (PesaConnect) Hosted Checkout
Overview

This API accepts customer deposits through M-Token hosted checkout on pesaconnect.io. You create a payment with the Connect Africa collection API, redirect the customer to the returned checkout URL, and credit them only after the webhook reports success.

  • Purpose: Collect deposits via a hosted P2P checkout. The customer pays a verified agent in local mobile money.
  • Target Audience: Merchants, gaming platforms, and developers integrating Connect Africa payins.
  • Channel: Always 420001. The corridor is selected from currency.

Quickstart: M-Token Deposit
  1. Obtain your Bearer Token and generate the required signature and x-hash.
  2. POST to /api/v2/payment/ with channel 420001 and the wallet currency.
  3. Read data.redirect_url and send the customer to that page.
  4. Wait for the webhook on your result_url. Credit only when result_code is 0.
  5. You can also poll Transaction Query with the returned transaction_id.

Endpoint Reference
HTTP MethodPOST
Endpoint URL/api/v2/payment/
Base URLhttps://base-url-here.com
Channel420001
TypeHosted checkout (redirect)
DescriptionInitiate an M-Token hosted checkout deposit into your business wallet.
Request Body
FieldTypeDescriptionRequired
wallet_nostringBusiness wallet account number. Must match currency.Yes
referencestringYour unique order reference.Yes
acc_namestringCustomer / payer name shown on hosted checkout (minimum 2 characters).Yes
acc_nostringCustomer phone in international format without +, e.g. 254712345678. Prefills checkout when valid.No
emailstringCustomer email used for the PesaConnect deposit receipt. Falls back to the wallet holder email if omitted.Recommended
amountnumericOrder amount in major units (integer, no thousands separators). Example: 1000 for KES 1,000.Yes
currencystringSelects the PesaConnect corridor. See supported currencies below.Yes
channelnumericAlways 420001.Yes
descriptionstringShort payment description.Yes
result_urlstringHTTPS URL on your server for the final SUCCESS / FAILED webhook.Yes
Supported Currencies

Always send channel 420001. The corridor is selected from currency:

CurrencyMarketExample phone (acc_no)
KESKenya254712345678
TZSTanzania255712345678
UGXUganda256712345678
ETBEthiopia251912345678
SOSSomalia252612345678
RWFRwanda250712345678
BIFBurundi257712345678
NGNNigeria2348012345678
GHSGhana233241234567
XOFWest Africa2250712345678
Request Headers
HeaderTypeDescriptionRequired
AuthorizationstringBearer token used to access the APIYes
SignaturestringSHA-256 signature. Concatenate channel+reference+currency+amount, sign with your private key, and Base64 encode.Yes
x-hashstringGenerated X-Hash header. See Generate X-hash.Yes

Example Request — Kenya (KES)
curl --location --request POST 'https://base-url-here.com/api/v2/payment/' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Signature: xxx' \
--header 'x-hash: xxxxxx' \
--data-raw '{
    "wallet_no": "xxxxxxx",
    "reference": "DEP-123456",
    "acc_name": "Jane Doe",
    "acc_no": "254712345678",
    "email": "jane@example.com",
    "currency": "KES",
    "amount": 1000,
    "channel": 420001,
    "description": "Wallet deposit",
    "result_url": "https://your-server.com/webhook"
}'
Example Request — Tanzania (TZS)

Same channel. Only currency and the matching wallet change.

{
    "wallet_no": "xxxxxxx",
    "reference": "DEP-TZ-123",
    "acc_name": "Jane Doe",
    "acc_no": "255712345678",
    "email": "jane@example.com",
    "currency": "TZS",
    "amount": 10000,
    "channel": 420001,
    "description": "Wallet deposit",
    "result_url": "https://your-server.com/webhook"
}

Success Response
FieldTypeDescription
successbooleanIndicates if the request was successful
messagestringResponse message
data.transaction_idstringConnect Africa transaction ID. Use this with Transaction Query.
data.referencestringYour order reference
data.statusstringPENDING until the customer completes checkout
data.status_descriptionstringHuman-readable status
data.amountnumberRequested amount
data.currencystringISO currency code
data.redirect_urlstringPesaConnect hosted checkout URL. Redirect the customer here.
data.datestringTransaction timestamp
{
    "success": true,
    "message": "Successfully initiated",
    "data": {
        "transaction_id": "126091400001",
        "reference": "DEP-123456",
        "status": "PENDING",
        "status_description": "Transaction Initiated successfully",
        "amount": 1000,
        "currency": "KES",
        "redirect_url": "https://pesaconnect.io/checkout/0199a1c2-...",
        "date": "2026-09-14 12:00:00 PM"
    }
}

Redirect the customer to redirect_url. Do not credit them until the webhook reports success.


Webhook

Same Connect Africa callback as other collections. See Webhook Callback. Credit only when result_code is 0 (status SUCCESS). Pending, cancelled, or expired checkouts stay PENDING or move to FAILED.

Sample success callback
{
  "channel": "420001",
  "reference": "DEP-123456",
  "transaction_id": "126091400001",
  "third_party_id": "0199a1c2-...",
  "currency": "KES",
  "amount": "1000",
  "fees": "0",
  "acc_name": "Jane Doe",
  "result_code": 0,
  "result_description": "The service request is processed successfully.",
  "hash": "c920aaebae731f9e16d9a8f1fc1e349b99313cf230f18126a0bbd07d64aac2e0"
}

Notes
  • Checkout sessions expire after 15 minutes on PesaConnect if the customer does not lock an order.
  • The customer pays a verified agent in mobile money. Connect Africa credits your wallet after dual confirmation (customer paid + agent confirmed).
  • Allocate channel 420001 to the merchant wallet in tenant-admin before going live.
  • Unsupported currencies return an error. Use one of the currencies in the table above.
  • Phone validation is skipped for this channel. Send E.164 digits in acc_no when you want checkout prefilled.

Security Best Practices
  • Always use HTTPS for all API requests and your result_url.
  • Keep your private key secure and never share it.
  • Verify the webhook hash on every callback before crediting the customer.
  • Treat redirect_url as a one-time checkout session. Do not reuse it for a different amount or customer.

Terms of Use & Legal

By using this API, you agree to our Terms of Service and Privacy Policy. Do not share sensitive data or credentials.