项目作者: scala-network

项目描述 :
ScalaPay Merchant Endpoint NPM Module
高级语言: JavaScript
项目地址: git://github.com/scala-network/ScalaPay-Merchant-NPM.git
创建时间: 2019-08-10T15:19:56Z
项目社区:https://github.com/scala-network/ScalaPay-Merchant-NPM

开源协议:MIT License

下载


ScalaPay Merchant NPM

NPM Version

Table of Contents

Install

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 0.6 or higher is required.

Installation is done using the npm install command:

  1. $ npm i scalapay

Introduction

This is a node.js wrapper for the scalapay merchant API. It is written in JavaScript, does not
require compiling, and is 100% MIT licensed.

Here is an example on how to use it:

  1. var scalapay = require('scalapay');
  2. var scala = scalapay.login({
  3. token : 'MERCHANT_TOKEN'
  4. });
  5. scala.testAccess(function(error, result) {
  6. if(error){
  7. console.log(error);
  8. else
  9. console.log(result);
  10. });

Recommendation

Create a config file named /config/ScalaAPI.js

  1. var scalapay = require('scalapay');
  2. var Scala = scalapay.login({
  3. token: "MERCHANT_TOKEN"
  4. });
  5. module.exports = Scala;

now you can use it in your other js files

  1. const scala = require('./config/ScalaAPI');
  2. scala.testAccess(function(error, result) {
  3. if(error)
  4. console.log(error);
  5. else
  6. console.log(result);
  7. });
  8. scala.generateAddress(function(error, result) {
  9. if(error)
  10. console.log(error);
  11. else
  12. console.log(result);
  13. });
  14. scala.transfer("philip119@gmx.de","1337", function(error, result) {
  15. if(error)
  16. console.log(error);
  17. else
  18. console.log(result);
  19. });