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

alipay.exceptions.AliPayValidationError #21

Closed
sanfenshi opened this issue Aug 19, 2017 · 2 comments
Closed

alipay.exceptions.AliPayValidationError #21

sanfenshi opened this issue Aug 19, 2017 · 2 comments

Comments

@sanfenshi
Copy link

sanfenshi commented Aug 19, 2017

`from alipay import AliPay
import qrcode # 导入模块
import time

out_trade_no = 'eb0d16e5-38d9-4fc4-ba6b-59787532eba1'

alipay = AliPay(
appid='2017071207730100',
app_notify_url='http://www.example.io/pay/alipay/verify',
app_private_key_path='../rsa_private_key.pem',
alipay_public_key_path='../rsa_public_key.pem',
sign_type="RSA", # RSA or RSA2
)

create an order

result = alipay.api_alipay_trade_precreate(
subject='vip1month',
out_trade_no=out_trade_no,
total_amount=0.01
)`
返回内容:
{"code":"10000","msg":"Success","out_trade_no":"eb0d16e5-38d9-4fc4-ba6b-59787532eba1","qr_code":"https://qr.alipay.com/bax04455bp1jlvn7mx0h60ea"}
返回sign:
OTpTRfQ6ChZsjo/5gbMHJpF2p/2C6UHuZVYNG13yOityCpCZOIDCrLEKYwOIQFJsFuEhLxEX7RQLD1c7mfPEKC63GD4WYKuSMeZVkX7QLTb0UdU8XNtsIbt5Hqti4OD4jcVDJ4IyzgcycxtYDZfk232xvrqgs9z1tHUchhNF8Mw=
看上去创建qr_code成功了,但是_verify_and_return_sync_response的时候所签名不对
签名功能我用支付宝提供的接口验证是正确的,这会是什么问题尼?
环境:Python3.6.1 windows10

@fzlee
Copy link
Owner

fzlee commented Aug 19, 2017

我看到你导入的公钥是这样的: alipay_public_key_path='../rsa_public_key.pem', 你似乎传入了自己的公钥, 而不是支付宝的。

@fzlee fzlee closed this as completed Aug 19, 2017
@sanfenshi
Copy link
Author

对对,确实是这个问题。我用错了

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

2 participants