curl -X POST https://payx.company/api/v1/charge \
-H "x-api-key: px_live_v2_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 10.00,
"phoneNumber": "0551234987",
"network": "MTN",
"payerMessage": "Order #1001"
}'
const { PayX } = require('payx-node');
const payx = new PayX({ apiKey: process.env.PAYX_SECRET_KEY });
const res = await payx.charge.create({
amount: 10.00,
phoneNumber: '0551234987',
network: 'MTN',
payerMessage: 'Order #1001'
});
console.log('Transaction ID:', res.transactionId);
{
"message": "Transaction initiated",
"transactionId": "sample_transaction_id_550e8400",
"status": "PENDING"
}
API Reference
Create Charge
Initiate a Mobile Money collection
POST
/
charge
curl -X POST https://payx.company/api/v1/charge \
-H "x-api-key: px_live_v2_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 10.00,
"phoneNumber": "0551234987",
"network": "MTN",
"payerMessage": "Order #1001"
}'
const { PayX } = require('payx-node');
const payx = new PayX({ apiKey: process.env.PAYX_SECRET_KEY });
const res = await payx.charge.create({
amount: 10.00,
phoneNumber: '0551234987',
network: 'MTN',
payerMessage: 'Order #1001'
});
console.log('Transaction ID:', res.transactionId);
{
"message": "Transaction initiated",
"transactionId": "sample_transaction_id_550e8400",
"status": "PENDING"
}
Authentication
This endpoint requires your v2 secret API key:- Header:
x-api-key: px_live_v2_...orAuthorization: Bearer px_live_v2_...
Body Parameters
number
required
The amount to collect in GHS. Must be a positive number with at most 2 decimal places (e.g.
10.00).string
required
The customer’s 10-digit mobile money number (e.g.,
0551234987).string
required
The network provider. Options:
MTN, TELECEL, AIRTELTIGO.string
default:"GHS"
The currency code. Currently only
GHS is supported.string
A message displayed to the customer on their phone prompt.
string
A private note for your records.
Response
string
A summary of the initiation status.
string
The unique ID for this transaction. Use this for status checks.
string
The current status. Usually
PENDING.curl -X POST https://payx.company/api/v1/charge \
-H "x-api-key: px_live_v2_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 10.00,
"phoneNumber": "0551234987",
"network": "MTN",
"payerMessage": "Order #1001"
}'
const { PayX } = require('payx-node');
const payx = new PayX({ apiKey: process.env.PAYX_SECRET_KEY });
const res = await payx.charge.create({
amount: 10.00,
phoneNumber: '0551234987',
network: 'MTN',
payerMessage: 'Order #1001'
});
console.log('Transaction ID:', res.transactionId);
{
"message": "Transaction initiated",
"transactionId": "sample_transaction_id_550e8400",
"status": "PENDING"
}