Comments (11)
@fzlee 按您说的试改过来了,还是不行~
from alipay.
这是我的配置
# -*- coding: utf-8 -*-
from alipay import AliPay
from alipay import ISVAlipay
app_private_key_string = open("key/app_private_key.pem").read()
alipay_public_key_string = open("key/alipay_public_key.pem").read()
alipay = AliPay(
appid="2018062460380864",
app_notify_url=" http://www.getsms.club/", # 默认回调url
app_private_key_string=app_private_key_string,
alipay_public_key_string=alipay_public_key_string, # 支付宝的公钥,验证支付宝回传消息使用,不是你自己的公钥,
sign_type="RSA2", # RSA 或者 RSA2
debug=False # 默认False
)
# If you don't know what ISV is, then forget about what I mentioned below
# either app_auth_code or app_auth_token should not be None
# 手机网站支付,需要跳转到https://openapi.alipay.com/gateway.do? + order_string
order_string = alipay.api_alipay_trade_wap_pay(
out_trade_no="20161112",
total_amount=0.01,
subject="subject",
return_url="",
notify_url="" # 可选, 不填则使用默认notify url
)
url = 'https://openapi.alipay.com/gateway.do?' + order_string
print url
from alipay.
搜了下&好像就是&
私钥公钥都是按教程生产的,公钥也放到支付宝后台了,后台上验证私钥公钥是配对的。appid也是对应的。不知道为什么一直说签名错
from alipay.
app_notify_url=" http://www.getsms.club/", # 默认回调url
你看看是不是多了个空格
from alipay.
有两个地方尝试一下, 第一个是url里面的空格,第二个是设置return_url="http:example.com/", 不要设置为空字符串
from alipay.
# -*- coding: utf-8 -*-
from alipay import AliPay
# from alipay import ISVAlipay
app_private_key_string = open("key/app_private_key.pem").read()
alipay_public_key_string = open("key/alipay_public_key.pem").read()
alipay = AliPay(
appid="2018062460380864",
app_notify_url="http://www.getsms.club/", # 默认回调url
app_private_key_string=app_private_key_string,
alipay_public_key_string=alipay_public_key_string, # 支付宝的公钥,验证支付宝回传消息使用,不是你自己的公钥,
sign_type="RSA2", # RSA 或者 RSA2
debug=False # 默认False
)
# If you don't know what ISV is, then forget about what I mentioned below
# either app_auth_code or app_auth_token should not be None
# isv_alipay = ISVAliPay(
# appid="",
# app_notify_url=None, # 默认回调url
# app_private_key_srting="",
# alipay_public_key_string="", # alipay public key, do not use your public key!
# sign_type="RSA", # RSA or RSA2
# debug=False, # False by default,
# app_auth_code=None,
# app_auth_token=None
# )
# 如果你是Python 2用户(考虑考虑升级到Python 3吧),请确保非ascii的字符串为utf8编码:
subject = u"aaa".encode("utf8")
# 手机网站支付,需要跳转到https://openapi.alipay.com/gateway.do? + order_string
order_string = alipay.api_alipay_trade_wap_pay(
out_trade_no="20161112",
total_amount=0.01,
subject=subject,
return_url="http://example.com",
notify_url="" # 可选, 不填则使用默认notify url
)
# url = 'https://openapi.alipaydev.com/gateway.do?' + order_string
url = 'https://openapi.alipay.com/gateway.do?' + order_string
print url
输出
支付宝返回的信息
调试错误,请回到请求来源地,重新发起请求。
错误代码 invalid-signature 错误原因: 验签出错,建议检查签名字符串或签名私钥与应用公钥是否匹配,网关生成的验签字符串为:app_id=2018062460380864&biz_content={out_trade_no:20161112,product_code:QUICK_WAP_PAY,total_amount:0.01,subject:aaa}&charset=utf-8&method=alipay.trade.wap.pay¬ify_url=http://www.getsms.club/&return_url=http://example.com&sign_type=RSA2&timestamp=2018-06-27 21:11:44&version=1.0
query参数
app_id: 2018062460380864
biz_content: {out_trade_no:20161112,product_code:QUICK_WAP_PAY,total_amount:0.01,subject:aaa}
charset: utf-8
method: alipay.trade.wap.pay
notify_url: http://www.getsms.club/
return_url: http://example.com
sign_type: RSA2
timestamp: 2018-06-27+21:11:44
version: 1.0
sign: Iu/q+kQwJQ+sH/tTEXAck54OOSnoF1DsgPELgxRgxa670yORDNIRdastkSmbtyAfZlqd2/GyyjyJThJ7WmKqgAooqb+HoBSnxCusCf0d1D3nPFf2MCidnacB6ZPTcbBxI7CUzC4PKhvZ15b6svUu7rGzIU8pwPRxffwYPOhC/6uTl3PBSWuhjXKLHwj+QBaikpMREBg7aRHLjby1mtTbEHVQfp6+lIAuz4C4SHg84osein8TDEidiToPaH7F/01LZChkYc+jO3vo+4CZalivpSEfnOpJw3TM0znVL0e6DJhkYHboWPfwqypYeobFbS9MloCmgH9TVvMr9T6/3KIheg==
from alipay.
这个事情有些奇怪,因为我点击你最后一次生成的链接, 直接在电脑浏览器或者手机浏览器里面是可以代开的。
from alipay.
神奇了,我也能打开了T_T
昨晚发帖的时候还是失败的
from alipay.
很奇怪,难道有延迟?因为我改了一些参数又不行了
from alipay.
from alipay.
@fzlee 原因找到了:vscode
最后print出来那个url,如果直接ctrl点击打开,链接里的ascii码的符号就会被decode,然后链接就不对了~谢谢po主:)
错误链接示范 ,可以看到里面包含了{ 等符号,在ascii里面是%7B%22
from alipay.
Related Issues (20)
- 支付宝公钥已经采用证书的形式,没有提供公钥这种形式,需要自己转换?请问有没有好的解放方案么?谢谢 HOT 3
- 添加支持 alipay.fund.account.query(支付宝资金账户资产查询接口) HOT 2
- alipay.api_alipay_trade_query(out_trade_no=order_id) HOT 4
- uwsgi 无法正常返回 HOT 6
- 验证回调通知错误 HOT 4
- 没有公网ip,怎么样验证支付是否成功 HOT 2
- 能否增加aes支持 HOT 2
- ImportError: cannot import name 'Alipay' from 'alipay'
- 使用支付宝公钥 初始化AliPay时报错 binascii.Error: Incorrect padding HOT 8
- ssl依赖该升级了 HOT 3
- 您好,请问支持分账吗? HOT 11
- 证书方式如何安装 HOT 30
- 是否支持证书方式的签名 HOT 10
- 应用网关是什么 HOT 3
- 3.0如何获取请求返回状态 HOT 10
- 获取用户信息怎么调用 HOT 9
- alipay支付网关已经变更了
- notify 回调消息验证失败 binascii.Error: Invalid base64-encoded string HOT 8
- ValueError: nameserver is not an IP address or valid https URL HOT 2
- 沙箱环境下调用失败(invalid-app-id)及其解决办法 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alipay.