Skip to main content
The payx-js SDK allows you to accept payments directly on your website without redirecting your customers. It opens a secure, high-conversion checkout modal as an overlay.

Installation

Via NPM

Via CDN

For simple HTML sites, you can include the script via our CDN:

Basic Usage

To start a payment, initialize the PayX object and call the setup method.

Configuration Options

string
required
Your PayX Public Key (starts with pk_).
string
required
The customer’s email address.
number
required
The amount to charge in GHS.
string
default:"GHS"
The currency code. Currently only GHS is supported.
string
Customer’s first name.
string
Customer’s last name.
string
Customer’s mobile money number.
object
A JSON object containing custom data you want to associate with the transaction.

Callbacks

function
Called when the payment is completed successfully. Returns a response object with the transactionId.
function
Called if the customer closes the modal without completing the payment.
function
Called if an error occurs during the checkout process.