Documentation ¶
Index ¶
- Constants
- func GenerateXml(bm gopay.BodyMap) (reqXml string)
- func GetAppPaySign(appid, partnerid, noncestr, prepayid, signType, timestamp, apiKey string) (paySign string)
- func GetH5PaySign(appId, nonceStr, packages, signType, timeStamp, apiKey string) (paySign string)
- func GetJsapiPaySign(appId, nonceStr, packages, signType, timeStamp, apiKey string) (paySign string)
- func GetMiniPaySign(appId, nonceStr, packages, signType, timeStamp, apiKey string) (paySign string)
- func GetParamSign(appId, mchId, apiKey string, bm gopay.BodyMap) (sign string)
- func GetReleaseSign(apiKey string, signType string, bm gopay.BodyMap) (sign string)
- func GetSanBoxParamSign(ctx context.Context, appId, mchId, apiKey string, bm gopay.BodyMap) (sign string, err error)
- func GetSandBoxSign(ctx context.Context, mchId, apiKey string, bm gopay.BodyMap) (sign string, err error)
- func ParseNotifyToBodyMap(req *http.Request) (bm gopay.BodyMap, err error)
- func VerifySign(apiKey, signType string, bean interface{}) (ok bool, err error)
- type AccessToken
- type AppletUserInfo
- type AuthCodeToOpenIdResponse
- type CheckAccessTokenRsp
- type Client
- func (w *Client) AddCertPemFileContent(certFileContent, keyFileContent []byte) (err error)
- func (w *Client) AddCertPemFilePath(certFilePath, keyFilePath string) (err error)
- func (w *Client) AddCertPkcs12FileContent(p12FileContent []byte) (err error)
- func (w *Client) AddCertPkcs12FilePath(pkcs12FilePath string) (err error)
- func (w *Client) AuthCodeToOpenId(ctx context.Context, bm gopay.BodyMap) (wxRsp *AuthCodeToOpenIdResponse, err error)
- func (w *Client) BatchQueryComment(ctx context.Context, bm gopay.BodyMap) (wxRsp string, err error)
- func (w *Client) CloseOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *CloseOrderResponse, err error)
- func (w *Client) CustomsDeclareOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *CustomsDeclareOrderResponse, err error)
- func (w *Client) CustomsDeclareQuery(ctx context.Context, bm gopay.BodyMap) (wxRsp *CustomsDeclareQueryResponse, err error)
- func (w *Client) CustomsReDeclareOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *CustomsReDeclareOrderResponse, err error)
- func (w *Client) DownloadBill(ctx context.Context, bm gopay.BodyMap) (wxRsp string, err error)
- func (w *Client) DownloadFundFlow(ctx context.Context, bm gopay.BodyMap) (wxRsp string, err error)
- func (w *Client) EntrustAppPre(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustAppPreResponse, err error)
- func (w *Client) EntrustH5(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustH5Response, err error)
- func (w *Client) EntrustPaying(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustPayingResponse, err error)
- func (w *Client) EntrustPublic(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustPublicResponse, err error)
- func (w *Client) GetRSAPublicKey(ctx context.Context, bm gopay.BodyMap) (wxRsp *RSAPublicKeyResponse, err error)
- func (w *Client) GetTransferInfo(ctx context.Context, bm gopay.BodyMap) (wxRsp *TransfersInfoResponse, err error)
- func (w *Client) Micropay(ctx context.Context, bm gopay.BodyMap) (wxRsp *MicropayResponse, err error)
- func (w *Client) MultiProfitSharing(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingResponse, err error)
- func (w *Client) PayBank(ctx context.Context, bm gopay.BodyMap) (wxRsp *PayBankResponse, err error)
- func (w *Client) PostWeChatAPISelf(ctx context.Context, bm gopay.BodyMap, path string, tlsConfig *tls.Config) (bs []byte, err error)
- func (w *Client) ProfitSharing(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingResponse, err error)
- func (w *Client) ProfitSharingAddReceiver(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingAddReceiverResponse, err error)
- func (w *Client) ProfitSharingFinish(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingResponse, err error)
- func (w *Client) ProfitSharingQuery(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingQueryResponse, err error)
- func (w *Client) ProfitSharingRemoveReceiver(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingAddReceiverResponse, err error)
- func (w *Client) ProfitSharingReturn(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingReturnResponse, err error)
- func (w *Client) ProfitSharingReturnQuery(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingReturnResponse, err error)
- func (w *Client) QueryBank(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryBankResponse, err error)
- func (w *Client) QueryOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryOrderResponse, resBm gopay.BodyMap, err error)
- func (w *Client) QueryRedRecord(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryRedRecordResponse, err error)
- func (w *Client) QueryRefund(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryRefundResponse, resBm gopay.BodyMap, err error)
- func (w *Client) Refund(ctx context.Context, bm gopay.BodyMap) (wxRsp *RefundResponse, resBm gopay.BodyMap, err error)
- func (w *Client) Report(ctx context.Context, bm gopay.BodyMap) (wxRsp *ReportResponse, err error)
- func (w *Client) Reverse(ctx context.Context, bm gopay.BodyMap) (wxRsp *ReverseResponse, err error)
- func (w *Client) SendAppletRed(ctx context.Context, bm gopay.BodyMap) (wxRsp *SendAppletRedResponse, err error)
- func (w *Client) SendCashRed(ctx context.Context, bm gopay.BodyMap) (wxRsp *SendCashRedResponse, err error)
- func (w *Client) SendGroupCashRed(ctx context.Context, bm gopay.BodyMap) (wxRsp *SendCashRedResponse, err error)
- func (w *Client) SetBodySize(sizeMB int)
- func (w *Client) SetCountry(country Country) (client *Client)
- func (w *Client) Transfer(ctx context.Context, bm gopay.BodyMap) (wxRsp *TransfersResponse, err error)
- func (w *Client) UnifiedOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *UnifiedOrderResponse, err error)
- type CloseOrderResponse
- type Country
- type CustomsDeclareOrderResponse
- type CustomsDeclareQueryResponse
- type CustomsReDeclareOrderResponse
- type EntrustAppPreResponse
- type EntrustH5Response
- type EntrustPayingResponse
- type EntrustPublicResponse
- type MicropayResponse
- type NotifyRequest
- type NotifyResponse
- type Oauth2AccessToken
- type Oauth2UserInfo
- type OpenIdByAuthCodeRsp
- type PaidUnionId
- type PayBankResponse
- type ProfitSharingAddReceiverResponse
- type ProfitSharingQueryResponse
- type ProfitSharingResponse
- type ProfitSharingReturnResponse
- type PublicOpenids
- type PublicUserInfo
- type PublicUserInfoBatch
- type QueryBankResponse
- type QueryOrderResponse
- type QueryRedRecordResponse
- type QueryRefundResponse
- type RSAPublicKeyResponse
- type RefundNotify
- type RefundNotifyRequest
- type RefundResponse
- type ReportResponse
- type ReverseResponse
- type SendAppletRedResponse
- type SendCashRedResponse
- type TransfersInfoResponse
- type TransfersResponse
- type UnifiedOrderResponse
- type UserPhone
Constants ¶
const ( // 境外国家地区 China Country = 1 // 中国国内 China2 Country = 2 // 中国国内(冗灾方案) SoutheastAsia Country = 3 // 东南亚 Other Country = 4 // 其他国家 // 支付类型 TradeType_Mini = "JSAPI" // 小程序支付 TradeType_JsApi = "JSAPI" // JSAPI支付 TradeType_App = "APP" // app支付 TradeType_H5 = "MWEB" // H5支付 TradeType_Native = "NATIVE" // Native支付 // 签名方式 SignType_MD5 = "MD5" SignType_HMAC_SHA256 = "HMAC-SHA256" )
Variables ¶
This section is empty.
Functions ¶
func GetAppPaySign ¶
func GetAppPaySign(appid, partnerid, noncestr, prepayid, signType, timestamp, apiKey string) (paySign string)
GetAppPaySign APP支付,统一下单获取支付参数后,再次计算APP支付所需要的的sign appId:APPID partnerid:partnerid nonceStr:随即字符串 prepayId:统一下单成功后得到的值 signType:此处签名方式,务必与统一下单时用的签名方式一致 timeStamp:时间 ApiKey:API秘钥值 文档:https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12&index=2
func GetH5PaySign ¶
Deprecated 微信内H5支付官方文档:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6
func GetJsapiPaySign ¶
func GetJsapiPaySign(appId, nonceStr, packages, signType, timeStamp, apiKey string) (paySign string)
GetJsapiPaySign JSAPI调起支付,统一下单获取支付参数后,再次计算出微信内H5支付需要用的paySign appId:APPID nonceStr:随即字符串 packages:统一下单成功后拼接得到的值 signType:签名类型 timeStamp:时间 ApiKey:API秘钥值 文档:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6
func GetMiniPaySign ¶
GetMiniPaySign JSAPI支付,统一下单获取支付参数后,再次计算出小程序用的paySign appId:APPID nonceStr:随即字符串 packages:统一下单成功后拼接得到的值 signType:签名类型 timeStamp:时间 ApiKey:API秘钥值 微信小程序支付API:https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html 微信小程序支付PaySign计算文档:https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3
func GetParamSign ¶
Deprecated GetParamSign 获取微信支付所需参数里的Sign值(通过支付参数计算Sign值) 注意:BodyMap中如无 sign_type 参数,默认赋值 sign_type 为 MD5 appId:应用ID mchId:商户ID ApiKey:API秘钥值 返回参数 sign:通过Appid、MchId、ApiKey和BodyMap中的参数计算出的Sign值
func GetReleaseSign ¶ added in v1.5.65
获取微信支付正式环境Sign值
func GetSanBoxParamSign ¶
func GetSanBoxParamSign(ctx context.Context, appId, mchId, apiKey string, bm gopay.BodyMap) (sign string, err error)
Deprecated GetSanBoxParamSign 获取微信支付沙箱环境所需参数里的Sign值(通过支付参数计算Sign值) 注意:沙箱环境默认 sign_type 为 MD5 appId:应用ID mchId:商户ID ApiKey:API秘钥值 返回参数 sign:通过Appid、MchId、ApiKey和BodyMap中的参数计算出的Sign值
func GetSandBoxSign ¶ added in v1.5.65
func GetSandBoxSign(ctx context.Context, mchId, apiKey string, bm gopay.BodyMap) (sign string, err error)
获取微信支付沙箱环境Sign值
func ParseNotifyToBodyMap ¶
ParseNotifyToBodyMap 解析微信支付异步通知的结果到BodyMap(推荐) req:*http.Request 返回参数bm:Notify请求的参数 返回参数err:错误信息
func VerifySign ¶
VerifySign 微信同步返回参数验签或异步通知参数验签 ApiKey:API秘钥值 signType:签名类型(调用API方法时填写的类型) bean:微信同步返回的结构体 wxRsp 或 异步通知解析的结构体 notifyReq,推荐通 BodyMap 验签 返回参数ok:是否验签通过 返回参数err:其他错误信息,不要根据 error 是否为空来判断验签正确与否,需再单独判断返回的 ok
Types ¶
type AccessToken ¶
type AppletUserInfo ¶
type AppletUserInfo struct { OpenId string `json:"openId,omitempty"` NickName string `json:"nickName,omitempty"` Gender int `json:"gender,omitempty"` City string `json:"city,omitempty"` Province string `json:"province,omitempty"` Country string `json:"country,omitempty"` AvatarUrl string `json:"avatarUrl,omitempty"` UnionId string `json:"unionId,omitempty"` Watermark *watermarkInfo `json:"watermark,omitempty"` }
微信小程序解密后 用户信息结构体
type AuthCodeToOpenIdResponse ¶
type AuthCodeToOpenIdResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` }
type CheckAccessTokenRsp ¶
type CheckAccessTokenRsp struct { Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
func CheckOauth2AccessToken ¶
func CheckOauth2AccessToken(ctx context.Context, accessToken, openid string) (result *CheckAccessTokenRsp, err error)
CheckOauth2AccessToken 检验授权凭证(access_token)是否有效 accessToken:调用接口凭证 openid:普通用户标识,对该公众帐号唯一,获取 access_token 是获取的 文档:https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Authorized_API_call_UnionID.html
type Client ¶
type Client struct { AppId string MchId string ApiKey string BaseURL string IsProd bool DebugSwitch gopay.DebugSwitch Certificate *tls.Certificate // contains filtered or unexported fields }
func (*Client) AddCertPemFileContent ¶
添加微信pem证书内容[]byte certFileContent:apiclient_cert.pem 证书内容[]byte keyFileContent:apiclient_key.pem 证书内容[]byte
func (*Client) AddCertPemFilePath ¶
添加微信pem证书文件路径 certFilePath:apiclient_cert.pem 文件路径 keyFilePath:apiclient_key.pem 文件路径
func (*Client) AddCertPkcs12FileContent ¶
添加微信pkcs12证书内容[]byte p12FileContent:apiclient_cert.p12 证书内容[]byte
func (*Client) AddCertPkcs12FilePath ¶
添加微信pkcs12证书文件路径 pkcs12FilePath:apiclient_cert.p12 文件路径
func (*Client) AuthCodeToOpenId ¶
func (w *Client) AuthCodeToOpenId(ctx context.Context, bm gopay.BodyMap) (wxRsp *AuthCodeToOpenIdResponse, err error)
授权码查询openid(正式) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter4_8.shtml
func (*Client) BatchQueryComment ¶
拉取订单评价数据(正式) 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 不支持沙箱环境,因为沙箱环境默认需要用MD5签名,但是此接口仅支持HMAC-SHA256签名 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_11.shtml
func (*Client) CloseOrder ¶
func (w *Client) CloseOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *CloseOrderResponse, err error)
关闭订单 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_3.shtml
func (*Client) CustomsDeclareOrder ¶ added in v1.5.49
func (w *Client) CustomsDeclareOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *CustomsDeclareOrderResponse, err error)
订单附加信息提交(正式环境) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_1
func (*Client) CustomsDeclareQuery ¶ added in v1.5.49
func (w *Client) CustomsDeclareQuery(ctx context.Context, bm gopay.BodyMap) (wxRsp *CustomsDeclareQueryResponse, err error)
订单附加信息查询(正式环境) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_2
func (*Client) CustomsReDeclareOrder ¶ added in v1.5.49
func (w *Client) CustomsReDeclareOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *CustomsReDeclareOrderResponse, err error)
订单附加信息重推(正式环境) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/external/declarecustom.php?chapter=18_4&index=3
func (*Client) DownloadBill ¶
下载对账单 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_6.shtml
func (*Client) DownloadFundFlow ¶
下载资金账单(正式) 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 不支持沙箱环境,因为沙箱环境默认需要用MD5签名,但是此接口仅支持HMAC-SHA256签名 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_7.shtml
func (*Client) EntrustAppPre ¶
func (w *Client) EntrustAppPre(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustAppPreResponse, err error)
APP纯签约-预签约接口-获取预签约ID(正式) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_2.shtml
func (*Client) EntrustH5 ¶
func (w *Client) EntrustH5(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustH5Response, err error)
H5纯签约(正式) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_4.shtml
func (*Client) EntrustPaying ¶
func (w *Client) EntrustPaying(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustPayingResponse, err error)
支付中签约(正式) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_5.shtml
func (*Client) EntrustPublic ¶
func (w *Client) EntrustPublic(ctx context.Context, bm gopay.BodyMap) (wxRsp *EntrustPublicResponse, err error)
公众号纯签约(正式) 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_1.shtml
func (*Client) GetRSAPublicKey ¶
func (w *Client) GetRSAPublicKey(ctx context.Context, bm gopay.BodyMap) (wxRsp *RSAPublicKeyResponse, err error)
获取RSA加密公钥API(正式) 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_7&index=4
func (*Client) GetTransferInfo ¶
func (w *Client) GetTransferInfo(ctx context.Context, bm gopay.BodyMap) (wxRsp *TransfersInfoResponse, err error)
查询企业付款 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 注意:此方法未支持沙箱环境,默认正式环境 文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_3
func (*Client) Micropay ¶
func (w *Client) Micropay(ctx context.Context, bm gopay.BodyMap) (wxRsp *MicropayResponse, err error)
提交付款码支付 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter4_1.shtml
func (*Client) MultiProfitSharing ¶
func (w *Client) MultiProfitSharing(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingResponse, err error)
请求多次分账 微信订单支付成功后,商户发起分账请求,将结算后的钱分到分账接收方。多次分账请求仅会按照传入的分账接收方进行分账,不会对剩余的金额进行任何操作。 故操作成功后,在待分账金额不等于零时,订单依旧能够再次进行分账。 多次分账,可以将本商户作为分账接收方直接传入,实现释放资金给本商户的功能 对同一笔订单最多能发起20次多次分账请求 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 文档地址:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_1&index=1
func (*Client) PayBank ¶
企业付款到银行卡API(正式) 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 注意:此方法未支持沙箱环境,默认正式环境,转账请慎重 注意:enc_bank_no、enc_true_name 两参数,开发者需自行获取RSA公钥,加密后再 Set 到 BodyMap,参考 client_test.go 里的 TestClient_PayBank() 方法 文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_2 RSA加密文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_7 银行编码查看地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_4&index=5
func (*Client) PostWeChatAPISelf ¶
func (w *Client) PostWeChatAPISelf(ctx context.Context, bm gopay.BodyMap, path string, tlsConfig *tls.Config) (bs []byte, err error)
向微信发送Post请求,对于本库未提供的微信API,可自行实现,通过此方法发送请求 bm:请求参数的BodyMap path:接口地址去掉baseURL的path,例如:url为https://api.mch.weixin.qq.com/pay/micropay,只需传 pay/micropay tlsConfig:tls配置,如无需证书请求,传nil
func (*Client) ProfitSharing ¶
func (w *Client) ProfitSharing(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingResponse, err error)
请求单次分账 单次分账请求按照传入的分账接收方账号和资金进行分账, 同时会将订单剩余的待分账金额解冻给本商户。 故操作成功后,订单不能再进行分账,也不能进行分账完结。 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 文档地址:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_1&index=1
func (*Client) ProfitSharingAddReceiver ¶
func (w *Client) ProfitSharingAddReceiver(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingAddReceiverResponse, err error)
添加分账接收方 商户发起添加分账接收方请求,后续可通过发起分账请求将结算后的钱分到该分账接收方。 微信文档:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_3&index=4
func (*Client) ProfitSharingFinish ¶
func (w *Client) ProfitSharingFinish(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingResponse, err error)
完结分账 1、不需要进行分账的订单,可直接调用本接口将订单的金额全部解冻给本商户 2、调用多次分账接口后,需要解冻剩余资金时,调用本接口将剩余的分账金额全部解冻给特约商户 3、已调用请求单次分账后,剩余待分账金额为零,不需要再调用此接口。 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 微信文档:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_5&index=6
func (*Client) ProfitSharingQuery ¶
func (w *Client) ProfitSharingQuery(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingQueryResponse, err error)
查询分账结果 发起分账请求后,可调用此接口查询分账结果;发起分账完结请求后,可调用此接口查询分账完结的执行结果。 微信文档:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_2&index=3
func (*Client) ProfitSharingRemoveReceiver ¶
func (w *Client) ProfitSharingRemoveReceiver(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingAddReceiverResponse, err error)
删除分账接收方 商户发起删除分账接收方请求,删除后不支持将结算后的钱分到该分账接收方 微信文档:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_4&index=5
func (*Client) ProfitSharingReturn ¶
func (w *Client) ProfitSharingReturn(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingReturnResponse, err error)
分账回退 对订单进行退款时,如果订单已经分账,可以先调用此接口将指定的金额从分账接收方(仅限商户类型的分账接收方)回退给本商户,然后再退款。 回退以原分账请求为依据,可以对分给分账接收方的金额进行多次回退,只要满足累计回退不超过该请求中分给接收方的金额。 此接口采用同步处理模式,即在接收到商户请求后,会实时返回处理结果 此功能需要接收方在商户平台-交易中心-分账-分账接收设置下,开启同意分账回退后,才能使用。 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 微信文档:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_7&index=7
func (*Client) ProfitSharingReturnQuery ¶
func (w *Client) ProfitSharingReturnQuery(ctx context.Context, bm gopay.BodyMap) (wxRsp *ProfitSharingReturnResponse, err error)
回退结果查询 商户需要核实回退结果,可调用此接口查询回退结果。 如果分账回退接口返回状态为处理中,可调用此接口查询回退结果 微信文档:https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=27_8&index=8
func (*Client) QueryBank ¶
func (w *Client) QueryBank(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryBankResponse, err error)
查询企业付款到银行卡API(正式) 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_3
func (*Client) QueryOrder ¶
func (w *Client) QueryOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryOrderResponse, resBm gopay.BodyMap, err error)
查询订单 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_2.shtml
func (*Client) QueryRedRecord ¶
func (w *Client) QueryRedRecord(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryRedRecordResponse, err error)
查询红包记录 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 注意:此处参数中的 appid 需要单独传参,不复用 NewClient 时的 appid,bill_type = MCHT 微信文档:https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_6&index=5
func (*Client) QueryRefund ¶
func (w *Client) QueryRefund(ctx context.Context, bm gopay.BodyMap) (wxRsp *QueryRefundResponse, resBm gopay.BodyMap, err error)
查询退款 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_5.shtml
func (*Client) Refund ¶
func (w *Client) Refund(ctx context.Context, bm gopay.BodyMap) (wxRsp *RefundResponse, resBm gopay.BodyMap, err error)
申请退款 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_4.shtml
func (*Client) Report ¶
交易保障 文档地址:(JSAPI)https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_9.shtml 文档地址:(付款码)https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter4_9.shtml 文档地址:(Native)https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter6_9.shtml 文档地址:(APP)https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter7_9.shtml 文档地址:(H5)https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter8_9.shtml 文档地址:(微信小程序)https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter5_9.shtml
func (*Client) Reverse ¶
撤销订单 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter4_3.shtml
func (*Client) SendAppletRed ¶
func (w *Client) SendAppletRed(ctx context.Context, bm gopay.BodyMap) (wxRsp *SendAppletRedResponse, err error)
发放小程序红包 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 注意:此处参数中的 wxappid 需要单独传参,不复用 NewClient 时的 appid,total_num = 1,notify_way = MINI_PROGRAM_JSAPI 微信文档:https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=18_2&index=3
func (*Client) SendCashRed ¶
func (w *Client) SendCashRed(ctx context.Context, bm gopay.BodyMap) (wxRsp *SendCashRedResponse, err error)
发放现金红包 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 注意:此处参数中的 wxappid 需要单独传参,不复用 NewClient 时的 appid,total_num = 1 微信文档:https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_4&index=3
func (*Client) SendGroupCashRed ¶
func (w *Client) SendGroupCashRed(ctx context.Context, bm gopay.BodyMap) (wxRsp *SendCashRedResponse, err error)
发放现金裂变红包 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 注意:此处参数中的 wxappid 需要单独传参,不复用 NewClient 时的 appid,amt_type = ALL_RAND 微信文档:https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5&index=4
func (*Client) SetBodySize ¶ added in v1.5.82
SetBodySize 设置http response body size(MB)
func (*Client) SetCountry ¶
设置支付国家(默认:中国国内) 根据支付地区情况设置国家 country:<China:中国国内,China2:中国国内(冗灾方案),SoutheastAsia:东南亚,Other:其他国家>
func (*Client) Transfer ¶
func (w *Client) Transfer(ctx context.Context, bm gopay.BodyMap) (wxRsp *TransfersResponse, err error)
企业付款(企业向微信用户个人付款) 注意:请在初始化client时,调用 client 添加证书的相关方法添加证书 注意:此方法未支持沙箱环境,默认正式环境,转账请慎重 文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
func (*Client) UnifiedOrder ¶
func (w *Client) UnifiedOrder(ctx context.Context, bm gopay.BodyMap) (wxRsp *UnifiedOrderResponse, err error)
统一下单 文档地址:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/open/chapter3_1.shtml
type CloseOrderResponse ¶
type CloseOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` }
type CustomsDeclareOrderResponse ¶ added in v1.5.49
type CustomsDeclareOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` SignType string `xml:"sign_type,omitempty" json:"sign_type,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` State string `xml:"state,omitempty" json:"state,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` SubOrderNo string `xml:"sub_order_no,omitempty" json:"sub_order_no,omitempty"` SubOrderId string `xml:"sub_order_id,omitempty" json:"sub_order_id,omitempty"` ModifyTime string `xml:"modify_time,omitempty" json:"modify_time,omitempty"` CertCheckResult string `xml:"cert_check_result,omitempty" json:"cert_check_result,omitempty"` VerifyDepartment string `xml:"verify_department,omitempty" json:"verify_department,omitempty"` VerifyDepartmentTradeId string `xml:"verify_department_trade_id,omitempty" json:"verify_department_trade_id,omitempty"` }
type CustomsDeclareQueryResponse ¶ added in v1.5.49
type CustomsDeclareQueryResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` Count string `xml:"count,omitempty" json:"count,omitempty"` SubOrderNo0 string `xml:"sub_order_no_0,omitempty"` SubOrderNo1 string `xml:"sub_order_no_1,omitempty"` SubOrderNo2 string `xml:"sub_order_no_2,omitempty"` SubOrderId0 string `xml:"sub_order_id_0,omitempty"` SubOrderId1 string `xml:"sub_order_id_1,omitempty"` SubOrderId2 string `xml:"sub_order_id_2,omitempty"` MchCustomsNo0 string `xml:"mch_customs_no_0,omitempty"` MchCustomsNo1 string `xml:"mch_customs_no_1,omitempty"` MchCustomsNo2 string `xml:"mch_customs_no_2,omitempty"` Customs0 string `xml:"customs_0,omitempty"` Customs1 string `xml:"customs_1,omitempty"` Customs2 string `xml:"customs_2,omitempty"` FeeType0 string `xml:"fee_type_0,omitempty"` FeeType1 string `xml:"fee_type_1,omitempty"` FeeType2 string `xml:"fee_type_2,omitempty"` OrderFee0 string `xml:"order_fee_0,omitempty"` OrderFee1 string `xml:"order_fee_1,omitempty"` OrderFee2 string `xml:"order_fee_2,omitempty"` Duty0 string `xml:"duty_0,omitempty"` Duty1 string `xml:"duty_1,omitempty"` Duty2 string `xml:"duty_2,omitempty"` TransportFee0 string `xml:"transport_fee_0,omitempty"` TransportFee1 string `xml:"transport_fee_1,omitempty"` TransportFee2 string `xml:"transport_fee_2,omitempty"` ProductFee0 string `xml:"product_fee_0,omitempty"` ProductFee1 string `xml:"product_fee_1,omitempty"` ProductFee2 string `xml:"product_fee_2,omitempty"` State0 string `xml:"state_0,omitempty"` State1 string `xml:"state_1,omitempty"` State2 string `xml:"state_2,omitempty"` Explanation0 string `xml:"explanation_0,omitempty"` Explanation1 string `xml:"explanation_1,omitempty"` Explanation2 string `xml:"explanation_2,omitempty"` ModifyTime0 string `xml:"modify_time_0,omitempty"` ModifyTime1 string `xml:"modify_time_1,omitempty"` ModifyTime2 string `xml:"modify_time_2,omitempty"` CertCheckResult0 string `xml:"cert_check_result_0,omitempty"` CertCheckResult1 string `xml:"cert_check_result_1,omitempty"` CertCheckResult2 string `xml:"cert_check_result_2,omitempty"` VerifyDepartment string `xml:"verify_department,omitempty" json:"verify_department,omitempty"` VerifyDepartmentTradeId string `xml:"verify_department_trade_id,omitempty" json:"verify_department_trade_id,omitempty"` }
type CustomsReDeclareOrderResponse ¶ added in v1.5.49
type CustomsReDeclareOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` SignType string `xml:"sign_type,omitempty" json:"sign_type,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` State string `xml:"state,omitempty" json:"state,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` SubOrderNo string `xml:"sub_order_no,omitempty" json:"sub_order_no,omitempty"` SubOrderId string `xml:"sub_order_id,omitempty" json:"sub_order_id,omitempty"` ModifyTime string `xml:"modify_time,omitempty" json:"modify_time,omitempty"` Explanation string `xml:"explanation,omitempty" json:"explanation,omitempty"` }
type EntrustAppPreResponse ¶
type EntrustAppPreResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` PreEntrustwebId string `xml:"pre_entrustweb_id,omitempty" json:"pre_entrustweb_id,omitempty"` }
type EntrustH5Response ¶
type EntrustH5Response struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ResultMsg string `xml:"result_msg,omitempty" json:"result_msg,omitempty"` RedirectUrl string `xml:"redirect_url,omitempty" json:"redirect_url,omitempty"` }
type EntrustPayingResponse ¶
type EntrustPayingResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` ContractResultCode string `xml:"contract_result_code,omitempty" json:"contract_result_code,omitempty"` ContractErrCode string `xml:"contract_err_code,omitempty" json:"contract_err_code,omitempty"` ContractErrCodeDes string `xml:"contract_err_code_des,omitempty" json:"contract_err_code_des,omitempty"` PrepayId string `xml:"prepay_id,omitempty" json:"prepay_id,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` CodeUrl string `xml:"code_url,omitempty" json:"code_url,omitempty"` PlanId string `xml:"plan_id,omitempty" json:"plan_id,omitempty"` RequestSerial string `xml:"request_serial,omitempty" json:"request_serial,omitempty"` ContractCode string `xml:"contract_code,omitempty" json:"contract_code,omitempty"` ContractDisplayAccount string `xml:"contract_display_account,omitempty" json:"contract_display_account,omitempty"` MwebUrl string `xml:"mweb_url,omitempty" json:"mweb_url,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` }
type EntrustPublicResponse ¶
type EntrustPublicResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ResultMsg string `xml:"result_msg,omitempty" json:"result_msg,omitempty"` }
type MicropayResponse ¶
type MicropayResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` IsSubscribe string `xml:"is_subscribe,omitempty" json:"is_subscribe,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` PromotionDetail string `xml:"promotion_detail,omitempty" json:"promotion_detail,omitempty"` }
type NotifyRequest ¶
type NotifyRequest struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` SignType string `xml:"sign_type,omitempty" json:"sign_type,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` IsSubscribe string `xml:"is_subscribe,omitempty" json:"is_subscribe,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CouponCount string `xml:"coupon_count,omitempty" json:"coupon_count,omitempty"` CouponType0 string `xml:"coupon_type_0,omitempty" json:"coupon_type_0,omitempty"` CouponType1 string `xml:"coupon_type_1,omitempty" json:"coupon_type_1,omitempty"` CouponType2 string `xml:"coupon_type_2,omitempty" json:"coupon_type_2,omitempty"` CouponId0 string `xml:"coupon_id_0,omitempty" json:"coupon_id_0,omitempty"` CouponId1 string `xml:"coupon_id_1,omitempty" json:"coupon_id_1,omitempty"` CouponId2 string `xml:"coupon_id_2,omitempty" json:"coupon_id_2,omitempty"` CouponFee0 string `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"` CouponFee1 string `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,omitempty"` CouponFee2 string `xml:"coupon_fee_2,omitempty" json:"coupon_fee_2,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` }
Notify
func ParseNotify ¶
func ParseNotify(req *http.Request) (notifyReq *NotifyRequest, err error)
Deprecated 推荐使用 ParseNotifyToBodyMap
type NotifyResponse ¶
type NotifyResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` }
func (*NotifyResponse) ToXmlString ¶
func (w *NotifyResponse) ToXmlString() (xmlStr string)
ToXmlString 返回数据给微信
type Oauth2AccessToken ¶
type Oauth2AccessToken struct { AccessToken string `json:"access_token,omitempty"` ExpiresIn int `json:"expires_in,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` Openid string `json:"openid,omitempty"` Scope string `json:"scope,omitempty"` Unionid string `json:"unionid,omitempty"` Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
获取开放平台,access_token 返回结构体
func GetOauth2AccessToken ¶
func GetOauth2AccessToken(ctx context.Context, appId, appSecret, code string) (accessToken *Oauth2AccessToken, err error)
GetOauth2AccessToken 微信第三方登录,code 换取 access_token appId:应用唯一标识,在微信开放平台提交应用审核通过后获得 appSecret:应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 code:App用户换取access_token的code 文档:https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Development_Guide.html
func RefreshOauth2AccessToken ¶
func RefreshOauth2AccessToken(ctx context.Context, appId, refreshToken string) (accessToken *Oauth2AccessToken, err error)
RefreshOauth2AccessToken 刷新微信第三方登录后,获取到的 access_token appId:应用唯一标识,在微信开放平台提交应用审核通过后获得 refreshToken:填写通过获取 access_token 获取到的 refresh_token 参数 文档:https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Development_Guide.html
type Oauth2UserInfo ¶
type Oauth2UserInfo struct { Openid string `json:"openid,omitempty"` // 普通用户的标识,对当前开发者帐号唯一 Nickname string `json:"nickname,omitempty"` // 普通用户昵称 Sex int `json:"sex,omitempty"` // 普通用户性别,1为男性,2为女性 City string `json:"city,omitempty"` // 普通用户个人资料填写的城市 Province string `json:"province,omitempty"` // 普通用户个人资料填写的省份 Country string `json:"country,omitempty"` // 国家,如中国为CN Headimgurl string `json:"headimgurl,omitempty"` // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。 Privilege []string `json:"privilege,omitempty"` // 用户特权信息,json数组,如微信沃卡用户为(chinaunicom) Unionid string `json:"unionid,omitempty"` // 用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。 }
微信开放平台用户信息
func GetOauth2UserInfo ¶
func GetOauth2UserInfo(ctx context.Context, accessToken, openId string, lang ...string) (userInfo *Oauth2UserInfo, err error)
GetOauth2UserInfo 微信开放平台:获取用户个人信息 accessToken:接口调用凭据 openId:用户的OpenID lang:默认为 zh_CN ,可选填 zh_CN 简体,zh_TW 繁体,en 英语 文档:https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Authorized_API_call_UnionID.html
type OpenIdByAuthCodeRsp ¶
type OpenIdByAuthCodeRsp struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` // 用户唯一标识 }
授权码查询openid 返回
func GetOpenIdByAuthCode ¶
func GetOpenIdByAuthCode(ctx context.Context, appId, mchId, apiKey, authCode, nonceStr string) (openIdRsp *OpenIdByAuthCodeRsp, err error)
GetOpenIdByAuthCode 授权码查询openid(AccessToken:157字符) appId:APPID mchId:商户号 ApiKey:apiKey authCode:用户授权码 nonceStr:随即字符串 文档:https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_13&index=9
type PaidUnionId ¶
type PayBankResponse ¶
type PayBankResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` PartnerTradeNo string `xml:"partner_trade_no,omitempty" json:"partner_trade_no,omitempty"` Amount string `xml:"amount,omitempty" json:"amount,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` PaymentNo string `xml:"payment_no,omitempty" json:"payment_no,omitempty"` CmmsAmt string `xml:"cmms_amt,omitempty" json:"cmms_amt,omitempty"` }
type ProfitSharingAddReceiverResponse ¶
type ProfitSharingAddReceiverResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` // 返回状态码 SUCCESS/FAIL 此字段是通信标识,非交易标识 ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` // 返回信息,如非空,为错误原因 //以下字段在return_code为SUCCESS的时候有返回 ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` // 业务结果 SUCCESS:分账申请接收成功,结果通过分账查询接口查询 FAIL :提交业务失败 ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` // 错误代码 ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` // 错误代码描述 Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` // 随机字符串 Sign string `xml:"sign,omitempty" json:"sign,omitempty"` // 签名 Receiver string `xml:"receiver,omitempty" json:"receiver,omitempty"` // 接收方 }
ProfitSharingAddReceiverResponse 添加分账接收者结果
type ProfitSharingQueryResponse ¶
type ProfitSharingQueryResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` // 返回状态码 SUCCESS/FAIL 此字段是通信标识,非交易标识 ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` // 返回信息,如非空,为错误原因 ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` // 业务结果 SUCCESS:分账申请接收成功,结果通过分账查询接口查询 FAIL :提交业务失败 ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` // 错误代码 ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` // 错误代码描述 MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` // 商户号 NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` // 随机字符串 Sign string `xml:"sign,omitempty" json:"sign,omitempty"` // 签名 TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` // 微信订单号 OutOrderNo string `xml:"out_order_no,omitempty" json:"out_order_no,omitempty"` // 商户分账单号 OrderId string `xml:"order_id,omitempty" json:"order_id,omitempty"` // 微信分账单号 Status string `xml:"status,omitempty" json:"status,omitempty"` // 分账单状态 ACCEPTED—受理成功 PROCESSING—处理中 FINISHED—处理完成 CLOSED—处理失败,已关单 CloseReason string `xml:"close_reason,omitempty" json:"close_reason,omitempty"` // 关单原因 NO_AUTH:分账授权已解除 Receivers string `xml:"receivers,omitempty" json:"receivers,omitempty"` }
ProfitSharingQueryResponse 查询分账结果
type ProfitSharingResponse ¶
type ProfitSharingResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` // 返回状态码 SUCCESS/FAIL 此字段是通信标识,非交易标识 ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` // 返回信息,如非空,为错误原因 //以下字段在return_code为SUCCESS的时候有返回 ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` // 业务结果 SUCCESS:分账申请接收成功,结果通过分账查询接口查询 FAIL :提交业务失败 ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` // 错误代码 ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` // 错误代码描述 Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` // 随机字符串 Sign string `xml:"sign,omitempty" json:"sign,omitempty"` // 签名 TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` // 微信订单号 OutOrderNo string `xml:"out_order_no,omitempty" json:"out_order_no,omitempty"` // 商户分账单号 OrderId string `xml:"order_id,omitempty" json:"order_id,omitempty"` // 微信分账单号 }
ProfitSharingResponse 请求分账返回结果
type ProfitSharingReturnResponse ¶
type ProfitSharingReturnResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` // 返回状态码 SUCCESS/FAIL 此字段是通信标识,非交易标识 ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` // 错误代码 ErrorMsg string `xml:"error_msg,omitempty" json:"error_msg,omitempty"` // 返回信息 如果返回状态码为FAIL,则本字段存在,且为失败的错误信息 ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` // 错误代码描述 Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` // 调用接口提供的公众账号ID NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` // 随机字符串 Sign string `xml:"sign,omitempty" json:"sign,omitempty"` // 签名 OrderId string `xml:"order_id,omitempty" json:"order_id,omitempty"` // 微信分账单号 OutOrderNo string `xml:"out_order_no,omitempty" json:"out_order_no,omitempty"` // 商户分账单号 OutReturnNo string `xml:"out_return_no,omitempty" json:"out_return_no,omitempty"` // 商户回退单号 调用接口提供的商户系统内部的回退单号 ReturnNo string `xml:"return_no,omitempty" json:"return_no,omitempty"` // 微信回退单号 微信分账回退单号,微信系统返回的唯一标识 ReturnAccountType string `xml:"return_account_type,omitempty" json:"return_account_type,omitempty"` // 回退方类型 ReturnAccount string `xml:"return_account,omitempty" json:"return_account,omitempty"` // 回退方账号 ReturnAmount string `xml:"return_amount,omitempty" json:"return_amount,omitempty"` // 回退金额 Description string `xml:"description,omitempty" json:"description,omitempty"` // 退回描述 Result string `xml:"result,omitempty" json:"result,omitempty"` // 退回结果 FailReason string `xml:"fail_reason,omitempty" json:"fail_reason,omitempty"` // 失败原因 FinishTime string `xml:"finish_time,omitempty" json:"finish_time,omitempty"` // 完成时间 }
ProfitSharingReturnResponse 分账退回响应结果
type PublicOpenids ¶
type PublicUserInfo ¶
type PublicUserInfo struct { Subscribe int `json:"subscribe,omitempty"` // 用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息。 Openid string `json:"openid,omitempty"` // 用户唯一标识 Nickname string `json:"nickname,omitempty"` // 用户的昵称 Sex int `json:"sex,omitempty"` // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知 City string `json:"city,omitempty"` // 用户所在城市 Province string `json:"province,omitempty"` // 用户所在省份 Country string `json:"country,omitempty"` // 用户所在国家 Language string `json:"language,omitempty"` // 用户的语言,简体中文为zh_CN Headimgurl string `json:"headimgurl,omitempty"` // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空。若用户更换头像,原有头像URL将失效。 SubscribeTime int `json:"subscribe_time,omitempty"` // 用户关注时间,为时间戳。如果用户曾多次关注,则取最后关注时间 Unionid string `json:"unionid,omitempty"` // 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段。 Remark string `json:"remark,omitempty"` // 公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注 Groupid int `json:"groupid,omitempty"` // 用户所在的分组ID(兼容旧的用户分组接口) TagidList []int `json:"tagid_list,omitempty"` // 用户被打上的标签ID列表 SubscribeScene string `json:"subscribe_scene,omitempty"` // 返回用户关注的渠道来源,ADD_SCENE_SEARCH 公众号搜索,ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移,ADD_SCENE_PROFILE_CARD 名片分享,ADD_SCENE_QR_CODE 扫描二维码,ADD_SCENEPROFILE LINK 图文页内名称点击,ADD_SCENE_PROFILE_ITEM 图文页右上角菜单,ADD_SCENE_PAID 支付后关注,ADD_SCENE_OTHERS 其他 QrScene int `json:"qr_scene,omitempty"` // 二维码扫码场景(开发者自定义) QrSceneStr string `json:"qr_scene_str,omitempty"` // 二维码扫码场景描述(开发者自定义) Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
微信公众号用户信息
type PublicUserInfoBatch ¶
type PublicUserInfoBatch struct {
UserInfoList []*PublicUserInfo `json:"user_info_list"`
}
type QueryBankResponse ¶
type QueryBankResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` PartnerTradeNo string `xml:"partner_trade_no,omitempty" json:"partner_trade_no,omitempty"` PaymentNo string `xml:"payment_no,omitempty" json:"payment_no,omitempty"` BankNoMd5 string `xml:"bank_no_md5,omitempty" json:"bank_no_md5,omitempty"` TrueNameMd5 string `xml:"true_name_md5,omitempty" json:"true_name_md5,omitempty"` Amount string `xml:"amount,omitempty" json:"amount,omitempty"` Status string `xml:"status,omitempty" json:"status,omitempty"` CmmsAmt string `xml:"cmms_amt,omitempty" json:"cmms_amt,omitempty"` CreateTime string `xml:"create_time,omitempty" json:"create_time,omitempty"` PaySuccTime string `xml:"pay_succ_time,omitempty" json:"pay_succ_time,omitempty"` Reason string `xml:"reason,omitempty" json:"reason,omitempty"` }
type QueryOrderResponse ¶
type QueryOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` IsSubscribe string `xml:"is_subscribe,omitempty" json:"is_subscribe,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` TradeState string `xml:"trade_state,omitempty" json:"trade_state,omitempty"` BankType string `xml:"bank_type,omitempty" json:"bank_type,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CouponFee string `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CouponCount string `xml:"coupon_count,omitempty" json:"coupon_count,omitempty"` CouponType0 string `xml:"coupon_type_0,omitempty" json:"coupon_type_0,omitempty"` CouponType1 string `xml:"coupon_type_1,omitempty" json:"coupon_type_1,omitempty"` CouponType2 string `xml:"coupon_type_2,omitempty" json:"coupon_type_2,omitempty"` CouponId0 string `xml:"coupon_id_0,omitempty" json:"coupon_id_0,omitempty"` CouponId1 string `xml:"coupon_id_1,omitempty" json:"coupon_id_1,omitempty"` CouponId2 string `xml:"coupon_id_2,omitempty" json:"coupon_id_2,omitempty"` CouponFee0 string `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"` CouponFee1 string `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,omitempty"` CouponFee2 string `xml:"coupon_fee_2,omitempty" json:"coupon_fee_2,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` Attach string `xml:"attach,omitempty" json:"attach,omitempty"` TimeEnd string `xml:"time_end,omitempty" json:"time_end,omitempty"` TradeStateDesc string `xml:"trade_state_desc,omitempty" json:"trade_state_desc,omitempty"` }
type QueryRedRecordResponse ¶
type QueryRedRecordResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` MchBillno string `xml:"mch_billno,omitempty" json:"mch_billno,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` DetailId string `xml:"detail_id,omitempty" json:"detail_id,omitempty"` Status string `xml:"status,omitempty" json:"status,omitempty"` SendType string `xml:"send_type,omitempty" json:"send_type,omitempty"` HbType string `xml:"hb_type,omitempty" json:"hb_type,omitempty"` TotalNum string `xml:"total_num,omitempty" json:"total_num,omitempty"` TotalAmount string `xml:"total_amount,omitempty" json:"total_amount,omitempty"` Reason string `xml:"reason,omitempty" json:"reason,omitempty"` SendTime string `xml:"send_time,omitempty" json:"send_time,omitempty"` RefundTime string `xml:"refund_time,omitempty" json:"refund_time,omitempty"` RefundAmount string `xml:"refund_amount,omitempty" json:"refund_amount,omitempty"` Wishing string `xml:"wishing,omitempty" json:"wishing,omitempty"` Remark string `xml:"remark,omitempty" json:"remark,omitempty"` ActName string `xml:"act_name,omitempty" json:"act_name,omitempty"` Hblist *hbList `xml:"hblist,omitempty" json:"hblist,omitempty"` }
type QueryRefundResponse ¶
type QueryRefundResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` TotalRefundCount string `xml:"total_refund_count,omitempty" json:"total_refund_count,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` RefundCount string `xml:"refund_count,omitempty" json:"refund_count,omitempty"` OutRefundNo0 string `xml:"out_refund_no_0,omitempty" json:"out_refund_no_0,omitempty"` OutRefundNo1 string `xml:"out_refund_no_1,omitempty" json:"out_refund_no_1,omitempty"` OutRefundNo2 string `xml:"out_refund_no_2,omitempty" json:"out_refund_no_2,omitempty"` RefundId0 string `xml:"refund_id_0,omitempty" json:"refund_id_0,omitempty"` RefundId1 string `xml:"refund_id_1,omitempty" json:"refund_id_1,omitempty"` RefundId2 string `xml:"refund_id_2,omitempty" json:"refund_id_2,omitempty"` RefundChannel0 string `xml:"refund_channel_0,omitempty" json:"refund_channel_0,omitempty"` RefundChannel1 string `xml:"refund_channel_1,omitempty" json:"refund_channel_1,omitempty"` RefundChannel2 string `xml:"refund_channel_2,omitempty" json:"refund_channel_2,omitempty"` RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` RefundFee0 string `xml:"refund_fee_0,omitempty" json:"refund_fee_0,omitempty"` RefundFee1 string `xml:"refund_fee_1,omitempty" json:"refund_fee_1,omitempty"` RefundFee2 string `xml:"refund_fee_2,omitempty" json:"refund_fee_2,omitempty"` SettlementRefundFee0 string `xml:"settlement_refund_fee_0,omitempty" json:"settlement_refund_fee_0,omitempty"` SettlementRefundFee1 string `xml:"settlement_refund_fee_1,omitempty" json:"settlement_refund_fee_1,omitempty"` SettlementRefundFee2 string `xml:"settlement_refund_fee_2,omitempty" json:"settlement_refund_fee_2,omitempty"` CouponType00 string `xml:"coupon_type_0_0,omitempty" json:"coupon_type_0_0,omitempty"` CouponType01 string `xml:"coupon_type_0_1,omitempty" json:"coupon_type_0_1,omitempty"` CouponType10 string `xml:"coupon_type_1_0,omitempty" json:"coupon_type_1_0,omitempty"` CouponType11 string `xml:"coupon_type_1_1,omitempty" json:"coupon_type_1_1,omitempty"` CouponType20 string `xml:"coupon_type_2_0,omitempty" json:"coupon_type_2_0,omitempty"` CouponType21 string `xml:"coupon_type_2_1,omitempty" json:"coupon_type_2_1,omitempty"` CouponType22 string `xml:"coupon_type_2_2,omitempty" json:"coupon_type_2_2,omitempty"` CouponRefundFee0 string `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"` CouponRefundFee1 string `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"` CouponRefundFee2 string `xml:"coupon_refund_fee_2,omitempty" json:"coupon_refund_fee_2,omitempty"` CouponRefundCount0 string `xml:"coupon_refund_count_0,omitempty" json:"coupon_refund_count_0,omitempty"` CouponRefundCount1 string `xml:"coupon_refund_count_1,omitempty" json:"coupon_refund_count_1,omitempty"` CouponRefundCount2 string `xml:"coupon_refund_count_2,omitempty" json:"coupon_refund_count_2,omitempty"` CouponRefundId00 string `xml:"coupon_refund_id_0_0,omitempty" json:"coupon_refund_id_0_0,omitempty"` CouponRefundId01 string `xml:"coupon_refund_id_0_1,omitempty" json:"coupon_refund_id_0_1,omitempty"` CouponRefundId10 string `xml:"coupon_refund_id_1_0,omitempty" json:"coupon_refund_id_1_0,omitempty"` CouponRefundId11 string `xml:"coupon_refund_id_1_1,omitempty" json:"coupon_refund_id_1_1,omitempty"` CouponRefundId20 string `xml:"coupon_refund_id_2_0,omitempty" json:"coupon_refund_id_2_0,omitempty"` CouponRefundId21 string `xml:"coupon_refund_id_2_1,omitempty" json:"coupon_refund_id_2_1,omitempty"` CouponRefundId22 string `xml:"coupon_refund_id_2_2,omitempty" json:"coupon_refund_id_2_2,omitempty"` CouponRefundFee00 string `xml:"coupon_refund_fee_0_0,omitempty" json:"coupon_refund_fee_0_0,omitempty"` CouponRefundFee01 string `xml:"coupon_refund_fee_0_1,omitempty" json:"coupon_refund_fee_0_1,omitempty"` CouponRefundFee10 string `xml:"coupon_refund_fee_1_0,omitempty" json:"coupon_refund_fee_1_0,omitempty"` CouponRefundFee11 string `xml:"coupon_refund_fee_1_1,omitempty" json:"coupon_refund_fee_1_1,omitempty"` CouponRefundFee20 string `xml:"coupon_refund_fee_2_0,omitempty" json:"coupon_refund_fee_2_0,omitempty"` CouponRefundFee21 string `xml:"coupon_refund_fee_2_1,omitempty" json:"coupon_refund_fee_2_1,omitempty"` CouponRefundFee22 string `xml:"coupon_refund_fee_2_2,omitempty" json:"coupon_refund_fee_2_2,omitempty"` RefundStatus0 string `xml:"refund_status_0,omitempty" json:"refund_status_0,omitempty"` RefundStatus1 string `xml:"refund_status_1,omitempty" json:"refund_status_1,omitempty"` RefundStatus2 string `xml:"refund_status_2,omitempty" json:"refund_status_2,omitempty"` RefundAccount0 string `xml:"refund_account_0,omitempty" json:"refund_account_0,omitempty"` RefundAccount1 string `xml:"refund_account_1,omitempty" json:"refund_account_1,omitempty"` RefundAccount2 string `xml:"refund_account_2,omitempty" json:"refund_account_2,omitempty"` RefundRecvAccout0 string `xml:"refund_recv_accout_0,omitempty" json:"refund_recv_accout_0,omitempty"` RefundRecvAccout1 string `xml:"refund_recv_accout_1,omitempty" json:"refund_recv_accout_1,omitempty"` RefundRecvAccout2 string `xml:"refund_recv_accout_2,omitempty" json:"refund_recv_accout_2,omitempty"` RefundSuccessTime0 string `xml:"refund_success_time_0,omitempty" json:"refund_success_time_0,omitempty"` RefundSuccessTime1 string `xml:"refund_success_time_1,omitempty" json:"refund_success_time_1,omitempty"` RefundSuccessTime2 string `xml:"refund_success_time_2,omitempty" json:"refund_success_time_2,omitempty"` }
type RSAPublicKeyResponse ¶
type RSAPublicKeyResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` PubKey string `xml:"pub_key,omitempty" json:"pub_key,omitempty"` }
type RefundNotify ¶
type RefundNotify struct { TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` RefundId string `xml:"refund_id,omitempty" json:"refund_id,omitempty"` OutRefundNo string `xml:"out_refund_no,omitempty" json:"out_refund_no,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` SettlementRefundFee string `xml:"settlement_refund_fee,omitempty" json:"settlement_refund_fee,omitempty"` RefundStatus string `xml:"refund_status,omitempty" json:"refund_status,omitempty"` SuccessTime string `xml:"success_time,omitempty" json:"success_time,omitempty"` RefundRecvAccout string `xml:"refund_recv_accout,omitempty" json:"refund_recv_accout,omitempty"` RefundAccount string `xml:"refund_account,omitempty" json:"refund_account,omitempty"` RefundRequestSource string `xml:"refund_request_source,omitempty" json:"refund_request_source,omitempty"` }
func DecryptRefundNotifyReqInfo ¶
func DecryptRefundNotifyReqInfo(reqInfo, apiKey string) (refundNotify *RefundNotify, err error)
DecryptRefundNotifyReqInfo 解密微信退款异步通知的加密数据 reqInfo:gopay.ParseRefundNotify() 方法获取的加密数据 req_info apiKey:API秘钥值 返回参数refundNotify:RefundNotify请求的加密数据 返回参数err:错误信息 文档:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=10
type RefundNotifyRequest ¶
type RefundNotifyRequest struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` ReqInfo string `xml:"req_info,omitempty" json:"req_info,omitempty"` }
func ParseRefundNotify ¶
func ParseRefundNotify(req *http.Request) (notifyReq *RefundNotifyRequest, err error)
ParseRefundNotify 解析微信退款异步通知的参数 req:*http.Request 返回参数notifyReq:Notify请求的参数 返回参数err:错误信息
type RefundResponse ¶
type RefundResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` TransactionId string `xml:"transaction_id,omitempty" json:"transaction_id,omitempty"` OutTradeNo string `xml:"out_trade_no,omitempty" json:"out_trade_no,omitempty"` OutRefundNo string `xml:"out_refund_no,omitempty" json:"out_refund_no,omitempty"` RefundId string `xml:"refund_id,omitempty" json:"refund_id,omitempty"` RefundFee string `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` SettlementRefundFee string `xml:"settlement_refund_fee,omitempty" json:"settlement_refund_fee,omitempty"` TotalFee string `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee string `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee string `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CashRefundFee string `xml:"cash_refund_fee,omitempty" json:"cash_refund_fee,omitempty"` CouponType0 string `xml:"coupon_type_0,omitempty" json:"coupon_type_0,omitempty"` CouponType1 string `xml:"coupon_type_1,omitempty" json:"coupon_type_1,omitempty"` CouponType2 string `xml:"coupon_type_2,omitempty" json:"coupon_type_2,omitempty"` CouponRefundFee string `xml:"coupon_refund_fee,omitempty" json:"coupon_refund_fee,omitempty"` CouponRefundFee0 string `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"` CouponRefundFee1 string `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"` CouponRefundFee2 string `xml:"coupon_refund_fee_2,omitempty" json:"coupon_refund_fee_2,omitempty"` CouponRefundCount string `xml:"coupon_refund_count,omitempty" json:"coupon_refund_count,omitempty"` CouponRefundId0 string `xml:"coupon_refund_id_0,omitempty" json:"coupon_refund_id_0,omitempty"` CouponRefundId1 string `xml:"coupon_refund_id_1,omitempty" json:"coupon_refund_id_1,omitempty"` CouponRefundId2 string `xml:"coupon_refund_id_2,omitempty" json:"coupon_refund_id_2,omitempty"` }
type ReportResponse ¶
type ReverseResponse ¶
type ReverseResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` Recall string `xml:"recall,omitempty" json:"recall,omitempty"` }
type SendAppletRedResponse ¶
type SendAppletRedResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` MchBillno string `xml:"mch_billno,omitempty" json:"mch_billno,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Wxappid string `xml:"wxappid,omitempty" json:"wxappid,omitempty"` ReOpenid string `xml:"re_openid,omitempty" json:"re_openid,omitempty"` TotalAmount string `xml:"total_amount,omitempty" json:"total_amount,omitempty"` SendListid string `xml:"send_listid,omitempty" json:"send_listid,omitempty"` Packages string `xml:"package,omitempty" json:"package,omitempty"` }
type SendCashRedResponse ¶
type SendCashRedResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` MchBillno string `xml:"mch_billno,omitempty" json:"mch_billno,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` Wxappid string `xml:"wxappid,omitempty" json:"wxappid,omitempty"` ReOpenid string `xml:"re_openid,omitempty" json:"re_openid,omitempty"` TotalAmount string `xml:"total_amount,omitempty" json:"total_amount,omitempty"` SendListid string `xml:"send_listid,omitempty" json:"send_listid,omitempty"` }
type TransfersInfoResponse ¶
type TransfersInfoResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` PartnerTradeNo string `xml:"partner_trade_no,omitempty" json:"partner_trade_no,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` DetailId string `xml:"detail_id,omitempty" json:"detail_id,omitempty"` Status string `xml:"status,omitempty" json:"status,omitempty"` Reason string `xml:"reason,omitempty" json:"reason,omitempty"` Openid string `xml:"openid,omitempty" json:"openid,omitempty"` TransferName string `xml:"transfer_name,omitempty" json:"transfer_name,omitempty"` PaymentAmount string `xml:"payment_amount,omitempty" json:"payment_amount,omitempty"` TransferTime string `xml:"transfer_time,omitempty" json:"transfer_time,omitempty"` PaymentTime string `xml:"payment_time,omitempty" json:"payment_time,omitempty"` Desc string `xml:"desc,omitempty" json:"desc,omitempty"` }
type TransfersResponse ¶
type TransfersResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` MchAppid string `xml:"mch_appid,omitempty" json:"mch_appid,omitempty"` Mchid string `xml:"mchid,omitempty" json:"mchid,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` PartnerTradeNo string `xml:"partner_trade_no,omitempty" json:"partner_trade_no,omitempty"` PaymentNo string `xml:"payment_no,omitempty" json:"payment_no,omitempty"` PaymentTime string `xml:"payment_time,omitempty" json:"payment_time,omitempty"` }
type UnifiedOrderResponse ¶
type UnifiedOrderResponse struct { ReturnCode string `xml:"return_code,omitempty" json:"return_code,omitempty"` ReturnMsg string `xml:"return_msg,omitempty" json:"return_msg,omitempty"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` SubAppid string `xml:"sub_appid,omitempty" json:"sub_appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` SubMchId string `xml:"sub_mch_id,omitempty" json:"sub_mch_id,omitempty"` DeviceInfo string `xml:"device_info,omitempty" json:"device_info,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` Sign string `xml:"sign,omitempty" json:"sign,omitempty"` ResultCode string `xml:"result_code,omitempty" json:"result_code,omitempty"` ErrCode string `xml:"err_code,omitempty" json:"err_code,omitempty"` ErrCodeDes string `xml:"err_code_des,omitempty" json:"err_code_des,omitempty"` TradeType string `xml:"trade_type,omitempty" json:"trade_type,omitempty"` PrepayId string `xml:"prepay_id,omitempty" json:"prepay_id,omitempty"` CodeUrl string `xml:"code_url,omitempty" json:"code_url,omitempty"` MwebUrl string `xml:"mweb_url,omitempty" json:"mweb_url,omitempty"` }