npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

paga-collect

v1.1.7

Published

The Paga Collect API allows anyone (payment request initiator) to initiate a payment request to a third party and automatically get notified when the payment request is fulfilled

Downloads

202

Readme

Paga Collect Nodejs API Library v1.1.6

Paga Collect Services exposed by the library

  • paymentRequest
  • getBanks
  • paymentStatus
  • paymentHistory
  • registerPersistentPaymentAccount

For more information on the services listed above, visit the Paga DEV website

How to use

npm install paga-collect

const PagaCollectClient = require('paga-collect');

const pagaCollectClient = new PagaCollectClient().
                            .setClientId("<publicId>")
                            .setPassword("<secretkey>")
                            .setApiKey("<HMAC>")
                            .setTest(true)
                            .build();

As shown above, you set the publicId, apiKey, password given to you by Paga, If you pass true as the value for setIsTest(), the library will use the test url as the base for all calls. Otherwise setting it to false will use the live url value you pass as the base.

Paga Collect Service Functions

Request Payment

Registers a new request for payment between a payer and a payee. Once a payment request is initiated successfully, the payer is notified by the platform (this can be suppressed) and can proceed to authorize/execute the payment. Once the payment is fulfilled, a notification is sent to the supplied callback URL.

To make use of this function, call the paymentRequest inside PagaCollectClient which will return a JSONObject.


let data = {
      "referenceNumber": "53yw19011000009112",
      "amount": 200,
      "callBackUrl": "http://localhost:5000/core/webhook/paga",
      "currency": "NGN",
      "expiryDateTimeUTC": "2021-05-20T19:35:47",
      "isAllowPartialPayments": false,
      "isSuppressMessages": false,
      "payee": {"bankAccountNumber": "XXXXXXXXXXX",
                "bankId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX",
                "name": "John Doe",
              "accountNumber": "XXXXXXXXXX"},
      "payer": {"email": "[email protected]",
                "name": "Foo Bar", 
                "bankId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX", 
                "phoneNumber": "XXXXXXXXXXX"},
      "payerCollectionFeeShare": 1.0,
      "recipientCollectionFeeShare": 0.0,
      "paymentMethods": ["BANK_TRANSFER", "FUNDING_USSD"]
      }

  pagaCollectClient.paymentRequest(data).then(resp => {
        console.log(JSON.stringify(resp))
    });

Create Persistent Payment Account

An operation for business to create Persistent Payment Account Numbers that can be assigned to their customers for payment collection. These account numbers belong to the organization and are assigned to their customers to make payments anytime via Bank or Paga transfers.

To make use of this function, call the registerPersistentPaymentAccount inside PagaCollectClient which will return a JSONObject.


let data = {
      "referenceNumber": "53yw19011000009112",
      "phoneNumber": 07022222222,
      "firstName": "John",
      "lastName": "Doe",
      "accountName": John DOe,
      "financialIdentificationNumber":  22222222222220,
      "accountReference": 2222222222,
      "creditBankId": 40090E2F-7446-4217-9345-7BBAB7043C4C,
      "creditBankAccountNumber": 0000000000,
      "callBackUrl": "http://localhost:5000/core/webhook/paga"
      }

  pagaCollectClient.registerPersistentPaymentAccount(data).then(resp => {
        console.log(JSON.stringify(resp))
    });

Get Banks

Retrieve a list of supported banks and their complementary unique ids on the bank. This is required for populating the payer (optional) and payee objects in the payment request model. To make use of this function, call the getBanks inside PagaCollectClient which will return a JSONObject.

let data = {referenceNumber:'529383853031111'}
    pagaCollectClient.getBanks(data).then(resp => {
        console.log(JSON.stringify(resp))
    });
  
   

Query Payment Request Status

Query the current status of a submitted payment request. To make use of this function, call the paymentStatus inside PagaCollectClient which will return a JSONObject.

let data = {referenceNumber:'529383853031111'}
    pagaCollectClient.paymentStatus(data).then(resp => {
        console.log(JSON.stringify(resp))
    });

Payment Request History

Get payment requests for a period between to give start and end dates. The period window should not exceed 1 month. To make use of this function, call the paymentHistory inside PagaCollectClient which will return a JSONObject.

let data = {
      referenceNumber : "82353464000000",
      startDateTimeUTC : "2021-04-19T19:15:22",
      endDateTimeUTC : "2021-05-18T19:15:22"
  
    }

 pagaCollectClient.paymentHistory(data).then(resp => {
        console.log(JSON.stringify(resp))
    });

Update Persistent Payment Account

This endpoint allows for changing any of the account properties except the accountNumber (NUBAN) and the accounReference properties which cannot be changed. To make use of this function, call the updatePersistentPaymentAccount inside PagaCollectClient which will return a JSONObject.

   let data = {
        referenceNumber: uuidv4(),
        accountIdentifier: "0013188322",
        firstName: "Shane",
        lastName: "Moss",

    }

 pagaCollectClient.updatePersistentPaymentAccount(data).then(resp => {
        console.log(JSON.stringify(resp))
    });

Get Persistent Payment Account

A method to query the properties associated with an existing persistent payment account.

To make use of this function, call the getPersistentPaymentAccount inside PagaCollectClient which will return a JSONObject.

 let data = {
        referenceNumber: uuidv4(),
        accountIdentifier: "0013188322",

    }

 pagaCollectClient.getPersistentPaymentAccount(data).then(resp => {
        console.log(JSON.stringify(resp))
    });

Delete Persistent Payment Account

This endpoint allows for deleting a persistent payment account.

To make use of this function, call the deletePersistentPaymentAccount inside PagaCollectClient which will return a JSONObject.


    let data = {
        referenceNumber: uuidv4(),
        accountIdentifier: "0013188322"

    }

 pagaCollectClient.deletePersistentPaymentAccount(data).then(resp => {
        console.log(JSON.stringify(resp))
    });

Payment Request Refund

This end-point can be used to either cancel or initiate a refund if we were unable to fulfill the request for one reason or the other.

To make use of this function, call the paymentRequestRefund inside PagaCollectClient which will return a JSONObject.


   let data = {
        referenceNumber: "e38a59d2-ea69-456f-8b82-4a9288c83bf3",
        refundAmount: 2000,
        currency: "NGN",
        accountIdentifier: "1030850838"

    }

 pagaCollectClient.paymentRequestRefund(data).then(resp => {
        console.log(JSON.stringify(resp))
    });