Direct API
With the Direct API, your own UI collects the payment method and any fields it requires (like a phone number for EcoCash), and you submit everything directly — no redirect to a Pesepay-hosted page.
- Customer → Your server Submits checkout method + phone number
- Your server → Pesepay Make payment POST /v2/payments/make-payment
- Pesepay → Wallet provider Requests the debit
- Wallet provider → Customer PIN prompt on the phone
- Pesepay → Your server referenceNumber + pollUrl status not yet final
- Customer → Wallet provider Enters PIN
- Pesepay → Your server Result callback POST resultUrl
- Your server → Pesepay Confirm the status GET /payments/check-payment
The gap between Make Payment returning and the result callback is the part
that catches people out: your
API call has already returned while the customer is still holding their
phone. Show a waiting state, and drive it from the callback or pollUrl.
Building it
Section titled “Building it”- Pick a payment method and check its
required fields — e.g. EcoCash needs
customerPhoneNumber, InnBucks needs no extra fields at all. - Build the request — amount, currency,
paymentMethodCode, the method’s required fields, plusresultUrlandreturnUrl. - Encrypt and send it to Make Payment.
- Decrypt the response and store the
referenceNumber. The customer still has to approve the payment on their side, so the status you get back is usually not final. - Get the result via the result callback
or by checking status with the
referenceNumber.
Running the Direct API on a web checkout and want cards or more methods? See Migrate from the Direct API.
Full request/response fields, headers, and code samples in five languages: Make Payment reference →