Payment flow
1
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.2
FinConnect authenticates with the provider
The SDK fetches a fresh auth token from the provider using your configured credentials. See Authentication for details.
3
Provider sends a USSD push notification
The provider delivers a USSD prompt to the customer’s mobile number included in the payment payload.
4
Customer enters their PIN to authorize
The customer confirms the payment on their device by entering their mobile money PIN.
5
Provider sends an IPN notification
The provider sends a payment status notification to your registered webhook URL (PesaPal only).
6
Your server processes the notification
Your webhook handler receives the notification and confirms or rejects the order.
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.