标签:打开 iba ocs 需要 deb info query false cto
# 访问"支付宝开发平台"登录,可以访问开发者中心
https://open.alipay.com/platform/home.htm
# 可以参考"电脑网站支付" 熟悉电脑支付整体流程
https://docs.open.alipay.com/270/105899/
安装支付宝开放平台开发助手
一定要存储两个东西
# 商家信息
商家账号tuyprl9260@sandbox.com
登录密码111111
# 买家信息
买家账号rrkcsk8079@sandbox.com
登录密码111111
支付密码111111
支付宝开放平台: https://open.alipay.com/platform/home.htm
支付宝沙箱环境: https://openhome.alipay.com/platform/appDaily.htm?tab=info
支付宝开发者文档:https://openhome.alipay.com/developmentDocument.htm
电脑网站支付流程:https://docs.open.alipay.com/270
生成签名:https://docs.open.alipay.com/291/106103/
python-alipay-adk : https://github.com/fzlee/alipay/blob/master/README.zh-hans.md
公钥加密、私钥解密
这八个字app_private_key.pem
app私钥-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAlt0FL8bh/y4gaPR+z5WRLXOVUcvmQIG4KgdbrDjMhnNUjOvcGQFc85d9K1IJASTIsB9EBYCAXnc8Iyti7mMqMbf62nIx8i8x1m4nsWwZpYE5pcG2nCfDHJFksZDSrzNAmHAFyi1fE4TDa5Qc0Fgqo5NjkGQGYWlNgu7VYpj6N2zjHXTPtQ7ULep+ogcoXbm8gBl3WHmeMdUVBXZ42f180qkmvud4XqwLVuuGB71DjlOMmOzHzmZEOspf/V02bvXMYD+BzZU+cB+G5fFwCVv+EGze+dN/mXXy6yNjkMkjiqOBTuNrR5r4L7ds5+eIZ9d2QbEaPRYb0WDlpCqYgshNBwIDAQABAoIBAHJNvdtILf1A/q9m6Bnx8dBlLbKO8cLYRigZ8RxY4KXSBjLLlbSgcsPheKX0/vuN2jyPQ+ODTD/GyZrACbIjElofUoJmWW9s0K7uQUbNZ9UdRwdO8UP5YHxpsMhUuTyjcYLOBaT8oXfRdJsy2m4FDzFmv94r2yW9OkxFFwogbBzHR8Vi3BJH85VnB/yCkCwPGd3fNzm/+4A9G7l6BffAVVPdgrx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EFAAOCAQ8AMIIBCgKCAQEAgjwuLp9i1+g7Xuz3ree8ElybqL1iGQWO1bHJGh148lLQYPT+ccyY7YJu/QMiEkRfZ+Wzv6kHA0zyo0+6Jgshn/T3qGQA1tpee3hk5ol+CBSC9rApOUD6piRCwoKTEI47kcigsaV3z3TpqWFPmbNm8uIHhfqXFwqJIVyoF1+0Xjbimu1j/mcfswpg5WdS5UbQ2v8vzQdkqDSvmyON6JoF/SQqHNl1nCaGnJTigPY19+0v867TuUZmI2FcHR9uj2/yEA41ioxQSCa/Q21dxqIkVkSN3+z0k2Ihs/X2oqcYf6B53VuEv090siVO+KRn6YXHRY+WdKHfezs776qlh/B18QIDAQAB
-----END PUBLIC KEY-----
alipay_test
测试沙箱环境# -*- coding: utf-8 -*-
from alipay import AliPay
# 沙箱环境中 app 私钥
app_private_key_string = open(‘app_private_key.pem‘).read()
# 支付宝公钥
alipay_public_key_string = open( ‘alipay_public_key.pem‘).read()
def get_alipay_url():
# 实例化一个alipay对象
alipay = AliPay(
appid="2016102600762786", # 沙箱appid
app_notify_url=None, # 默认回调url
app_private_key_string=app_private_key_string,
# 支付宝的公钥,验证支付宝回传消息使用,不是你自己的公钥,
alipay_public_key_string=alipay_public_key_string,
sign_type="RSA2", # RSA 或者 RSA2
debug=True, # 默认False,我们是沙箱,所以改成True(让访问沙箱环境支付宝地址)
)
# 调用支付接口,生成支付链接
# 电脑网站支付,需要跳转到https://openapi.alipay.com/gateway.do? + order_string
order_string = alipay.api_alipay_trade_page_pay(
out_trade_no="201612226", # 订单id,应该从前端获取
total_amount=str(0.01), # 订单总金额
subject="测试阿里云付款", # 付款标题信息
return_url=None, # 付款成功回调地址(可以为空)
notify_url=None # 付款成功后异步通知地址(可以为空)
)
pay_url = "https://openapi.alipaydev.com/gateway.do?" + order_string
print(pay_url) # 将这个url复制到浏览器,就会打开支付宝支付页面
def query_pay():
alipay = AliPay(
appid="2016102600762786", # 沙箱appid
app_notify_url=None, # 默认回调url
app_private_key_string=app_private_key_string,
# 支付宝的公钥,验证支付宝回传消息使用,不是你自己的公钥
alipay_public_key_string=alipay_public_key_string,
sign_type="RSA", # RSA 或者 RSA2
debug=True, # 默认False,我们是沙箱,所以改成True(让访问沙箱环境支付宝地址)
)
trade_query = alipay.api_alipay_trade_query(
out_trade_no=20161112, # 上面生成支付码页面时传入的商品订单号
trade_no=None
)
print(trade_query)
if __name__ == ‘__main__‘:
get_alipay_url()
# query_pay()
标签:打开 iba ocs 需要 deb info query false cto
原文地址:https://www.cnblogs.com/fiee/p/13823485.html