1.0.2 • Published 6 years ago

easypay v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Node.js Alipay SDK

Requirements

Node.js v7+

API Interface

  • Web Payment
ParameterTypeUsage
amountStringTransaction amount (formatted "0.01")
nameStringProduct Name
descriptionStringProduct Description
return_urlStringReturn URL
notify_urlStringAlipay official callback API
out_trade_noStringMerchant-side identifier
  • Refund
ParameterTypeUsage
refund_amountStringRefund amount (formatted "0.01")
trade_noStringEither fill in trade_no or out_trade_no to make it work
out_trade_noStringUse merchant-side identifier to signal a refund

Example

  • Web Payment
var fs = require('fs');
var alipay = require('./lib')

var Alipay = new alipay({
  privateKey: fs.readFileSync('./app_private_key.pem'),
  publicKey: fs.readFileSync('./app_public_key.pem'),
  app_id: 'your_app_id'
})

console.log(Alipay.webPayment({
  amount: "0.01",
  name: 'iPhone X'
}))
  • Refund
var fs = require('fs');
var alipay = require('./lib')

var Alipay = new alipay({
  privateKey: fs.readFileSync('./app_private_key.pem'),
  publicKey: fs.readFileSync('./app_public_key.pem'),
  app_id: 'your_app_id'
})

Alipay.refund({
  refund_amount: '1.00',
  trade_no: 'your_trade_no'
}).then((body) => {
  console.log(body);
}).catch((err) => {
  console.log('ERR: ' + err);
});
1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago