fastpay

FastPay for Node.js

Usage no npm install needed!

<script type="module">
  import fastpay from 'https://cdn.skypack.dev/fastpay';
</script>

README

node-fastpay

NPM version Build Status Dependency Status Coverage Status

FastPay for Node.js.

Getting started

Install via npm.

$ npm install fastpay

All functions of fastpay object passes the data via callbacks. Callbacks has the error and response data via the request module.

var fastpay = require("fastpay");

fastpay("YOUR_API_KEY", function (err, res, body) {
    if (!err && res.statusCode === 200) {
        console.log(body);
    }
});

Create a charge

fastpay("YOUR_API_KEY").create({
    amount: 1000,
    card: "YOUR_CARD_ID"
}, function (err, res, body) {
    if (!err && res.statusCode === 200) {
        console.log(body);
    }
});

Retrieve a charge

fastpay("YOUR_API_KEY").retrieve("YOUR_CHARGE_ID", function (err, res, body) {
    if (!err && res.statusCode === 200) {
        console.log(body);
    }
});

Refund a charge

fastpay("YOUR_API_KEY").refund("YOUR_CHARGE_ID", function (err, res, body) {
    if (!err && res.statusCode === 200) {
        console.log(body);
    }
});

Capture a charge

fastpay("YOUR_API_KEY").capture("YOUR_CHARGE_ID", function (err, res, body) {
    if (!err && res.statusCode === 200) {
        console.log(body);
    }
});

Retrieve all charge

fastpay("YOUR_API_KEY").all({
    count: 1
}, function (err, res, body) {
    if (!err && res.statusCode === 200) {
        console.log(body);
    }
});

More details to use FastPay

All the stuff in FastPay official documents.

Testing

npm test runs liting and testing scripts.

$ npm install
$ npm test

Finally the code coverage report will be generated.

Contributing

See the CONTRIBUTING.md.

Author

Ryuichi Okumura

License

This module is available under the BSD license.

The request module is available under the Apache License 2.0.