Skip to main content
AzampayProvider implements the FinConnect provider interface for Azampay, handling JWT token generation and USSD push payment initiation via Azampay’s API.

authenticate()

async authenticate(): Promise<string>
Generates a JWT token from Azampay’s token endpoint using your appName client ID and client secret key. This is called automatically before each payment request — you do not need to call it directly. Endpoint: POST https://authenticator-sandbox.azampay.co.tz/AppRegistration/GenerateToken
This endpoint is used to generate token for sandbox application
Headers: Content-Type:application.json Request body:
  'appName': <AZAMPAY_APP_NAME>,
  'clientId': <AZAMPAY_CONSUMER_KEY>,
  'clientSecret': <AZAMPAY_CONSUMER_SECRET>,
Returns: JWT token string (response.data.data.accessToken). Throws: "Authentication failed: ..." if the request fails.

initiateUssdPushRequest()

async initiateUssdPushRequest(payload: any): Promise<any>
Sends a USSD push payment request to ClickPesa with the raw payload. Unlike PesaPal, no payload transformation is applied — the object you pass to sdk.pay() is sent directly. Endpoint: POST {baseUrl}/azampay/mno/checkout Request body: The raw payload object. Headers: Authorization: <token> Returns: Azampay payment response object. Throws: "Payment request failed: ..." if the request fails.

getPublicKey()

This method fetches the public key provided by azampay it is used to verify webhook cllas signature.
https://githubusercontent.com + somebody1011/finconnect/main/src/provider/AzampayProvider.ts
// Mintlify pulls your live AzamPay file here!

handleCallback()

After the USSD push is initiated, payment events are going to be updated by azampay through a webhook, which notifies your app of the event.
https://githubusercontent.com + somebody1011/finconnect/main/src/provider/AzampayProvider.ts
// Mintlify will now read this entire line as a single working path!

Use FintechSDK.pay() rather than calling ClickpesaProvider directly. Token generation and request normalisation are handled internally.