request请求携带证书,如:微信企业零钱付款

const Promise = require('bluebird')

const request = Promise.promisifyAll(require('request'))

const wxTransferResult = await request.postAsync({
url: 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers',
body:{user:'aaaaaa'} ,
agentOptions: {
      cert: fse.readFileSync(path.join(__dirname, '../wx_cert.pem')).toString(), 
      key: fse.readFileSync(path.join(__dirname, '../wx_key.pem')).toString()
   }
})

详情参考:https://www.npmjs.com/package/request

猜你喜欢

转载自www.cnblogs.com/qiyc/p/10100919.html