curl -X POST https://payx.company/api/v1/checkout \
-H "x-api-key: px_live_v2_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 100.00,
"currency": "GHS",
"email": "customer@example.com",
"metadata": {
"orderId": "ORD-5541"
}
}'
const { PayX } = require('payx-node');
const payx = new PayX({ apiKey: process.env.PAYX_SECRET_KEY });
const session = await payx.checkout.create({
amount: 100.00,
currency: 'GHS',
email: 'customer@example.com',
metadata: {
orderId: 'ORD-5541'
}
});
console.log('Checkout Token:', session.checkoutToken);
{
"checkoutToken": "px_checkout_sample_scoped_token_12345",
"url": "https://payx.company/checkout?key=px_checkout_sample_scoped_token_12345",
"expiresAt": "2026-09-09T22:35:00.000Z"
}
API Reference
Create Checkout Session
Generate a 30-minute scoped token for client-side checkout
POST
/
checkout
curl -X POST https://payx.company/api/v1/checkout \
-H "x-api-key: px_live_v2_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 100.00,
"currency": "GHS",
"email": "customer@example.com",
"metadata": {
"orderId": "ORD-5541"
}
}'
const { PayX } = require('payx-node');
const payx = new PayX({ apiKey: process.env.PAYX_SECRET_KEY });
const session = await payx.checkout.create({
amount: 100.00,
currency: 'GHS',
email: 'customer@example.com',
metadata: {
orderId: 'ORD-5541'
}
});
console.log('Checkout Token:', session.checkoutToken);
{
"checkoutToken": "px_checkout_sample_scoped_token_12345",
"url": "https://payx.company/checkout?key=px_checkout_sample_scoped_token_12345",
"expiresAt": "2026-09-09T22:35:00.000Z"
}
Creates a new checkout session and returns a scoped token (
px_checkout_...) valid for 30 minutes. Pass this scoped token to your frontend to initialize PayX.checkout() securely without exposing your secret API keys.
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.
100.00).string
default:"GHS"
required
The 3-letter ISO currency code. Currently only
GHS is supported.string
required
The customer’s email address.
object
Optional key-value object to store custom application metadata associated with the transaction.
Response
string
The 30-minute scoped token (starts with
px_checkout_) to pass to the frontend PayX.checkout({ token }) modal.string
The hosted checkout page URL (
https://payx.company/checkout?key=...).string
ISO 8601 timestamp indicating when the checkout token will expire.
curl -X POST https://payx.company/api/v1/checkout \
-H "x-api-key: px_live_v2_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 100.00,
"currency": "GHS",
"email": "customer@example.com",
"metadata": {
"orderId": "ORD-5541"
}
}'
const { PayX } = require('payx-node');
const payx = new PayX({ apiKey: process.env.PAYX_SECRET_KEY });
const session = await payx.checkout.create({
amount: 100.00,
currency: 'GHS',
email: 'customer@example.com',
metadata: {
orderId: 'ORD-5541'
}
});
console.log('Checkout Token:', session.checkoutToken);
{
"checkoutToken": "px_checkout_sample_scoped_token_12345",
"url": "https://payx.company/checkout?key=px_checkout_sample_scoped_token_12345",
"expiresAt": "2026-09-09T22:35:00.000Z"
}