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

notchpay-api

v1.0.1

Published

Notch Pay JavaScript sdk for easy payment integrations

Downloads

13

Readme

npm version Notchpay NPM Package

Notch Pay JavaScript sdk for easy payment services integrations

This project serves as a Node Package Manager (NPM) Library designed for NotchPay. The primary objective of this package is to accelerate the integration process of Notch payment APIs for Node developers. Our aim is to empower developers to concentrate on their end goals, while we handle the intricacies on their behalf.

Installation

To install the Notch Pay Node.js package, use npm:

npm install notchpay-api

Configurations

Configure your Notch Pay API keys easily either through environment variables or directly within your application.

export NOTCHPAY_PUBLIC_KEY=your_public_key
export NOTCHPAY_PRIVATE_KEY=your_private_key

Features

This package offers a comprehensive solution for seamlessly integrating Notch Pay APIs, covering essential functionalities grouped into distinct modules:

  • Payment APIs: Streamline Notch Pay payment integration with a user-friendly TypeScript and JavaScript function call signature.
  • Transfer APIs: Facilitate seamless transfer handling through Notch Pay with dedicated TypeScript and JavaScript functions, ensuring a smooth integration experience.
  • MIscellaneous APIs: Access various Notch Pay functionalities effortlessly using TypeScript and JavaScript function call signatures, providing a unified and intuitive interface.
  • Webhooks: Simplify webhook implementation with a single function call, enhancing developer efficiency in setup and management.

Usage

Integrating Notch Pay into your Node.js application is as easy as importing the NotchPay class and accessing the desired API functionalities:

// Your application code
import { NotchPay, NotchPayConfig } from 'notchpay-api';

const notchPayConfig: NotchPayConfig = {
  endpoint: 'api.notchpay.co',
  publicKey: 'your_public_key',
  secretKey: 'your_secret_key',
};

const notchPay = new NotchPay(notchPayConfig);

// Now, you can use the notchPay instance to make API requests
notchPay.payments
  .initialize({
    amount: 500,
    currency: 'XAF',
    phone: '+237691622731',
  })
  .then(response => {
    // Handle the payment response
    console.log(response);
  })
  .catch(error => {
    // Handle errors
    console.error(error);
  });

Webhooks handling made easy

Handle notchpay webhooks event just by passing your callback handler to the desired event

app.post('/webhooks', (req: Request, res: Response) => {
  const completePaymentCallback = (eventId: string, data: any) => {
    console.log(`✔️ NotchPay completed payment event ${eventId} was received`)
  }

  const failedPaymentCallback = (eventId: string, data: any) => {
    console.log(`✔️ NotchPay failed payment event ${eventId} was received`)
  }

  return notchPay.webhooks.handleEvent(req, res, {
    'payment.complete': completePaymentCallback,
    'payment.failed': failedPaymentCallback,
  })
})

Tests

To ensure the reliability of the library, run the included test suite with the following command:

npm test

Note that Test will failed if API keys are not provided correctly

Contributions

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.