1.0.1 • Published 6 months ago

loov-solutions-sdk v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

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');

Init payments

Methods to initiate payments

  getPaymentLink(paymentData):Promise<LoovResponse>

Payin Mobile

Make a mobile money payment

  mobilePayment(paymentData):Promise<LoovResponse>

Check payment status

Checking the status of a payment requires the transaction reference

getPaymentStatus(reference:string):Promise<CheckRefResponse>

Pay Out

Please note that this API is only available to merchants who have subscribed to this service and have been approved by our compliance department.

Be sure to manage the response appropriately in your application to provide users with accurate transaction information.

initPayOut(payload: mobilepayOutRules):Promise<LoovResponse>

How to use the loov payment api

Using the payment sdk is very simple: once you've instantiated your class, you have access to all the api functions.

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.getPaymentStatus(paymentReference)
  .then(response => {
    // Handle successful mobile payment
  })
  .catch(error => {
    // Handle mobile payment error
  });

  loovPay.initPayOut(payOutData)
  .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.

  • getPaymentStatus(paymentReference) Loov's API getPaymentStatus method lets you check the payment status of your transactions..

  • initPayOut(payOutData) initPayOut is the method that allows you to make withdrawals from your loov backoffice. To access this service, you must be unreadable.

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"
    }
}

Pay Out

{
    amount: 'required|integer|min:500',
    operator: 'required|string',
    phoneNumber: "required|string",
    currency: "required|string",
}

Check Payment Status

  /payment/status/${transactionRef}`,

If you need help with LoovPay, you can contact the Loov support team at .

npm version 1.0.0

For more information on LoovPay, see the GitHub repository or the official documentation.