payx-node
v1.0.5
Published
The official Node.js SDK for PayX
Maintainers
Readme
PayX Node.js SDK
The official Node.js SDK for the PayX Payment Gateway.
Installation
npm install payx-node
# or
yarn add payx-nodeUsage
Initialize the Client
const { PayX } = require('payx-node');
const payx = new PayX({
apiKey: 'your_payx_api_key'
});Initiate a Mobile Money Charge
async function chargeCustomer() {
try {
const response = await payx.charge.create({
amount: 10.0,
currency: 'GHS',
phoneNumber: '0551234987',
network: 'MTN',
payerMessage: 'Order #1234',
payeeNote: 'SaaS Subscription'
});
console.log('Transaction ID:', response.transactionId);
console.log('Status:', response.status);
} catch (error) {
console.error('Charge failed:', error.message);
}
}Verify Webhook Signatures
const isValid = payx.webhooks.verifySignature(
req.rawBody,
req.headers['x-payx-signature'],
'your_webhook_secret'
);Documentation
For full documentation, visit docs.payx.company.
