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

ufitpay-sdk

v1.0.2

Published

`UfitPaySDK` is a JavaScript SDK designed to easily integrate UfitPay's API for managing various financial transactions, such as listing services, querying balances, validating accounts, and initiating payments.

Downloads

12

Readme

UfitPaySDK

UfitPaySDK is a JavaScript SDK designed to easily integrate UfitPay's API for managing various financial transactions, such as listing services, querying balances, validating accounts, and initiating payments.

Installation

Install the SDK via npm:

npm install ufitpay-sdk

First, import the SDK and initialize it with your apiKey and apiToken.

import UfitPaySDK from 'ufitpay-sdk';

const sdk = new UfitPaySDK('yourApiKey', 'yourApiToken');

Methods

The following methods are available for interacting with the UfitPay API:

1. List Services

Retrieve a list of available services.

const services = await sdk.listServices();
console.log(services);

2. Get Balance

Check your account balance. The default currency is NGN (Nigerian Naira).

const balance = await sdk.getBalance('USD'); // or 'NGN' or any supported currency
console.log(balance);

3. List Vendors

Get a list of vendors for a specific service.

const vendors = await sdk.listVendors(serviceId);
console.log(vendors);

4. List Packages

Retrieve packages offered by a vendor.

const packages = await sdk.listPackages(vendorId);
console.log(packages);

Error Handling

All methods throw an error in case of network issues or API errors. It’s recommended to wrap calls in a try...catch block for proper error handling:

try {
    const balance = await sdk.getBalance();
    console.log(balance);
} catch (error) {
    console.error('An error occurred:', error.message);
}

API Methods

| Bill payment | Description | Parameters | |-----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| | listServices() | Retrieves a list of available services. | None | | getBalance(currency) | Fetches the account balance for the specified currency (default is NGN). | currency (optional) - Currency code (e.g., 'NGN', 'USD') | | listVendors(serviceId) | Lists vendors for a specific service. | serviceId - The ID of the service | | listPackages(vendorId) | Lists packages offered by a specific vendor. | vendorId - The ID of the vendor | | listAvailableVendorsWithPrice(serviceId) | Lists vendors, packages, and prices for a given service. | serviceId - The ID of the service | | getOrderPrice(serviceId, vendorId, packageId, amount) | Calculates the price of an order based on parameters. | serviceId - Service ID, vendorId - Vendor ID, packageId (optional), amount (optional) | | validatePayerAccount(accountNumber, vendorId) | Validates a payer's account with the vendor. | accountNumber - Account number, vendorId - Vendor ID | | initiateBillPayment(serviceId, vendorId, packageId, accountNumber, amount, requestRef) | Initiates a bill payment. | serviceId - Service ID, vendorId - Vendor ID, packageId (optional), accountNumber, amount (optional), requestRef (optional) | | transactionStatusQuery(reference, requestRef) | Queries the status of a transaction by reference. | reference - Transaction reference, requestRef (optional) - Request reference |

This table provides a summary of the methods available in the UfitPaySDK for managing bill payments, including service listing, vendor and package retrieval, account validation, and transaction status checking.