使用PHP版的SDK,没处理好,发现有个test/TestImage.php的测试文件,开始改,发现状态码$request -> getCode()一直为0,一路调试上去,发现是getContents函数里curl错误!输出curl_errno($ch),SSL certificate problem: unable to get local issuer certificate 使用解决方法是证书问题。
错误代码 invalid-method 错误原因: 不存在的方法名 一直未解决,可能是$request应该是文档中的AlipayCommerceCityfacilitatorVoucherGenerateRequest类实例还是测试文件中的$alipayClient -> getContents() 返回值(AlipayMobilePublicMultiMediaExecute实例)还有Warning: openssl_sign(): supplied key param cannot be coerced into a private key in... 好多问题,又回头看API发现页面API下有示例代码,哟吼吼吼。
配置好之后有错误{"code":"40006","msg":"Insufficient Permissions","sub_code":"isv.insufficient-isv-permissions","sub_msg":"ISV权限不足"}
换了沙箱账号,提醒另外一个错误{"code":"40004","msg":"Business Failed","sub_code":"unknown-sub-code","sub_msg":"未知的错误码"},但都是验签函数checkResponseSign()内出错。
object(SignData)[5] public 'signSourceData' => string '{"code":"40004","msg":"Business Failed","sub_code":"unknown-sub-code","sub_msg":"未知的错误码"}' (length=101) public 'sign' => string 'EfXcLt1HDYQFHnfJRy31/S9+AeCd7J4jw/Zrphi2ImHgCIBGIbyZ8+Ch2yoiGeKN/tqdTPSEOosEI9QF1Nx53fHKHZG1SkrodwVzSSdkVPM9pxCszCn4u0ktTi925BazTFfNoq****JTHflEJ91GOhX19sbFYSnvD6RWus4YeFo=' (length=172)
追溯curl函数,url=https://openapi.alipaydev.com/gateway.do?app_id=2016091000478468&version=1.0&format=json&sign_type=RSA&method=alipay.commerce.cityfacilitator.station.query×tamp=2016-10-27+08%3A31%3A05&auth_token=&alipay_sdk=alipay-sdk-php-20160411&terminal_type=&terminal_info=&prod_code=¬ify_url=&charset=UTF-8&app_auth_token=&sign=T2xEACiz6ET%2FHs5DWdBZqrQQlB8nB8iw4%2F4VlEtqG6qVePjEop9IgLpgLt%2BOtDCJgbWYA%2FIlzyHXBRs9D1JYfT1wUHzYoXXATcXNm0rssfFLB********xdLHMn4DCF%2B4QQLLeZrBVV2nj7Kxo1Zz1zv5ElS%2FLialsFA%3D
上面加重的【×tamp=】很疑惑啊,×怎么可以在里面,前面应该query就结束了然后应该是时间参数×tamp这个啊,改成×tamp=就至少可以返回了而不是这个错误:错误代码 invalid-method 错误原因: 不存在的方法名 了。看看哪里构造url出错的。
array (size=15) 'app_id' => string '2016091000478468' (length=16) 'version' => string '1.0' (length=3) 'format' => string 'json' (length=4) 'sign_type' => string 'RSA' (length=3) 'method' => string 'alipay.commerce.cityfacilitator.station.query' (length=45) 'timestamp' => string '2016-10-27 08:48:32' (length=19) 'auth_token' => null 'alipay_sdk' => string 'alipay-sdk-php-20160411' (length=23) 'terminal_type' => null 'terminal_info' => null 'prod_code' => null 'notify_url' => null 'charset' => string 'UTF-8' (length=5) 'app_auth_token' => null 'sign' => string 'f6ufUiSHCb7LNaXJvTdPEdDzfxKgepILJiKaM3wqueGojpOTZrVFRhVFqAQAxCEze9bVX77fpS/bvT8IVoD+/DMikZrje8SqkrSQvIHG8r1VhucgWplpgJU7HzViE*****************/MoG5OqfPf+H+rU+Eui7+bfYXtTDY=' (length=172)
可以看出来确实应该是timestamp,×的html转义字符就是×,所以 echo "×tamp=";会输出×tamp这种幺蛾子。
<span style="font-size: 15px">foreach ($sysParams as $sysParamKey => $sysParamValue) { $requestUrl .= "$sysParamKey=" . urlencode($this->characet($sysParamValue, $this->postCharset)) . "&<span style="color: #ff00ff">amp;</span>"; }</span>
&改为&好激动。
然而,页面什么也没有,错误也没有,空白,空。继续调
https://support.open.alipay.com/support/myQuestionDetail.htm?id=266419 没头绪提了问题回答也没头绪。
10/28
昨天遇到的参数问题,我把timestamp提到了最前面,发现时间参数还差了6个小时,不说了直接time()+6*3600。然后[签名无效]。求助~