Quick Start Guide

PayGate Node.js SDK: Direct API Integration Quick Start Guide

PayGate SDK: Quick Start Guide

Get started quickly with the unofficial Node.js SDK for PayGate’s Direct API integration.

📘

This SDK is community-maintained and not officially supported by PayGate. Use with discretion. For the latest features and full API control, consider using the Direct API reference.


Install the SDK

Use npm or yarn to install the package:

npm install paygate-sdk
# or
yarn add paygate-sdk

Basic Usage

Here’s a minimal working example to create a once-off payment request:

const PayGate = require('paygate-sdk');

const paygate = new PayGate({
  payGateId: '10011072130',
  encryptionKey: 'secret',
  testMode: true,
});

const paymentData = {
  reference: 'ORDER123',
  amount: 19999, // in cents
  currency: 'ZAR',
  returnUrl: 'https://yourdomain.com/return',
};

paygate.onceOffPayment(paymentData)
  .then((response) => {
    console.log('Payment URL:', response.redirectUrl);
  })
  .catch((error) => {
    console.error('Error creating payment:', error.message);
  });

SDK Configuration Options

ParameterDescription
payGateIdYour PayGate merchant ID
encryptionKeyYour PayGate encryption key
testModetrue for sandbox, false for live

Related Resources


Test Mode

To simulate a transaction without processing real payments, set testMode: true and use sandbox credentials provided by PayGate.


Advanced Usage (Coming Soon)

We’re working on adding examples for:

  • Recurring payments

  • Card tokenisation

  • Refund flows