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

brillantpay

v0.1.15

Published

BrillantPay Payments API library NodeJS

Downloads

23

Readme

BrillantPay Node.js Library

Version Build Status Downloads

The BrillantPay Node library provides convenient access to the BrillantPay API from applications written in server-side JavaScript.

Please keep in mind that this package is for use with server-side Node that uses BrillantPay keys. To maintain compliance and offer ideal user experience, always call [brillantpay.js] in all integrations or [checkout.js] in the script src attribute of the form when using BrillantPay Checkout.

Documentation

See the Node API documentation.

Installation

Install the package with:

npm install brillantpay --save

Usage

The package needs to be configured with your account's publishable and secret keys which are available in your BrillantPay Dashboard. Require it with the Secret Key value:

const brillantpay = require("brillantpay");

const transaction = new brillantpay.BrillantPay('sk_test_...');

Creating a payment

Create a payment data object and fill it with the form data returned then create the actual payment:

// Create a new payment:
this.data = {
     "confirmation": "HJVHGFT65675",
     "account": 424324324,
     "bp_token": 'bp_tok_2367tdygywttwetfef'
     "currency": "KES",
     "amount": 500,
     "description": "Chiffon dress",
     "option": "MOBILEMONEY",
     "service": "MPESA",
     "email": "[email protected]",
     "phone": 254718287827
};

transaction.payments(this.data.confirmation,
     this.data.account,
     this.data.bp_token,
     this.data.currency,
     this.data.amount,
     this.data.description,
     this.data.option,
     this.data.service,
     this.data.email,
     this.data.phone, function(err, response) {
         if (err) {
             // Deal with an error
         }
         // A new payment created. Do something
     });

Configuring Timeout

Request timeout is configurable (the default is Node's default of 120 seconds):

transaction.setTimeout(30000); // in ms (this is 30 seconds)

Writing a Plugin

If you're writing a plugin that uses the library, we'd appreciate it if you identified using brillantpay.setAppInfo():

brillantpay.setAppInfo({
  name: 'MyAwesomePlugin',
  version: '1.2.34', // Optional
  url: 'https://myawesomeplugin.info', // Optional
});

This information is passed along when the library makes calls to the BrillantPay API.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-awesome-feature)
  3. Commit your changes (git commit -am 'Add some awesome feature')
  4. Push to the branch (git push origin my-awesome-feature)

Development

Run all tests:

$ npm install
$ npm test

Run a single test suite:

$ npm run mocha -- test/resources/payment.spec.js

License

Released under the MIT licence.

Copyright (c) Brillant Innovations Ltd