lib 文件夹下是 Node.js SDK 文件,
example 文件夹里面是一个简单的接入示例,该示例仅供参考。
nodejs 版本 v0.10.0 及以上
npm install paymax
var Paymax=require('paymax');
//Paymax提供给商户的SecretKey,登录网站后查看
Paymax.conf.setSecretKey('55970fdbbf10459f966a8e276afa86fa');
//Paymax提供给商户的公钥,登录网站后查看(参考样例,严格按照pem格式保存)
Paymax.conf.setPaymaxPublicKeyPath('paymax_rsa_public_key.pem');
//商户自己的私钥【公钥通过Paymax网站上传到Paymax,私钥pem文件路径设置到下面的变量中】
Paymax.conf.setPrivateKeyPath('rsa_private_key.pem');
Paymax.charge.createCharge(
{
amount: '0.01',
subject: 'test_subject',
body: 'this is a body',
order_no: generateRandomAlphaNum(20),
channel: 'alipay_app',
client_ip: '127.0.0.1',
app: 'app_7hqF2S6GYXET457i',
currency: 'cny',
extra: {},
description: 'this is a description',
}, getResult
)
Paymax.charge.queryCharge('ch_fbe2d2675043004b02303b6a',getResult);
Paymax.refund.createRefund(
'ch_a59123a1538074f3cfa6568b',
{
'amount':'0.01',
'description':'this is a description',
'extra':{}
},
getResult
);
Paymax.refund.queryRefund(
{
'chargeNo':'ch_a59123a1538074f3cfa6568b',
'refundNo':'re_d6586ff6e077b95985344538'
}
,getResult
);
Paymax.face.queryFaceAuth('123',getResult);