Plugins & SDKs
SDKs
Nodejs

loov-solutions-nodejs-sdk

Loov-solutions-nodejs-sdk, is a Node.js SDK that provides a simple interface for integrating with the Loov payment gateway. With LoovPay, you can easily initiate payments and receive payment notifications in your Node.js application.

Loov-solutions-nodejs-sdk instlllation, run the following command in your Node.js project terminal

npm install loov-solutions-sdk

Loov-solutions-nodejs-sdk usage

First require the module in your Node.js application

const LoovSolutionsSdk = require('loov-solutions-sdk')

Then, create a new instance of the LoovPay class with your app key and merchant key

const loovSolutionsSdk = new LoovSolutionsSdk('your-app-key', 'your-merchant-key')

You can use the getPaymentLink and mobilePayment methods to initiate payments

loovPay.getPaymentLink(paymentData)
  .then(response => {
    // Handle successful payment initiation
  })
  .catch(error => {
    // Handle payment initiation error
  });
 
loovPay.mobilePayment(paymentData)
  .then(response => {
    // Handle successful mobile payment
  })
  .catch(error => {
    // Handle mobile payment error
  });

LoovPay provides the following methods

getPaymentLink(paymentData): Initiates a payment and returns a payment link. paymentData is an object that contains the payment details, including the amount, currency, payment mode, return URL, cancel URL, callback URL, description, and customer details.

mobilePayment(paymentData): Initiates a mobile payment and returns a payment token for soft payment. paymentData is an object that contains the payment details, including the amount, operator, phone number, customer details, and callback URL.

Payment data object data structure

Mobile payment

{
        amount: 'required|integer|min:500',
        operator: 'required|string',
        phoneNumber: "required|string",
        customer: {
            name: "required|string",
            email: "required|string",
            phoneNumber: "required|string"
        },
        callback_url: "required|string"
}

Payment with Link

{
    amount: "required|integer|min:500",
    currency: "string",
    payment_mode: "string",
    return_url: "string",
    cancel_url: "string",
    callback_url: "string",
    description: "string",
    customer: {
        name: "string",
        email: "string",
        phoneNumber: "string"
    }
}