📕Backend

Introduction

Sonic Payment Gateway provides official SDKs and libraries for several programming languages to make it easy for developers to integrate the platform into their applications. The backend libraries currently available include:

  • Javascript

  • Sonic Payment Gateway Node - The official Sonic Payment Gateway NodeJS SDK

Javascript

The Sonic Payment Gateway NodeJS SDK is a library that allows developers to interact with the Sonic Payment Gateway API using JavaScript. It provides a simple and consistent interface for making requests and handling responses, as well as handling common errors.

Getting Started

To get started with the Sonic Payment Gateway NodeJS SDK, you'll first need to install it using npm.

Copy codenpm install @sonicpay/sdk

Once the SDK is installed, you can import it into your project and use it to make requests to the API.

Copy codeconst SonicPay = require('@sonicpay/sdk');

const sonicPay = new SonicPay({
  apiKey: 'API_KEY',
  secretKey: 'SECRET_KEY'
});

sonicPay.createPaymentLink({
  name: 'Test Payment Link',
  amount: 10,
  currency: 'USD'
}).then(response => {
  console.log(response);
}).catch(error => {
  console.log(error);
});

In the above example, we first imported the SDK, then created an instance of the SonicPay class with our API key and secret key. We then used the createPaymentLink method to create a new payment link, and logged the response to the console.

Documentation

For more detailed documentation on the Sonic Payment Gateway NodeJS SDK, including a list of all available methods and examples, please refer to the following link: https://docs.sonicpay.org/sdk/javascript

Note: You can provide more detailed information about how to use the SDK and how to interact with the API using the SDK.

Last updated