Documentation
¶
Index ¶
- func StartTestServer(c *AliPayClient)
- type AliPayClient
- func (client *AliPayClient) GetAppPayURL(subject, productCode, orderNo, totalAmount, notifyURL string) (string, error)
- func (client *AliPayClient) GetQrPayURL(subject, productCode, orderNo, totalAmount, notifyURL, returnURL string, ...) (string, error)
- func (client *AliPayClient) OpenBrowser(url string)
- func (client *AliPayClient) WapAlipay(...) (string, error)
- func (client *AliPayClient) WebPageAlipay(subject, productCode, orderNo, totalAmount, notifyURL, returnURL string, ...) (string, error)
- type RequestParams
- type UnifyOrderRequest
- type UnifyOrderResponse
- type WeiXinPayClient
- func (c *WeiXinPayClient) BuildSign(params map[string]string) string
- func (c *WeiXinPayClient) BuildUnifyParams(amount int32, openID, tradeType string) *UnifyOrderRequest
- func (c *WeiXinPayClient) CreateUnifyOrder(amount int32, openId, tradeType string) (*UnifyOrderResponse, error)
- func (c *WeiXinPayClient) WeiXinPay(amount int32, openId string) (*RequestParams, error)
- func (c *WeiXinPayClient) WeiXinPayCode(amount int32, openId string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartTestServer ¶
func StartTestServer(c *AliPayClient)
Types ¶
type AliPayClient ¶
func InitAliPayClient ¶
func InitAliPayClient(appId, privateKey, appPublicCert, aliPayPublicCert, aliPayRootCert string) *AliPayClient
func (*AliPayClient) GetAppPayURL ¶
func (client *AliPayClient) GetAppPayURL(subject, productCode, orderNo, totalAmount, notifyURL string) (string, error)
GetAppPayURL APP支付
func (*AliPayClient) GetQrPayURL ¶
func (client *AliPayClient) GetQrPayURL(subject, productCode, orderNo, totalAmount, notifyURL, returnURL string, callParams map[string]string) (string, error)
GetQrPayURL 扫码支付(生成支付的二维码的链接) https://docs.open.alipay.com/api_1/alipay.trade.pay/
func (*AliPayClient) OpenBrowser ¶
func (client *AliPayClient) OpenBrowser(url string)
func (*AliPayClient) WapAlipay ¶
func (client *AliPayClient) WapAlipay(subject, productCode, orderNo, totalAmount, notifyURL, quitURL, returnURL string, callParams map[string]string) (string, error)
WapAlipay 手机网页支付(可转到APP支付) https://docs.open.alipay.com/204/105695/
func (*AliPayClient) WebPageAlipay ¶
func (client *AliPayClient) WebPageAlipay(subject, productCode, orderNo, totalAmount, notifyURL, returnURL string, callParams map[string]string) (string, error)
WebPageAlipay 调转支付宝网站支付
type RequestParams ¶
type UnifyOrderRequest ¶
type UnifyOrderRequest struct {
AppID string `xml:"appid"`
MchID string `xml:"mch_id"`
NonceStr string `xml:"nonce_str"`
Sign string `xml:"sign"`
Body string `xml:"body"`
OutTradeNo string `xml:"out_trade_no"`
TotalFee string `xml:"total_fee"`
SpbillCreateIP string `xml:"spbill_create_ip"`
NotifyURL string `xml:"notify_url"`
TradeType string `xml:"trade_type"`
OpenID string `xml:"openid"`
}
UnifyOrderRequest 统一下单请求体
type UnifyOrderResponse ¶
type UnifyOrderResponse struct {
ReturnCode string `xml:"return_code"`
ResultCode string `xml:"result_code"`
ErrCode string `xml:"err_code"`
ErrCodeDes string `xml:"err_code_des"`
ReturnMsg string `xml:"return_msg"`
PrepayID string `xml:"prepay_id"`
CodeURL string `xml:"code_url"`
NoneceStr string `xml:"nonce_str"`
}
UnifyOrderResponse 统一下单响应体
type WeiXinPayClient ¶
type WeiXinPayClient struct {
// 统一下单API接口
WeiXinPayUnifedURL string //"https://api.mch.weixin.qq.com/pay/unifiedorder"
// 通知地址
WeixinNotifyURL string // "https://pibigstar.com/weixin/pay"
// 交易类型
TradeTypeJSAPI string // "JSAPI"
TradeTypeNATIVE string // "NATIVE"
// 商品描述
RewardBody string // "微信支付Demo"
// 终端IP,用户的客户端IP
CreateIP string // "127.0.0.1"
// 微信支付分配的公众账号ID(企业号corpid即为此appId)
AppID string // "wx8888888888888888"
// 商户号
MchID string // "1230000109"
// 商户Key
MchKey string // "pibigstar"
}
func (*WeiXinPayClient) BuildSign ¶
func (c *WeiXinPayClient) BuildSign(params map[string]string) string
生成签名 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_3
func (*WeiXinPayClient) BuildUnifyParams ¶
func (c *WeiXinPayClient) BuildUnifyParams(amount int32, openID, tradeType string) *UnifyOrderRequest
构造统一下单参数
func (*WeiXinPayClient) CreateUnifyOrder ¶
func (c *WeiXinPayClient) CreateUnifyOrder(amount int32, openId, tradeType string) (*UnifyOrderResponse, error)
CreateUnifyOrder 统一下单 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
func (*WeiXinPayClient) WeiXinPay ¶
func (c *WeiXinPayClient) WeiXinPay(amount int32, openId string) (*RequestParams, error)
WeiXinPay 微信支付
func (*WeiXinPayClient) WeiXinPayCode ¶
func (c *WeiXinPayClient) WeiXinPayCode(amount int32, openId string) (string, error)
WeiXinPayCode 微信扫码支付, 生成支付二维码
Click to show internal directories.
Click to hide internal directories.