-
Notifications
You must be signed in to change notification settings - Fork 379
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
无语的错误 #47
Comments
out_trade_no是整数而不是字符串? |
都试过,你注意看一下debug |
开启debug报错的原因是你传的支付宝公钥错了,应该用沙盒的支付宝公钥。 |
你编辑一下这个包的源代码,在api_alipay_trade_precreate函数的448行左右 print(data),看看你传了什么参数给支付宝吧。 |
没太明白,支付宝公钥是从蚂蚁金服网站我创建的应用下边上传应用私钥获取到的,为什么不用这个而使用沙盒的支付宝公钥呢?(沙盒没用过) |
那我明天调试一下你说的448行,非常感谢你的SDK奉献! |
debug=True之后,请求会被发送到支付宝的沙盒环境,沙盒环境的公钥和生产环境的公钥是不一样的。 如果想在线上调试,想你这样设置支付额度为1分钱就可以了,不需要传入debug |
@fzlee 如果在SDK中把需要为字符串的参数都str()一下,debug=True时打印warning提示要使用沙箱公钥是不是会好一点。。。 |
发现错误了,我的subject后面加了个逗号让它变成元组了。。 |
转换用户参数这件事情, 我应该不太会去做。关于参数的类型,用户应该去仔细看看支付宝文档了。 debug=True的提示我会在下一个版本加入。 |
subject = "话费余额充值",
out_trade_no =int(time.time())
total_amount = 0.01
#print(out_trade_no)
# create an order
result = alipay.api_alipay_trade_precreate(
subject=subject,
out_trade_no=out_trade_no,
total_amount=total_amount)
print('返回值:',result)
#输出
返回值: {'code': '40004', 'msg': 'Business Failed', 'sub_code': 'ACQ.INVALID_PARAMETER', 'sub_msg': '参数无效'}
#开启debug
File "C:\Users\ELI\Envs\py3_env\lib\site-packages\python_alipay_sdk-1.7.1-py3.6.egg\alipay_init_.py", line 451, in api_alipay_trade_precreate
File "C:\Users\ELI\Envs\py3_env\lib\site-packages\python_alipay_sdk-1.7.1-py3.6.egg\alipay_init_.py", line 517, in _verify_and_return_sync_response
KeyError: 'sign'
请问哪里错了?
The text was updated successfully, but these errors were encountered: