1.0.3 • Published 4 years ago

nodejs-payment v1.0.3

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
4 years ago

nodejs-payment

payment nodejs library

Install

> npm install nodejs-payment --save-dev

Usage

app.js

// app.js
const config = require('./config.js');
const Payment = require('nodejs-payment');
let type = "wepay"; // or "alipay"
let client_ip = "127.0.0.1";
let order_id = Date.now();
let title = "payment test";
let amount = 1;
// create payment url
new Payment(config).webPay(type, order_id, title, amount, client_ip).then(url => {
    // open this url go pay
});

config.js

// config.js
'use strict';

module.exports = {
    alipay: {
        sandbox: false,
        appId: "--appId--",
        publicKey: "--publicKey--",
        privateKey: "--privateKey--",
        notifyUrl: "--notifyUrl--",
        returnUrl: "--returnUrl--",
        signType: "RSA2"
    },
    wepay: {
        mchId: "--mchId--",
        appId: "--appId--",
        appKey: "--appKey--",
        notifyUrl: "--notifyUrl--",
        redirectUrl: "--redirectUrl--",
        certPem: "--publicKey--",
        keyPem: "--privateKey--"
    }
}

Features

ApiStatus
webPay(out_trade_id, title, amount, client_ip)
queryPay(trade_id)
transfers(trans_trade_id, account, realname, title, amount, client_ip)
queryTransfers(trans_trade_id)

Docs

wepay docs

alipay docs

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago