Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@notchpay/payment

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@notchpay/payment

Notch Pay API wrapper.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Notch Pay

Nodejs API wrapper for Notch Pay.

Installation and Authentication

npm install @notchpay/payment

Authenticate

// Require the library
var notchpay = require("@notchpay/payment")("business_key");

Transaction

Allows you to perform transactions on your nodejs and JavaScript applications.

Initiate

// Initiate transaction
await notchpay
  .transaction()
  .init(500, "usd", {
    name: "Chapdel KAMGA",
    email: "hello@chapdel.me",
  })
  .then((r) => {
    console.log("success", r.data);
  })
  .catch((e) => {
    console.log("error", e);
  });

Check

// Check transaction
await notchpay
  .transaction()
  .check("transaction_reference")
  .then((r) => {
    console.log("success", r.data);
  })
  .catch((e) => {
    console.log("error", e);
  });

Complete

// Complete transaction
await notchpay
  .transaction()
  .complete("transaction_reference", "notchpay", {
    number: 123456789,
    code: 12345,
  })
  .then((r) => {
    console.log("success", r.data);
  })
  .catch((e) => {
    console.log("error", e);
  });

Complete With Window

This method offers you the possibility to complete the transaction in a new window. It is necessary to follow our instructions.

// Complete transaction
await notchpay
  .transaction()
  .complete("transaction_reference", "notchpay", {
    number: 123456789,
    code: 12345,
  })
  .then((r) => {
    var _transaction = notchpay
      .transaction()
      .completeWithWindow(r.data.authorization_url, r.data.transaction);

    var watcher = setInterval(() => {
      console.log(_transaction);
      if (_transaction.status != null && _transaction.status != "pending") {
        clearInterval(watcher);

        // your code here
        /*switch (transaction.status) {

        }*/
      }
    }, 2000);
  })
  .catch((e) => {
    console.log("error", e);
  });

Keywords

FAQs

Package last updated on 12 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc