Documentation ¶
Index ¶
- Constants
- func MapToXml(params Params) string
- type Account
- type AmountReceiver
- type Client
- func (c *Client) AuthCodeToOpenid(params Params) (Params, error)
- func (c *Client) CloseOrder(params Params) (Params, error)
- func (c *Client) DownloadBill(params Params) (Params, error)
- func (c *Client) DownloadFundFlow(params Params) (Params, error)
- func (c *Client) MicroPay(params Params) (Params, error)
- func (c *Client) OrderQuery(params Params) (Params, error)
- func (c *Client) ProfitSharing(params Params) (Params, error)
- func (c *Client) ProfitSharingAddReceiver(params Params) (Params, error)
- func (c *Client) ProfitSharingFinish(params Params) (Params, error)
- func (c *Client) ProfitSharingMulti(params Params) (Params, error)
- func (c *Client) Refund(params Params) (Params, error)
- func (c *Client) RefundQuery(params Params) (Params, error)
- func (c *Client) Report(params Params) (Params, error)
- func (c *Client) Reverse(params Params) (Params, error)
- func (c *Client) SetAccount(account *Account)
- func (c *Client) SetHttpConnectTimeoutMs(ms int)
- func (c *Client) SetHttpReadTimeoutMs(ms int)
- func (c *Client) SetSignType(signType string)
- func (c *Client) ShortUrl(params Params) (Params, error)
- func (c *Client) Sign(params Params) string
- func (c *Client) UnifiedOrder(params Params) (Params, error)
- func (c *Client) ValidSign(params Params) bool
- type FinishSharing
- type JsapiIn
- type JsapiOut
- type MP
- func (c *MP) EnableDebug() *MP
- func (c *MP) Prepay(input *JsapiIn) (*JsapiOut, Params, error)
- func (c *MP) ProfitSharing(input *SharingInfo) (Params, error)
- func (c *MP) ProfitSharingAddReceiver(receiver *ShareReceiver) (Params, error)
- func (c *MP) ProfitSharingFinish(input *FinishSharing) (Params, error)
- func (c *MP) ProfitSharingMulti(input *SharingInfo) (Params, error)
- func (c *MP) QueryOrder(outTradeNo string) (string, Params, error)
- func (c *MP) Refund(input *RefundIn) (Params, error)
- func (c *MP) SetCertBase64(certDataBase64 string) error
- func (c *MP) SetCertPath(certPath string) error
- func (c *MP) Sign(input map[string]string) string
- type Notifies
- type Params
- type RefundIn
- type ShareReceiver
- type SharingInfo
Constants ¶
const ( Fail = "FAIL" Success = "SUCCESS" HMACSHA256 = "HMAC-SHA256" MD5 = "MD5" Sign = "sign" MicroPayUrl = "https://api.mch.weixin.qq.com/pay/micropay" UnifiedOrderUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder" OrderQueryUrl = "https://api.mch.weixin.qq.com/pay/orderquery" ReverseUrl = "https://api.mch.weixin.qq.com/secapi/pay/reverse" CloseOrderUrl = "https://api.mch.weixin.qq.com/pay/closeorder" RefundUrl = "https://api.mch.weixin.qq.com/secapi/pay/refund" RefundQueryUrl = "https://api.mch.weixin.qq.com/pay/refundquery" DownloadBillUrl = "https://api.mch.weixin.qq.com/pay/downloadbill" DownloadFundFlowUrl = "https://api.mch.weixin.qq.com/pay/downloadfundflow" ReportUrl = "https://api.mch.weixin.qq.com/payitil/report" ShortUrl = "https://api.mch.weixin.qq.com/tools/shorturl" AuthCodeToOpenidUrl = "https://api.mch.weixin.qq.com/tools/authcodetoopenid" ProfitSharingAddReceiver = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver" ProfitSharing = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing" ProfitSharingMulti = "https://api.mch.weixin.qq.com/secapi/pay/multiprofitsharing" ProfitSharingFinish = "https://api.mch.weixin.qq.com/secapi/pay/profitsharingfinish" SandboxMicroPayUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/micropay" SandboxUnifiedOrderUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/unifiedorder" SandboxOrderQueryUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/orderquery" SandboxReverseUrl = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/reverse" SandboxCloseOrderUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/closeorder" SandboxRefundUrl = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/refund" SandboxRefundQueryUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/refundquery" SandboxDownloadBillUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/downloadbill" SandboxDownloadFundFlowUrl = "https://api.mch.weixin.qq.com/sandboxnew/pay/downloadfundflow" SandboxReportUrl = "https://api.mch.weixin.qq.com/sandboxnew/payitil/report" SandboxShortUrl = "https://api.mch.weixin.qq.com/sandboxnew/tools/shorturl" SandboxAuthCodeToOpenidUrl = "https://api.mch.weixin.qq.com/sandboxnew/tools/authcodetoopenid" SandboxProfitSharingAddReceiver = "https://api.mch.weixin.qq.com/sandboxnew/pay/profitsharingaddreceiver" SandboxProfitSharing = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/profitsharing" SandboxProfitSharingMulti = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/multiprofitsharing" SandboxProfitSharingFinish = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/profitsharingfinish" )
const ( RECEIVER_TYPE_MERCHANT_ID = "MERCHANT_ID" RECEIVER_TYPE_PERSONAL_OPENID = "PERSONAL_OPENID" RECEIVER_TYPE_PERSONAL_SUB_OPENID = "PERSONAL_SUB_OPENID" )
const ( RELATION_TYPE_SERVICE_PROVIDER = "SERVICE_PROVIDER" // 服务商 RELATION_TYPE_STORE = "STORE" // 门店 RELATION_TYPE_STAFF = "STAFF" // 员工 RELATION_TYPE_STORE_OWNER = "STORE_OWNER" // 店主 RELATION_TYPE_PARTNER = "PARTNER" // 合作伙伴 RELATION_TYPE_HEADQUARTER = "HEADQUARTER" // 总部 RELATION_TYPE_BRAND = "BRAND" // 品牌方 RELATION_TYPE_DISTRIBUTOR = "DISTRIBUTOR" // 分销商 RELATION_TYPE_USER = "USER" // 用户 RELATION_TYPE_SUPPLIER = "SUPPLIER" // 供应商 RELATION_TYPE_CUSTOM = "CUSTOM" // 自定义 )
const (
SUCCESS = "SUCCESS"
)
const (
TRADE_TYPE_JSAPI = "JSAPI"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func NewAccount ¶
创建微信支付账号
func NewSubAccount ¶ added in v1.1.2
创建微信支付子账号-服务商模式
type AmountReceiver ¶ added in v1.1.4
type AmountReceiver struct { Type string `json:"type"` // 分账接收方类型 Account string `json:"account"` // 分账接收方帐号 Amount int `json:"amount"` // 分账金额 Description string `json:"description"` // 描述 }
AmountReceiver 分账金额接收方 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_6&index=2
func NewDefaultAmountReceiver ¶ added in v1.1.4
func NewDefaultAmountReceiver(mchID string, amount int, description string) *AmountReceiver
NewDefaultAmountReceiver /
type Client ¶
type Client struct { EnableDebug bool // 是否输出调试信息 // contains filtered or unexported fields }
Client /
func (*Client) AuthCodeToOpenid ¶
授权码查询OPENID接口
func (*Client) DownloadFundFlow ¶ added in v1.1.1
func (*Client) ProfitSharing ¶ added in v1.1.4
ProfitSharing 单次分账
func (*Client) ProfitSharingAddReceiver ¶ added in v1.1.4
ProfitSharingAddReceiver 添加分账接收方
func (*Client) ProfitSharingFinish ¶ added in v1.1.4
ProfitSharingFinish 完结分账
func (*Client) ProfitSharingMulti ¶ added in v1.1.4
ProfitSharingMulti 多次分账
func (*Client) SetAccount ¶
func (*Client) SetHttpConnectTimeoutMs ¶
func (*Client) SetHttpReadTimeoutMs ¶
func (*Client) SetSignType ¶
type FinishSharing ¶ added in v1.1.4
type FinishSharing struct { TransactionID string `json:"transactionID"` // 微信支付订单号 OutOrderNo string `json:"outOrderNo"` // 商户分账单号 Description string `json:"description"` // 分账完结描述 }
FinishSharing / 完结分账 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_5&index=6
type JsapiIn ¶ added in v1.1.1
type JsapiIn struct { OpenID string SubOpenID string Body string OutTradeNo string TotalFee int64 IP string NotifyURL string ProfitSharing bool }
JsapiIn 输入参数,支付结果通知文档 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7&index=8
type MP ¶ added in v1.1.1
type MP struct {
// contains filtered or unexported fields
}
MP is mini-program
func (*MP) EnableDebug ¶ added in v1.1.7
func (*MP) Prepay ¶ added in v1.1.1
Prepay 微信统一下单,接口文档 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
func (*MP) ProfitSharing ¶ added in v1.1.4
func (c *MP) ProfitSharing(input *SharingInfo) (Params, error)
ProfitSharing 请求单次分账 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_1&index=1
func (*MP) ProfitSharingAddReceiver ¶ added in v1.1.4
func (c *MP) ProfitSharingAddReceiver(receiver *ShareReceiver) (Params, error)
ProfitSharingAddReceiver 添加分账接收方 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_3&index=4
func (*MP) ProfitSharingFinish ¶ added in v1.1.4
func (c *MP) ProfitSharingFinish(input *FinishSharing) (Params, error)
ProfitSharingFinish 完结分账 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_5&index=6
func (*MP) ProfitSharingMulti ¶ added in v1.1.4
func (c *MP) ProfitSharingMulti(input *SharingInfo) (Params, error)
ProfitSharingMulti 请求多次分账 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_6&index=2
func (*MP) QueryOrder ¶ added in v1.1.1
QueryOrder 查询订单,接口文档 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2
func (*MP) Refund ¶ added in v1.1.1
Refund 微信退款,必须设置证书,接口文档 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4
func (*MP) SetCertBase64 ¶ added in v1.1.4
SetCertBase64 设置操作证书 base64编码
func (*MP) SetCertPath ¶ added in v1.1.1
SetCertPath 设置操作证书,请查看API证书说明 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_3
type RefundIn ¶ added in v1.1.1
type RefundIn struct { AppID string `json:"appID"` MchID string `json:"mchID"` SubAppID string `json:"subAppID"` SubMchID string `json:"subMchID"` OutTradeNo string `json:"outTradeNo"` OutRefundNo string `json:"outRefundNo"` TotalFee int64 `json:"totalFee"` RefundFee int64 `json:"refundFee"` }
RefundIn / 普通商户:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4 服务商模式:https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_sl_api.php?chapter=9_4
type ShareReceiver ¶ added in v1.1.4
type ShareReceiver struct {}
ShareReceiver 分账接收方 https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_3&index=4
func NewDefaultShareReceiver ¶ added in v1.1.4
func NewDefaultShareReceiver(mchID string, name string) *ShareReceiver
NewDefaultShareReceiver /
type SharingInfo ¶ added in v1.1.4
type SharingInfo struct { TransactionID string `json:"transactionID"` // 微信支付订单号 OutOrderNo string `json:"outOrderNo"` // 商户分账单号 Receivers []AmountReceiver `json:"receivers"` // 分账接收方列表 }
SharingInfo / https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_6&index=2