Documentation
¶
Overview ¶
这里是支付宝常量接口定义
Index ¶
- Constants
- func SignRawStrConvert(rawStr string) (str, sign string)
- type BizContentRequestParams
- type Client
- func (c *Client) CheckSign(signReqStr string) bool
- func (c *Client) DoRequest(method string, p BizContentRequestParams, fromBrowser bool) ([]byte, error)
- func (c *Client) SetReturnURL(str string)
- func (c *Client) TradeCancel(p BizContentRequestParams) (*TradeCancelResponse, error)
- func (c *Client) TradePagePay(p BizContentRequestParams, ReturnUrl string) (string, error)
- func (c *Client) TradePreCreate(p BizContentRequestParams) (*TradePreCreateResponse, error)
- func (c *Client) TradeQuery(p BizContentRequestParams) (*TradeQueryResponse, error)
- func (c *Client) TradeRefund(p BizContentRequestParams) (*TradeCancelResponse, error)
- func (c *Client) TradeWapPay(p BizContentRequestParams, ReturnUrl string) (string, error)
- type Params
- type PublicRequestParams
- type PublicResponse
- type TradeCancelResponse
- type TradePreCreateResponse
- type TradeQueryResponse
Constants ¶
View Source
const AlipayTradeCancelMethodName = "alipay.trade.cancel"
统一收单线下撤销 接口名称
View Source
const AlipayTradeEndpointURL = "https://openapi.alipay.com/gateway.do"
统一收单线下请求地址
View Source
const AlipayTradePagePay = "alipay.trade.page.pay"
https://opendocs.alipay.com/pre-open/270/105900 2020-03-07 新增电脑网站支付接口 统一收单下单并支付页面接口
View Source
const AlipayTradePrecreateMethodName = "alipay.trade.precreate"
统一收单线下交易预创 接口名称
View Source
const AlipayTradeQueryMethodName = "alipay.trade.query"
统一收单线下交易查询 接口名称
View Source
const AlipayTradeRefundMethodName = "alipay.trade.refund"
统一收单同步退款 接口名称
View Source
const AlipayTradeWapPay = "alipay.trade.wap.pay"
统一收到wap支付接口
View Source
const DefaultCharset = "utf-8"
编码
View Source
const DefaultFormat = "JSON"
格式
View Source
const DefaultTimeFormat = "2006-01-02 15:04:05"
时间戳格式
View Source
const DefaultVersion = "1.0"
版本
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BizContentRequestParams ¶
type BizContentRequestParams struct {
OutTradeNo string `json:"out_trade_no,omitempty"` // 商户订单ID
TotalAmount string `json:"total_amount,omitempty"` // 总金额
Subject string `json:"subject,omitempty"` // 主题
RefundAmount string `json:"refund_amount,omitempty"` // 退款请求金额
ProductCode string `json:"product_code,omitempty"` // 销售产品码 - 网站支付默认 FAST_INSTANT_TRADE_PAY
QuitURL string `json:"quit_url,omitempty"` // 用户中途退出返回商户网站地址
}
商家请求参数
type Client ¶
type Client struct {
AppID string // 应用id
NotifyURL string // 回调接口
SignType string // 签名类型
EndpointURL string // 创建交易地址 必须要有
AliPayPublicKey *rsa.PublicKey // 支付宝公钥
// 普通公钥签名可用
AppPrivateKey *rsa.PrivateKey // 应用私钥
// 以下公钥证书可以
AppPublicKeyCert string // app公钥证书
AliPayPublicKeyCert string // 支付宝公钥证书
AliPayRootCert string // 支付宝根证书
ReturnURL string // wap 支付成功返回地址
}
func (*Client) DoRequest ¶
func (c *Client) DoRequest(method string, p BizContentRequestParams, fromBrowser bool) ([]byte, error)
通用请求接口
func (*Client) SetReturnURL ¶ added in v0.0.3
wap 支付设置成功支付回跳地址
func (*Client) TradeCancel ¶
func (c *Client) TradeCancel(p BizContentRequestParams) (*TradeCancelResponse, error)
撤销订单接口
func (*Client) TradePagePay ¶ added in v0.0.2
func (c *Client) TradePagePay(p BizContentRequestParams, ReturnUrl string) (string, error)
网站支付下单接口
func (*Client) TradePreCreate ¶
func (c *Client) TradePreCreate(p BizContentRequestParams) (*TradePreCreateResponse, error)
预下单接口
func (*Client) TradeQuery ¶
func (c *Client) TradeQuery(p BizContentRequestParams) (*TradeQueryResponse, error)
查询订单接口
func (*Client) TradeRefund ¶
func (c *Client) TradeRefund(p BizContentRequestParams) (*TradeCancelResponse, error)
交易退款
func (*Client) TradeWapPay ¶ added in v0.0.3
func (c *Client) TradeWapPay(p BizContentRequestParams, ReturnUrl string) (string, error)
wap下单接口
type PublicRequestParams ¶
type PublicRequestParams struct {
AppID string `url:"app_id" json:"app_id"` //必填
Method string `url:"method" json:"method"` // 必填
Format string `url:"format,omitempty" json:"format,omitempty"` //格式化
Charset string `url:"charset" json:"charset"` // 字符编码
SignType string `url:"sign_type" json:"sign_type"` // 签名类型
Sign string `url:"sign" json:"sign"` // 签名
Timestamp string `url:"timestamp" json:"timestamp"` // 时间格式
Version string `url:"version" json:"version"` // 接口版本
NotifyURL string `url:"notify_url,omitempty" json:"notify_url,omitempty"` // 回调地址
AppAuthToken string `url:"app_auth_token,omitempty" json:"app_auth_token,omitempty"` // 应用授权
BizContent string `url:"biz_content" json:"biz_content"` // 特定请求参数
ReturnURL string `json:"return_url,omitempty" url:"return_url,omitempty"` // 移动支付成功返的地址
}
公共请求参数
type PublicResponse ¶
type PublicResponse struct {
Code string `json:"code"` // 网关返回代码
Msg string `json:"msg"` // 网关错误信息
SubCode string `json:"sub_code"` // 业务返回代码
SumMsg string `json:"sum_msg"` // 业务返回描述
}
------------****响应参数********** ----------------------------------------
type TradeCancelResponse ¶
type TradeCancelResponse struct {
AlipayTradeCancelResponse struct {
PublicResponse
OutTradeNo string `json:"out_trade_no,omitempty"` // 商家订单号
TradeNo string `json:"trade_no,omitempty"` // 支付宝订单号
RetryFlag string `json:"retry_flag,omitempty"` // 是否需要重试
Action string `json:"action,omitempty"` // close:交易未支付,触发关闭交易动作,无退款;refund:交易已支付,�触发交易退款动作;未返回:未查询到交易,或接口调用失败;
GmtRefundPay string `json:"gmt_refund_pay,omitempty"` // 当撤销产生了退款时,返回退款时间;
RefundSettlementID string `json:"refund_settlement_id,omitempty"` // 是否需要重试
} `json:"alipay_trade_cancel_response"`
}
交易撤销结果
type TradePreCreateResponse ¶
type TradePreCreateResponse struct {
AlipayTradePrecreateResponse struct {
PublicResponse
OutTradeNo string `json:"out_trade_no,omitempty"` // 商家订单号
QrCode string `json:"qr_code,omitempty"` // 商家订单号
} `json:"alipay_trade_precreate_response"`
}
type TradeQueryResponse ¶
type TradeQueryResponse struct {
AlipayTradeQueryResponse struct {
PublicResponse
TradeStatus string `json:"trade_status"` // 交易状态
TotalAmount string `json:"total_amount"` // 总金额
BuyerUserID string `json:"buyer_user_id"` // 买家金额
} `json:"alipay_trade_query_response"`
}
交易结果查询
Click to show internal directories.
Click to hide internal directories.