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

签名无效 #2

Closed
pengaman opened this issue Jan 9, 2017 · 5 comments
Closed

签名无效 #2

pengaman opened this issue Jan 9, 2017 · 5 comments
Assignees

Comments

@pengaman
Copy link

pengaman commented Jan 9, 2017

错误代码 invalid-signature 错误原因: 无效签名(我使用沙箱),已验证过,私钥签名的字符串公钥可以解密

@fzlee
Copy link
Owner

fzlee commented Jan 10, 2017

我没有使用过沙箱环境,不知道是不是因为这个导致的。如果私钥签名公钥可以验证通过的话,至少可以证明签名是正确的。

可否提供一些详细的信息,比如

  1. Python的版本
  2. 你是怎么调用这个接口的,比如具体的,可以重现这个错误的代码。
  3. tests目录下有一些私钥,你可以使用其中的一个私钥对待加密字符串签名,并将结果粘贴上来。我可以帮忙检查检查检查问题

@fzlee fzlee self-assigned this Jan 10, 2017
@pengaman
Copy link
Author

当请求index时:

def test(request):
	alipay = AliPay(
	      app_notify_url='http://www.chanvr.com/demo',
	      appid="2016073000126542",
	      app_private_key_path="rsa_private_key.pem",
	      app_alipay_public_key_path="rsa_public_key.pem"
	)
	order_string = alipay.create_wap_trade(out_trade_no="20161112", total_amount="0.01", subject="测试订单", return_url="")
	print(order_string)
	return render_to_response("index.html",{'order_string':order_string})

index(一个button):

<body>
	<form method="post" action="https://openapi.alipaydev.com/gateway.do?{{order_string}}" >
		<input type="submit" name="button" value="ok">
	</form>	
</body>

@pengaman
Copy link
Author

pyhton 版本2.7
django 版本1.10

@fzlee
Copy link
Owner

fzlee commented Jan 10, 2017

我刚才测试了一下,可能是因为return_url = "" 导致的。你可以这样试试

order_string = alipay.create_wap_trade(out_trade_no="20161112", total_amount="0.01", subject="测试订单", return_url="http://www.chanvr.com/demo")

@fzlee
Copy link
Owner

fzlee commented Jan 12, 2017

问题原因有可能是POST 表单给支付宝的时候,将form里面的button一起POST 到支付宝了,和这个库无关。

@fzlee fzlee closed this as completed Jan 12, 2017
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