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

zenopay

v1.0.2

Published

ZenoPay is a simple and seamless payment designed for developers looking to integrate secure and reliable payment functionality into their mobile, frontend, or backend applications. With minimal setup, you can initiate payments and track their statuses ef

Downloads

706

Readme

ZenoPay

ZenoPay is a simple and seamless payment designed for developers looking to integrate secure and reliable payment functionality into their applications. With minimal setup, you can initiate payments and track their statuses effortlessly.

Supported Mobile Networks

ZenoPay supports the following mobile payment networks:

  • M-PESA
  • TIGOPESA (MIX BY YAS)
  • HALOPESA
  • AIRTEL MONEY

Installation

Install the package using npm or yarn:

# Using npm
npm install zenopay

# Using yarn
yarn add zenopay

Usage

1. Backend Integration

Here’s how to integrate ZenoPay in a Node.js backend application:

import ZenoPay from "zenopay";

const zenoPayOptions = {
    accountID: "your-account-id",
    apiKey: "your-api-key",
    secretKey: "your-secret-key",
};

const zenoPay = new ZenoPay(zenoPayOptions);

// Make a payment
async function makePayment() {
    const paymentOptions = {
        amountToCharge: 1000,
        customerName: "John Doe",
        customerEmail: "[email protected]",
        customerPhoneNumber: "0701234567",
        callbackURL: "https://example.com/webhook"
    };

    const result = await zenoPay.Pay(paymentOptions);
    console.log(result);
}

// Check payment status
async function checkPaymentStatus(orderID: string) {
    const result = await zenoPay.CheckPaymentStatus(orderID);
    console.log(result);
}

API Reference

1. Pay(paymentOptions: PaymentOptionsType): Promise<RequestResponseType>

Initiates a payment request.

Parameters:

  • paymentOptions: An object with the following properties:
    • amountToCharge (number): Amount to charge (must be greater than 0).
    • customerName (string): Full name of the customer.
    • customerEmail (string): Email address of the customer.
    • customerPhoneNumber (string): Phone number of the customer (10 or 12 digits).
    • callbackURL (string): Callback URL after payment has been processed successful.

Response:

Returns a promise resolving to:

{
    success: boolean,
    message: any // API response or error message
}

2. CheckPaymentStatus(orderID: string): Promise<RequestResponseType>

Checks the status of a payment.

Parameters:

  • orderID (string): Unique identifier of the order to track.

Response:

Returns a promise resolving to:

{
    success: boolean,
    message: any // API response or error message
}

Example Responses

Payment Response:

{
{
  "success": true,
  "message": {
    "status": "success",
    "message": "Wallet payment successful",
    "order_id": "674c0d32b09dd"
  }
}
}

Payment Status Response:

{
  "success": true,
  "message": {
    "status": "success",
    "order_id": "674c0d32b09dd",
    "message": "Order status updated",
    "payment_status": "PENDING"
  }
}

Best Practices

  • Keep your keys secure: Never expose your apiKey or secretKey in frontend applications. Use environment variables or a secure backend to manage these keys.
  • Validate Inputs: Ensure all customer details and payment amounts are validated before initiating a payment.
  • Error Handling: Implement proper error handling to manage failed requests or API errors.

Support

For questions or support, contact us at [email protected].


License

This project is licensed under the MIT License.