Skip to main content
The payx-node SDK provides a robust set of tools for interacting with the PayX API from your server-side Node.js applications. It handles authentication, request signing, response parsing, and error management automatically.

Installation

Install the package via NPM:

Initialization

Initialize the client with your v2 Secret Key retrieved from the PayX Dashboard.

1. Creating Checkout Sessions (Inline Checkout)

Generate a short-lived (30-minute) scoped token for client-side checkout with payx-js:
Pass checkout.checkoutToken to your frontend to render PayX.checkout({ token: checkout.checkoutToken }).

2. Direct Collections (Mobile Money Charge)

To initiate a direct USSD prompt on a customer’s phone, use charge.create:

3. Payouts (Disbursements)

Send money to any mobile money wallet using payouts.create.
payouts.create requires an idempotencyKey (16–128 alphanumeric characters, hyphens, and underscores) to prevent duplicate payouts during network retries.

4. Webhook Verification

Verify that incoming webhooks are authentic and signed with your webhook secret (whsec_live_... or whsec_test_...):