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

flutterwave

v2.2.8

Published

A nodejs library for the Flutterwave API

Downloads

703

Readme

Flutterwave Nodejs API Library v1.0.0

Flutterwave Services exposed by the library

  • Account Payment
  • BIN Check
  • BVN Check
  • Card Charge
  • Disbursement
  • IP Check
  • List of banks and financial institutions

For more information on the services listed above, visit the Flutterwave DEV website

How to use

npm install flutterwave

You can get your MERCHANT_KEY and API_KEY from the dev dashboard. Go here if you don't have an account.

var Flutterwave = require('flutterwave');

var flutterwave = new Flutterwave(API_KEY, MERCHANT_KEY, BASE_URL_OR_PRODUCTION_FLAG);

If you pass true as the value for BASE_URL_OR_PRODUCTION_FLAG, the library will use the production url as the base for all calls. Otherwise it will use any url value you pass as the base. If nothing is passed, the default staging url will be use when making the calls.

var flutterwave = new Flutterwave('tk_ueiruriruriruriru', 'tk_tueheue'); //Base url is http://staging1flutterwave.co:8080/pwc/rest

var flutterwave = new Flutterwave('tk_ueiruriruriruriru', 'tk_tueheue', true); //Base url is https://prod1flutterwave.co:8181/pwc/rest

var flutterwave = new Flutterwave('tk_ueiruriruriruriru', 'tk_tueheue', "https://someotherurl"); //Base url is https://someotherurl
/*
To call a flutterwave class (Code-name for API endpoint group) do :
flutterwave.Class.method(param1..paramn, callback);
*/

flutterwave.IP.check('127.0.0.1', function(error, response, body){
	//do stuff with response
})

Callbacks and handling API response

The callback (usually the last argument passed to any of the method calls) takes three parameters:

{
	"status" : "success|error",
	"data" : "OBJECT | error message"
}

Note that calls to the flutterwave API sometimes return with a successful status even when the request failed. Please check the returned data object and see the responseCode property. Values 0, 00, 02 indicate your request was successful. Any other value indicates failure, check the responseMessage to get the failure reason. While a responseCode of 02 indicates a successful request, it also means you need to make a subsequent validation call using information returned from the previous request. To make things a tad simpler, the response object has been mutated to include two boolean properties:

  • response.flutterwaveRequestSuccessful - If true, means the request was 'truly' successful

  • response.flutterwaveRequestRequiresValidation - Usually true when the responseCode is 02

As a rule of thumb, always put your flutterwave calls in a try block. The library throws errors whenever:

  • Required params are not passed
  • Values are empty
  • Values are not in the expected format See the example directory for more usage information

Response codes

00  Successful
02  Needs card Validation
RR  Transaction Failed. Detailed Message is included in response message
7   Card Declined due to invalid card data
RR-T2   
XS0 Authorization Failed due to connectivity issues with the bank
B02 Invalid BVN
RR-51   Insufficient Funds
RR-R3   CardToken is mandatory!
RR-14   Invalid Card Number
RR-55   Incorrect PIN
R0  Transaction Failed due to connectivity issues with the bank
RR-E42  Card Declined due to invalid card expiry
RR-56   No Card Record
RR-2    Card Declined
RR-X04  Transaction Amount too low
RR-15   Transaction error
RR-7    Card Declined due to invalid card security code
RR-57   Transaction not Permitted to Cardholder
RR-04   Pick-up card
RR-Z8   Payment Gateway currently does not accept your card type
RR-91   Bank or switch network error
EEE An unexpected error occurred!
RR-E18  The service provider is unreachable at the moment, please try again later.
RR-E19  An invalid response was received from remote host, see provider response code/message for details.
RR-E19  An invalid response was received from remote host, please contact system administrator.
RR-E32  JSON is badly formatted or it contains invalid character.
RR-E42  Expiry Date cannot be empty
RR-E57  The PIN contains an invalid character
RR-EE4  Card Details could not be Retrieved!