60 lines
4.2 KiB
Go
60 lines
4.2 KiB
Go
package alipayapi
|
||
|
||
import (
|
||
"git.rosy.net.cn/baseapi/utils"
|
||
)
|
||
|
||
type CreatePayParam struct {
|
||
OutTradeNo string `json:"out_trade_no"` //商户订单号。 由商家自定义,64个字符以内,仅支持字母、数字、下划线且需保证在商户端不重复。
|
||
TotalAmount float64 `json:"total_amount"` // 订单总金额。 单位为元,精确到小数点后两位,取值范围:[0.01,100000000] 。
|
||
Subject string `json:"subject"` //订单标题。 注意:不可使用特殊字符,如 /,=,& 等。
|
||
StoreID string `json:"store_id"` //商户门店编号。指商户创建门店时输入的门店编号。
|
||
BuyerID string `json:"buyer_id"` //买家支付宝用户ID。 2088开头的16位纯数字,小程序场景下获取用户ID请参考:用户授权; 其它场景下获取用户ID请参考:网页授权获取用户信息; 注:交易的买家与卖家不能相同。
|
||
}
|
||
|
||
func (a *API) CreatePay(createPayParam *CreatePayParam) (retVal map[string]interface{}, err error) {
|
||
retVal, err = a.AccessAPI("alipay.trade.create", map[string]interface{}{
|
||
"notify_url": "http://print.jxc4.com/callback/msg",
|
||
"app_auth_token": "202107BB5163b293ce9e4758bd579adcfa8deX10",
|
||
}, utils.Struct2FlatMap(createPayParam), true)
|
||
return retVal, err
|
||
}
|
||
|
||
type CreatePayParam2 struct {
|
||
OutTradeNo string `json:"out_trade_no"` // 商户订单号。 由商家自定义,64个字符以内,仅支持字母、数字、下划线且需保证在商户端不重复。
|
||
TotalAmount float64 `json:"total_amount"` // 订单总金额。 单位为元,精确到小数点后两位,取值范围:[0.01,100000000] 。
|
||
Subject string `json:"subject"` // 订单标题。 注意:不可使用特殊字符,如 /,=,& 等。
|
||
StoreID string `json:"store_id"` // 商户门店编号。指商户创建门店时输入的门店编号。
|
||
//BuyerID string `json:"buyer_id"` // 买家支付宝用户ID。 2088开头的16位纯数字,小程序场景下获取用户ID请参考:用户授权; 其它场景下获取用户ID请参考:网页授权获取用户信息; 注:交易的买家与卖家不能相同。
|
||
QuitURL string `json:"quit_url,omitempty"` // 用户付款中途退出返回商户网站的地址
|
||
ProductCode string `json:"product_code"` // 商家和支付宝签约的产品码。 枚举值(点击查看签约情况): QUICK_WAP_WAY:无线快捷支付产品。
|
||
}
|
||
|
||
type ExtendParams struct {
|
||
SysServiceProviderID string `json:"sys_service_provider_id"` //系统商编号 该参数作为系统商返佣数据提取的依据,请填写系统商签约协议的PID
|
||
}
|
||
|
||
func (a *API) CreatePay2(createPayParam *CreatePayParam2) (retVal map[string]interface{}, err error) {
|
||
retVal, err = a.AccessAPI("alipay.trade.wap.pay", map[string]interface{}{
|
||
"notify_url": "http://print.jxc4.com/callback/msg",
|
||
"app_auth_token": "202107BB5163b293ce9e4758bd579adcfa8deX10",
|
||
}, utils.Struct2FlatMap(createPayParam), false)
|
||
return retVal, err
|
||
}
|
||
|
||
type CreatePayParam3 struct {
|
||
OutTradeNo string `json:"out_trade_no"` //商户订单号。 由商家自定义,64个字符以内,仅支持字母、数字、下划线且需保证在商户端不重复。
|
||
TotalAmount float64 `json:"total_amount"` //订单总金额。 单位为元,精确到小数点后两位,取值范围:[0.01,100000000] 。
|
||
//Subject string `json:"subject"` //订单标题。 注意:不可使用特殊字符,如 /,=,& 等。
|
||
StoreID string `json:"store_id"` //商户门店编号。指商户创建门店时输入的门店编号。
|
||
//BuyerID string `json:"buyer_id"` //买家支付宝用户ID。 2088开头的16位纯数字,小程序场景下获取用户ID请参考:用户授权; 其它场景下获取用户ID请参考:网页授权获取用户信息; 注:交易的买家与卖家不能相同。
|
||
}
|
||
|
||
func (a *API) CreatePay3(createPayParam *CreatePayParam3) (retVal map[string]interface{}, err error) {
|
||
retVal, err = a.AccessAPI("alipay.trade.wap.pay", map[string]interface{}{
|
||
"notify_url": "http://print.jxc4.com/callback/msg",
|
||
"app_auth_token": "202107BB74ec17e0fa8c44bb85fff19a10464X98",
|
||
}, utils.Struct2FlatMap(createPayParam), false)
|
||
return retVal, err
|
||
}
|