返回结果:
<xml><return_code><![CDATA[ERROR]]></return_code>
<return_msg><![CDATA[无效的RawData数据]]></return_msg>
<nonce_str><![CDATA[5lrdujrJmNf4igr4HyAxgnou2W2b0YwA]]></nonce_str>
<sign><![CDATA[083013700CBAAEF96057965AB7EBFF36]]></sign>
</xml>
1、确定使用的rawdata与getWxpayfaceRawdata()返回的rawdata数据一致;
2、时间now参数与当前时间一致;
请求RequestBody:
val body = RequestBody.create(MediaType.parse("application/xml"), reqStr)
reqStr数据内容如下:
<xml>
<appid>......</appid>
<device_id>LTA0P18937F130532000001</device_id>
<mch_id>......</mch_id>
<nonce_str>V37ZHZVf2OrwsUV7kXTjTguP74c0byvE</nonce_str>
<now>1604577508</now>
<rawdata>0OkagdJBd6U9MKXwAl2KxLwaIq4zdinYxadhJp4/6gfuQaWCgWYJzYGoBitog7WkxAtpAFk9J4HTvf9a814M+ows5zI6LBwaq3RVVoNO4FsgQVaYFjaNhW0eEuCwsQbzm9DikCQZFR+pR7kY9FVtobO+KsTbjcpF1/pkne8YKa4fR/Y/SZMFbW/TwD+iwEPyQdQZo7mzHQCa53IZRrzpeVyGSKpDUK71wyMRV4WvnVzrpqOE2vqQq/RaqE2oiNA2pDcrTGK1F+JZ/BN2hTo2RkTCAU3V/XWiQwf6GV+X3zKNTrnsTQidSkb3c9IEIwZb5b529jd2Deb957iwiRaaQYRGPPV/mr16pWkGiHoVxbsloNv5aC8ahtktGK/h50Rz569Yii0XJT0V0/rKaLAMUbPyxQp8Sfc7gOVySXV3wC+xOY7My7KqWkXJJIzw38/fdUUB+yBHMf2Hpj4XtJAR6UVsfHIokU7+cSOWHl2VJEOmVo6khjXEEonaBwxduHLq+xMcla8DRqdmo7+VT3zEdvELiWbJVPJM/Cbw/MUvc4F6IU/hzWSyCWyPqPwHKi3LwcQ82Aj9WmyEWG1ZErbID9CwXIGc0lmVdM8LmONpbiqBXrGpPEs7dwSlkERYVHaepcA1trLjZKv0CG57g4rURBoqmjIwejEAipTmSWT266XozmEfW7uJ22vMmb3UBosKhhhsC9n3LCYy6p7uiaGBi2QEVsEvOyjiRULv3oDhPImOEckj2ra3zR1JAltoOHkYQ3eGt+t/SiiKT3J6LphV0vNyt1CwmAmYCoHo+PTwwYrYLlkYNjxngsViZkkzJwtZ1UXCZFYTxPTlRKWlvw==</rawdata>
<sign>4E1B9DBE3DDA0C6ABF4E1265F95F98DE</sign>
<sign_type>MD5</sign_type>
<version>1</version>
</xml>
根据开发者们的答复,你遇到的问题,解决方案总结提炼如下:
您的调用接口地址不正确,请使用正确的接口地址:
https://payapp.weixin.qq.com/face/get_wxpayface_authinfo。
请确保您使用的rawdata与getWxpayfaceRawdata()返回的rawdata数据一致,时间now参数与当前时间一致。
发现问题了,是调用的接口地址不正确,使用的演示demo的地址,和平台sdk文档中的地址不一样。
Demp源代码中的地址:
https://wxpay.wxutil.com/wxfacepay/api/getWxpayFaceAuthInfo.php
平台sdk文档地址:
https://payapp.weixin.qq.com/face/get_wxpayface_authinfo