Skip to content

SDKs

Official SDKs wrap the encryption and HTTP calls for you — use one if your language is covered.

Terminal window
npm install pesepay
const { Pesepay } = require('pesepay');
const pesepay = new Pesepay('INTEGRATION_KEY', 'ENCRYPTION_KEY');
pesepay.resultUrl = 'https://example.com/result';
pesepay.returnUrl = 'https://example.com/return';
const transaction = pesepay.createTransaction(amount, 'CURRENCY_CODE', 'PAYMENT_REASON');
pesepay
.initiateTransaction(transaction)
.then((response) => {
const redirectUrl = response.redirectUrl; // send the customer here
const referenceNumber = response.referenceNumber; // store for tracking
})
.catch((error) => { /* handle error */ });
const payment = pesepay.createPayment(
'CURRENCY_CODE', 'PAYMENT_METHOD_CODE',
'CUSTOMER_EMAIL', 'CUSTOMER_PHONE_NUMBER', 'CUSTOMER_NAME'
);
const requiredFields = { customerPhoneNumber: '0777777777' };
pesepay
.makeSeamlessPayment(payment, 'PAYMENT_REASON', amount, requiredFields)
.then((response) => {
const pollUrl = response.pollUrl;
const referenceNumber = response.referenceNumber;
})
.catch((error) => { /* handle error */ });

Running WooCommerce, PrestaShop, Moodle or WHMCS? Install the plugin instead — no integration code at all.