Getting Started
The pawaPay Node.js SDK is an enterprise-grade wrapper that simplifies mobile money operations. It handles validation, logging, and version-aware API calls out of the box.
environment: "sandbox"
PAWAPAY_SDK_LICENSE_DOMAIN binding before authorizing the ApiClient.
Version Comparison: v1 vs v2
The SDK is version-aware. Depending on your choice, the internal payload structure changes to match pawaPay's standards:
Uses
correspondent and msisdn fields. Best for simple integrations.description → statementDescription
Uses
provider and MMO structure. Supports advanced metadata and tracking.description → customerMessage
Implementation Logic
const client = new ApiClient({
apiToken: process.env.PAWAPAY_SANDBOX_API_TOKEN,
environment: "sandbox",
apiVersion: "v2",
sslVerify: false,
licenseKey: process.env.KATORYMND_PAWAPAY_SDK_LICENSE_KEY
});
Installation & Core Setup
The @katorymnd/pawapay-node-sdk comes pre-configured with all necessary production dependencies. Installing the SDK automatically satisfies requirements for logging, validation, and API communication.
# Using NPM
npm install @katorymnd/pawapay-node-sdk
# Using PNPM (Recommended for v10+)
pnpm add @katorymnd/pawapay-node-sdk
SDK Bundle Insights
The following core dependencies are bundled and initialized during the installation of the sdk:
Handles surgical logging for
payment_success.log and payment_failed.log.
Used for schema validation of amount, MSISDN, and currency before API dispatch.
Managed HTTP client for secure v1/v2 handshakes with pawaPay servers.
Ensures payer MSISDNs are valid for African mobile network operators.
Recommended Project Structure
To ensure logs and environment variables are mapped correctly, align your project as follows:
├── src/
│ └── payments/ # Your custom pawaPay logic
├── .env # Contains your Master Keys & License
└── package.json # Includes @katorymnd/pawapay-node-sdk
Engine Requirement: Ensure you are running Node.js >= 14.0.0 and pnpm >= 8.0.0 for optimal performance.
License Activation & Domain Binding
Activation is a one-time surgical handshake that unlocks production API access and enterprise features. The @katorymnd/pawapay-node-sdk utilizes a Dual-Locking system to ensure license integrity.
Step-by-Step Validation
LICENSE_KEY and LICENSE_SECRET. These are generated upon successful checkout.
.env. The SDK automatically extracts these during ApiClient initialization.
server_fingerprint and installation_imprint, locking the key to your specific hardware.
/api/appLicense/heartbeat to maintain activation health and check for remote suspensions.
Licensing Error Codes (API Response)
When an activation or validation request fails, the API returns a valid: false or activated: false response with one of the following reasons:
Security Lock: This domain is already bound to a different server fingerprint or installation imprint.
Threshold Met: All allowed activation slots for this
licenseKey are currently in use.
Fresh Key: The license exists but hasn't undergone the initial
activate-domain handshake yet.
Validity End: The
valid_until timestamp has passed. Production traffic is now blocked.
Admin Action: License suspended due to non-payment, refund, or policy violation.
Missing Record: The provided
licenseKey does not exist in the Katorymnd database.
Environment Configuration
The @katorymnd/pawapay-node-sdk uses a strictly decoupled configuration model. We recommend managing your credentials via a .env file at the project root to ensure security and portability.
.env file to version control. Ensure .env is added to your .gitignore to prevent leaking Master Keys or License Secrets.
Required Variables (.env)
PAWAPAY_SANDBOX_API_TOKEN=your_sandbox_api_token_here
PAWAPAY_PRODUCTION_API_TOKEN=your_production_api_token_here
KATORYMND_PAWAPAY_SDK_LICENSE_KEY=your_sdk_license_key_here
PAWAPAY_SDK_LICENSE_DOMAIN=your-licensed-domain.com
PAWAPAY_SDK_LICENSE_SECRET=your_sdk_license_secret_here
Variable Definitions
Set to
sandbox for testing or production for live money. The SDK automatically selects the corresponding token.
A secondary cryptographic key used to prevent "License Spoofing" during the domain handshake.
The canonical domain name (e.g.,
your-domain.com) where the SDK is authorized to run.
Production Handshake Logic
When environment = "sandbox", //change `production/sandbox`, the SDK executes a POST /validate request to the Katorymnd API. If the environment variables do not match the surgical record in the database, the ApiClient will throw a fingerprint_mismatch exception and halt execution.
Troubleshooting & Diagnostics
The @katorymnd/pawapay-node-sdk utilizes the FailureCodeHelper utility to normalize various MNO responses. Check your logs/payment_failed.log for these specific rejection and failure codes.
1. Licensing & Connection Errors
Cause: Server hardware/imprint changed.
Fix: Contact Support for assistance.
Cause: Your
PAWAPAY_API_TOKEN is invalid or expired.Fix: Verify the token in your pawaPay dashboard matches your
.env.
Cause: Firewall blocking port 443.
Fix: Whitelist
katorymnd.com and pawapay.io api.
2. Initiation Rejections (v1 / v2)
These errors occur during the initiateDeposit phase if the request parameters are malformed or unauthorized.
Message: The amount is not valid for this provider.
Fix: Ensure the amount is a positive number with max 2 decimal places.
Message: The amount is outside provider limits.
Fix: Check the specific MNO (MTN/Airtel) min/max transaction limits.
Message: The phone number format is invalid.
Fix: Ensure the MSISDN follows the E.164 format (e.g., 2567...).
3. Processing Failures
These codes are returned after a successful initiation, typically when the MNO or the Payer rejects the transaction.
Cause: Payer has reached their wallet limit or has insufficient funds.
Fix: Transaction is terminal. Ask the customer to top up.
Cause: Customer cancelled the USSD prompt or timed out.
Fix: Ask the customer to keep their phone unlocked and retry.
Cause: Payer already has an active USSD prompt pending.
Fix: Wait for the previous transaction to expire before retrying.
Debugging Hint: The FailureCodeHelper automatically aliases legacy V1 codes (like AMOUNT_TOO_SMALL) to their V2 equivalents (AMOUNT_OUT_OF_BOUNDS) for consistent logging.
Support & Technical Assistance
If you encounter challenges during the integration of the @katorymnd/pawapay-node-sdk, our engineering team is available to assist you. To ensure the fastest resolution, please follow the diagnostic steps below before reaching out.
For integration logic, private server debugging, or licensing help.
→ Email EngineeringTicket Checklist
When requesting technical support, please include the following data to skip the triage phase:
package.json (e.g., v1.1.0).• Environment: Sandbox or Production.
• Correlation ID: The
depositId or transactionId from your logs.• Error Object: A copy of the JSON response from
payment_failed.log.• Node Version: Output of
node -v.
Guaranteed Response Times
Included with Starter and Pro licenses. Responses within 24-48 business hours.
Included with Agency and Enterprise licenses. Direct channel access within 6-12 hours.
"Empowering African fintech through surgical engineering."