Payment flow
Your server calls sdk.pay()
You call
sdk.pay(paymentData, ipnId) with the payment details and (for PesaPal) the IPN ID returned from a prior sdk.registerIpn() call.FinConnect authenticates with the provider
The SDK fetches a fresh auth token from the provider using your configured credentials. See Authentication for details.
Provider sends a USSD push notification
The provider delivers a USSD prompt to the customer’s mobile number included in the payment payload.
Customer enters their PIN to authorize
The customer confirms the payment on their device by entering their mobile money PIN.
Provider sends an IPN notification
The provider sends a payment status notification to your registered webhook URL (PesaPal only).
The sdk.pay() method
ipnId parameter behaves differently per provider:
- PesaPal —
ipnIdis required. The SDK merges it into the payload asnotification_idbefore submitting toPOST /api/Transactions/SubmitOrderRequest. - ClickPesa —
ipnIdis ignored. The rawpaymentDataobject is sent directly toPOST /third-parties/payments/initiate-ussd-push-request. - AzamPay —
ipnIdis ignored. The rawpaymentDataobject is sent directly toPOST /azampay/mno/checkout.
Registering an IPN URL (PesaPal)
Before you initiate a PesaPal payment, register your webhook URL to receive payment notifications:registerIpn() calls POST /api/URLSetup/RegisterIPN and returns an ipn_id string. Pass this value as the second argument to sdk.pay().
Payment payload examples
- PesaPal
- ClickPesa
- AzamPay
The SDK merges The final request body sent to PesaPal includes all fields above, plus
notification_id into your payload and posts it to POST /api/Transactions/SubmitOrderRequest with a Bearer token:notification_id: ipnId.