---
updatedAt: 2026-11-06T21:42:46.000Z
agentTools:
  projectIndex: https://developer-docs.paga.com/llms.txt
---

# Node Library

# Paga-Connect

Paga-connect is a NodeJS module that helps you make API calls when processing Paga Transactions.

## 1. Create Paga Business Account

You need to create a [Paga business account](https://mypaga.readme.io/docs/overview#section-2-paga-authentication-details)

## 2. Installation

Use the **package** manager [npm](https://www.npmjs.com/package/paga-connect) to install paga-connect.

```javascript Sample Code
npm install paga-connect
```

## 3. Usage

To use Paga-connect, you would need to import it

```javascript Sample Code
const PagaConnect = require('paga-connect')
```

To Initialize the module, you use a builder to set all required values

```javascript Sample Code
let pagaConnectClient = PagaConnect.Builder()
    .setClientId("<Paga_Client_ID>")
    .setSecret("<Paga_Client_Secret>")
    .setRedirectUri("<Your_Callback_URL>")
    .setScope("USER_DEPOSIT_FROM_CARD+MERCHANT_PAYMENT+USER_DETAILS_REQUEST")
    .setUserData("FIRST_NAME+LAST_NAME+USERNAME+EMAIL+ACCOUNT_BALANCE")
    .setIsTest(true)
    .build();
```

As shown above, you set the client id and secret key given to you by Paga, then set your redirect URL, scope, and User data are arrays of strings and are required to inform Paga-connect which data and operations you would need and initiate for the user.

## 4. Paga Connect Functions

## Authorisation Code

To obtain your authorisation code, click [here](https://developer-docs.paga.com/docs/getting-started-2#obtaining-the-authorization-code)

## Merchant Payments

This is the operation executed to make a payment to you on behalf of the customer. To make use of this function, call the **getAccessToken** in  PagaConnectClient which will return a JSON with the access token which will be used to complete payment.\ <br />

To get Access tokens, Use the authorization code gotten from the call to the backend :

```javascript Sample Code
const getAccessToken = pagaConnectClient.getAccessToken(authorizationCode)
		.then(function(res)){
          const{result} = res;
          console.log(result}
      })
     .catch(function(error)) {
            console.log(error);
       })
```

Access Token is used in making merchant payment like this:

```javascript Sample Code
const accessToken = getAccessToken();
pagaConnectClient.merchantPayment(accessToken,referenceNumber,amount,merchantCustomerReference,merchantProductCode,currency)
	.then(function(res) {
	console.log(res);
}).catch(function(error) {
	console.log(error);
})
```

## Money Transfer

This operation allows you to credit a user's Paga account. To make use of this function, call the **moneyTransfer** inside the ConnectClient which will return a JSON.

```javascript Sample Code
const accessToken = getAccessToken();
pagaConnectClient.moneyTransfer(accessToken,referenceNumber, amount,skipMessaging,recipientCredential)                 		 
		.then(function(res) {
		console.log(res);
}).catch(function(error) {
	console.log(error);
})
```

## Get User Details

This operation allows the client to get the user's personal details. The data requested is included in the authentication and authorization request in the data parameter. Additionally, the scope parameter must contain the USER\_DETAILS\_REQUEST option. To make use of this function, call the **getUserDetails** inside the ConnectClient which will return a JSON with user details.

```javascript Sample Code
const accessToken = getAccessToken();
await pagaConnectClient.getUserDetails(accessToken)
		.then(function(res) {
		console.log(res);
}).catch(function(error) {
	console.log(error);
})
```