ClickpesaProvider implements the FinConnect provider interface for ClickPesa, handling JWT token generation and USSD push payment initiation via ClickPesa’s third-party API.
authenticate()
POST {baseUrl}/third-parties/generate-token
Headers:
{} (empty)
Returns: JWT token string (response.data.token).
Throws: "Authentication failed: ..." if the request fails.
initiateUssdPushRequest()
sdk.pay() is sent directly.
Endpoint: POST {baseUrl}/third-parties/payments/initiate-ussd-push-request
Request body: The raw payload object.
Headers: Authorization: <token>
Returns: ClickPesa payment response object.
Throws: "Payment request failed: ..." if the request fails.
registerIpn()
Inherited from baseProvider. Always throws "IPN registration not supported by this provider". ClickPesa does not support IPN registration through this SDK.
Use
FintechSDK.pay() rather than calling ClickpesaProvider directly. Token generation and request normalisation are handled internally.