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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@devscast/flexpay

v1.0.3

Published

FlexPay API Typescript Client

Readme

Flexpay Typescript

npm npm Lint Tests GitHub

For privacy reasons, Flexpay original documentation cannot be shared without written permission, for more information about credentials and implementation details, please reach them at flexpay.cd

Installation

You can use the Typescript client by installing the npm package and adding it to your application’s dependencies:

npm install @devscast/flexpay

Usage

Authentication

  • Step 1. Contact Flexpay to get a Merchant Account You will receive a Merchant Form to complete in order to provide your business details and preferred Cash out Wallet or Banking Details.
  • Step 2. Once the paperwork is completed, you will be issued with Live and Sandbox Accounts (Merchant Code and Authorization token)

Then use these credentials to authenticate your client

import { Client as Flexpay } from "@devscast/flexpay";

const flexpay = new Flexpay("merchant_code", "token", "dev") // use "prod" for production

Create a Payment Request

import { CardRequest, MobileRequest } from "@devscast/flexpay";

const mobile = {
    amount: 10, // 10 USD
    currency: "USD",
    phone: "243999999999",
    reference: "your_unique_transaction_reference",
    description: "your_transaction_description",
    callbackUrl: "your_website_webhook_url",
} as MobileRequest;

const card = {
    amount: 10, // 10 USD
    currency: "USD",
    reference: "your_unique_transaction_reference",
    description: "your_transaction_description",
    callbackUrl: "your_website_webhook_url",
    homeUrl: "your_website_home_url",
} as CardRequest

Note: we highly recommend your callbacks urls to be unique for each transaction.

Mobile Payment

Once called, Flexpay will send a payment request to the user's mobile money account, and the user will have to confirm the payment on their phone. after that the payment will be processed and the callback url will be called with the transaction details.

const response = await  flexpay.pay(mobile);

Visa Card Payment

You can set up card payment via VPOS features, which is typically used for online payments. it's a gateway that allows you to accept payments from your customers using their credit cards.

const response = await flexpay.pay(card);
// redirect to response.url to complete the payment

handling callback (callbackUrl, approveUrl, cancelUrl, declineUrl)

Flexpay will send a POST request to the defined callbackUrl and the response will contain the transaction details. you can use the following code to handle the callback by providing incoming data as array.

const webhook = flexpay.handleCallback(req.body);
flexpay.isSuccessful(webhook) // true or false

Check Transaction state

You don't trust webhook ? you can always check the transaction state by providing the order number.

const tx = flexpay.check(mobile.orderNumber);
flexpay.isSuccessful(tx) // true or false

Contributors