Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

公众号支付取回的值为undefined #43

Open
Shakell opened this issue Jul 10, 2018 · 0 comments
Open

公众号支付取回的值为undefined #43

Shakell opened this issue Jul 10, 2018 · 0 comments

Comments

@Shakell
Copy link

Shakell commented Jul 10, 2018

想要达到的效果:
想在后端拿到用于前端调起微信内支付(公众号支付)的相关参数

目前的效果:
取回的信息为中不正确,包含undefined,没有相关错误提示

使用接口的代码为:

router.get('/wexin/jsapi/:data', async function(req,res,next) {
	try {
                //我先在这里通过一些操作取到openid
		const data = JSON.parse(req.params.data);
		wxpay.getBrandWCPayRequestParams({
			openid: openid,
			body: '公众号支付测试',
		        detail: '公众号支付测试',
			out_trade_no: data.orderId,
			total_fee: data.total_fee,
			spbill_create_ip: '192.168.2.210',
			notify_url: 'https://47.75.40.253/wechat/callback',
		}, function(err, result){
			console.log(result);
		});
	} catch (e) {
		console.log(e);
	}
})

得到的结果:

{ appId: 'wxbbbe3315cf3d4d71',
  timeStamp: '1531245546',
  nonceStr: undefined,
  package: 'prepay_id=undefined',
  signType: 'MD5',
  paySign: 'D3FA8F7B5D32C50E9863CFF0D71809FA' }

其中nonceStr为undefined,prepay_id应该是未正确生成。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant