Files
baseapi/platformapi/alipayapi/pay.go
邹宗楠 6cf1ea3337 1
2022-07-11 10:36:40 +08:00

60 lines
4.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
}