根据https://github.com/supersheep/wechat-pay 上的样列
var order = { body: '吮指原味鸡 * 1’, attach: '{"部位":"三角"}’, out_trade_no: ‘kfc’ + (+new Date), total_fee: 10 * 100, spbill_create_ip: req.ip, openid: req.user.openid, trade_type: ‘JSAPI’ }; payment.getBrandWCPayRequestParams(order, function(err, payargs){ res.json(payargs); });
我的 代码
var order = { body: activity.name + ‘活动’ + activityApplySave.package_remark + ' * ' + activityApplySave.num, attach: ‘{"’ + activity.name + ‘":"’ + activityApplySave.package_remark + '"}’, out_trade_no: ‘cfun’ + (+new Date), total_fee: activityApplySave.value, spbill_create_ip: req.ip, openid: user.openid, trade_type: ‘JSAPI’ }; logger.info('进入activityApplySave APPID = ' + config.wechat_opts.appId + ',mch_id = ' + config.wechat_opts.mchId + ' , req.ip = ' + req.ip); payment.getBrandWCPayRequestParams(order, function(err, payargs){ if(err){ logger.info('进入getBrandWCPayRequestParams err = ' + err); return res.json({localError: err, localErrorCode: '444’}); } logger.info('进入getBrandWCPayRequestParams = ' + payargs); res.json(payargs); });
但是无聊是在 测试环境 还是 放到真实的服务号上 依然是报这个 ProtocolError: invalid spbill_create_ip 错误 访问的路径是 域名/api/wechat/pay 请告诉我 这个spbill_create_ip 该怎么传