You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.2 KiB
82 lines
2.2 KiB
#! /usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
# Date: 2018/8/2
|
|
|
|
|
|
"""
|
|
App支付
|
|
"""
|
|
|
|
import logging
|
|
|
|
from .base import BaseAliPayAPI
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class AliApp(BaseAliPayAPI):
|
|
|
|
def direct(self, subject, out_trade_no, total_amount, notify_url=None, return_url=None, **kwargs):
|
|
"""App快速下单接口
|
|
|
|
文档DOC地址: https://docs.open.alipay.com/203/105288/
|
|
|
|
Parameters
|
|
----------
|
|
|
|
subject : string
|
|
订单标题
|
|
|
|
out_trade_no : string
|
|
商户订单号唯一凭证
|
|
|
|
total_amount : string or float or int
|
|
支付金额,单位元,精确到分
|
|
|
|
notify_url: string
|
|
|
|
支付宝服务器主动通知商户服务器里指定的页面http/https路径
|
|
|
|
example: http://www.alipay.com/pay
|
|
|
|
return_url: string
|
|
|
|
同步返回地址,HTTP/HTTPS开头字符串
|
|
|
|
kwargs : dict
|
|
以下均为可选参数
|
|
|
|
body : string
|
|
订单描述
|
|
|
|
goods_detail : json
|
|
订单包含的商品列表信息,Json格式: {"show_url":"https://或http://打头的商品的展示地址"}
|
|
在支付时,可点击商品名称跳转到该地址
|
|
|
|
passback_params : string
|
|
公用回传参数,如果请求时传递了该参数,则返回给商户时会回传该参数。
|
|
支付宝只会在异步通知时将该参数原样返回。
|
|
本参数必须进行UrlEncode之后才可以发送给支付宝
|
|
|
|
goods_type : int
|
|
商品主类型:0; 虚拟类商品,1; 实物类商品(默认)
|
|
|
|
extend_params :
|
|
业务扩张参数(主要用于接入花呗分期)
|
|
|
|
Returns
|
|
-------
|
|
dict
|
|
"""
|
|
|
|
biz_content = {
|
|
"subject": subject,
|
|
"out_trade_no": out_trade_no,
|
|
"total_amount": total_amount,
|
|
"product_code": "QUICK_MSECURITY_PAY", # 销售产品码,目前仅支持这个类型
|
|
# "qr_pay_mode":4
|
|
}
|
|
|
|
biz_content.update(**kwargs)
|
|
|
|
return self._generate_url("alipay.trade.app.pay", biz_content, notify_url, return_url)
|
|
|