NutzCN Logo
问答 pay_unifiedorder返回报{return_code=FAIL, return_msg=签名错误} 麻烦帮看看什么问题?
发布于 1929天前 作者 qq_6d75074b 4936 次浏览 复制 上一个帖子 下一个帖子
标签:
		function payvip(){
			var wxPayUnifiedOrder = new Object();
			wxPayUnifiedOrder.appid="wx6417e8cac9cea6cd";
		    wxPayUnifiedOrder.mch_id="1555402701";
		    wxPayUnifiedOrder.device_info="WEB";
		    wxPayUnifiedOrder.nonce_str="4694ef076bb84664b4b08af20978e0d5";
		    wxPayUnifiedOrder.sign="";
		    wxPayUnifiedOrder.sign_type="MD5";
		    wxPayUnifiedOrder.body="小精灵孕妇学校VIP开通!";
		    wxPayUnifiedOrder.detail='<![CDATA[{"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"01","wxpay_goods_id":"1001","goods_name":"vip充值","quantity":1,"price":1}]}]]>';
		    wxPayUnifiedOrder.attach="test";
		    wxPayUnifiedOrder.out_trade_no="test0001";
		    wxPayUnifiedOrder.fee_type="CNY";
		    wxPayUnifiedOrder.total_fee="1";
		    wxPayUnifiedOrder.spbill_create_ip="111.121.12.90";
		    wxPayUnifiedOrder.time_start="20190911091010";
		    wxPayUnifiedOrder.time_expire="20191227091010";
		    wxPayUnifiedOrder.goods_tag="test01";
		    wxPayUnifiedOrder.notify_url=https+"wxpatient/wxpay";
		    wxPayUnifiedOrder.openid=patient.openid;
		    wxPayUnifiedOrder.trade_type="JSAPI";
			
		    //调用支付接口
			ajaxcall.call("../../wxpatient/pay_jsapi",{key:"1145ede3bce148b88fd319232412f608",wxPayUnifiedOrder:wxPayUnifiedOrder},function(data){
				alert(JSON.stringify(data));
			});		    

		}

4 回复

appid=wx6417e8cac9cea6bd&attach=test&body=小精灵孕妇学校VIP开通!&detail={"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"01","wxpay_goods_id":"1001","goods_name":"vip充值","quantity":1,"price":1}]}&device_info=WEB&fee_type=CNY&goods_tag=test01&mch_id=1555402601&nonce_str=qetZzOfkF8LhDUQoccPyq1&notify_url=https://24736g26e1.zicp.vip/bmpt/wxpatient/wxpay&openid=on3VH54Wqomepy7HxDJS02rsUn8k&out_trade_no=test0001&sign_type=MD5&spbill_create_ip=111.121.12.90&time_expire=20190912091010&time_start=20190911011010&total_fee=1&trade_type=JSAPI

微信支付接口签名校验工具 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=20_1
生成的sign不一致,请问什么原因?

#1.对参数按照key=value的格式,并按照参数名ASCII字典序排序生成字符串:
appid=wx6417e8cac9cea6bd&attach=test&body=小精灵孕妇学校VIP开通!&detail={"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"01","wxpay_goods_id":"1001","goods_name":"vip充值","quantity":1,"price":1}]}&device_info=WEB&fee_type=CNY&goods_tag=test01&mch_id=1555402601&nonce_str=qetZzOfkF8LhDUQoccPyq1&notify_url=https://24736g26e1.zicp.vip/bmpt/wxpatient/wxpay&openid=on3VH54Wqomepy7HxDJS02rsUn8k&out_trade_no=test0001&sign_type=MD5&spbill_create_ip=111.121.12.90&time_expire=20190912091010&time_start=20190911011010&total_fee=1&trade_type=JSAPI

#2.连接商户key:
appid=wx6417e8cac9cea6bd&attach=test&body=小精灵孕妇学校VIP开通!&detail={"cost_price":1,"receipt_id":"wx123","goods_detail":[{"goods_id":"01","wxpay_goods_id":"1001","goods_name":"vip充值","quantity":1,"price":1}]}&device_info=WEB&fee_type=CNY&goods_tag=test01&mch_id=1555402601&nonce_str=qetZzOfkF8LhDUQoccPyq1&notify_url=https://24736g26e1.zicp.vip/bmpt/wxpatient/wxpay&openid=on3VH54Wqomepy7HxDJS02rsUn8k&out_trade_no=test0001&sign_type=MD5&spbill_create_ip=111.121.12.90&time_expire=20190912091010&time_start=20190911011010&total_fee=1&trade_type=JSAPI&key=00c2ede3bce148b88fd319e6e412f608

#3.生成sign并转成大写:
sign=4C0C7573E84319C48FF062B7B043CC93

#4.校验结果:
原sign值:39D41D498F6BF241DDE3D43054BCCB16
新sign值:4C0C7573E84319C48FF062B7B043CC93

谢谢,先研究一下

添加回复
请先登陆
回到顶部