Documentation ¶
Index ¶
- Constants
- func DecryptOpenDataToBodyMap(encryptedData, iv, sessionKey string) (bm gopay.BodyMap, err error)
- func DecryptOpenDataToStruct(encryptedData, iv, sessionKey string, beanPtr interface{}) (err error)
- func GetAppPaySign(appid, partnerid, noncestr, prepayid, signType, timestamp, apiKey string) (paySign string)
- func GetH5PaySign(appId, nonceStr, packages, signType, timeStamp, apiKey string) (paySign string)
- func GetMiniPaySign(appId, nonceStr, prepayId, signType, timeStamp, apiKey string) (paySign string)
- func GetParamSign(appId, mchId, apiKey string, bm gopay.BodyMap) (sign string)
- func GetSanBoxParamSign(appId, mchId, apiKey string, bm gopay.BodyMap) (sign string, err error)
- func ParseNotifyResultToBodyMap(req *http.Request) (bm gopay.BodyMap, err error)
- func VerifySign(apiKey, signType string, bean interface{}) (ok bool, err error)
- type AccessToken
- type AppLoginAccessToken
- type AppletUserInfo
- type AuthCodeToOpenIdResponse
- type Client
- func (w *Client) AddCertFilePath(certFilePath, keyFilePath, pkcs12FilePath string) (err error)
- func (w *Client) AuthCodeToOpenId(bm gopay.BodyMap) (wxRsp *AuthCodeToOpenIdResponse, err error)
- func (w *Client) BatchQueryComment(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp string, err error)
- func (w *Client) CloseOrder(bm gopay.BodyMap) (wxRsp *CloseOrderResponse, err error)
- func (w *Client) DownloadBill(bm gopay.BodyMap) (wxRsp string, err error)
- func (w *Client) DownloadFundFlow(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp string, err error)
- func (w *Client) EntrustAppPre(bm gopay.BodyMap) (wxRsp *EntrustAppPreResponse, err error)
- func (w *Client) EntrustH5(bm gopay.BodyMap) (wxRsp *EntrustH5Response, err error)
- func (w *Client) EntrustPaying(bm gopay.BodyMap) (wxRsp *EntrustPayingResponse, err error)
- func (w *Client) EntrustPublic(bm gopay.BodyMap) (wxRsp *EntrustPublicResponse, err error)
- func (w *Client) Micropay(bm gopay.BodyMap) (wxRsp *MicropayResponse, err error)
- func (w *Client) QueryOrder(bm gopay.BodyMap) (wxRsp *QueryOrderResponse, err error)
- func (w *Client) QueryRefund(bm gopay.BodyMap) (wxRsp *QueryRefundResponse, err error)
- func (w *Client) Refund(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp *RefundResponse, err error)
- func (w *Client) Report(bm gopay.BodyMap) (wxRsp *ReportResponse, err error)
- func (w *Client) Reverse(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp *ReverseResponse, err error)
- func (w *Client) SetCountry(country Country) (client *Client)
- func (w *Client) Transfer(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp *TransfersResponse, err error)
- func (w *Client) UnifiedOrder(bm gopay.BodyMap) (wxRsp *UnifiedOrderResponse, err error)
- type CloseOrderResponse
- type Code2SessionRsp
- type Country
- type EntrustAppPreResponse
- type EntrustH5Response
- type EntrustPayingResponse
- type EntrustPublicResponse
- type MicropayResponse
- type NotifyRequest
- type NotifyResponse
- type OpenIdByAuthCodeRsp
- type PaidUnionId
- type QueryOrderResponse
- type QueryRefundResponse
- type RefreshAppLoginAccessTokenRsp
- type RefundNotify
- type RefundNotifyRequest
- type RefundResponse
- type ReportResponse
- type ReverseResponse
- type TransfersResponse
- type UnifiedOrderResponse
- type UserInfo
- 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 DecryptOpenDataToBodyMap ¶
解密开放数据到 BodyMap
encryptedData:包括敏感数据在内的完整用户信息的加密数据,小程序获取到 iv:加密算法的初始向量,小程序获取到 sessionKey:会话密钥,通过 gopay.Code2Session() 方法获取到 文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html
func DecryptOpenDataToStruct ¶
解密开放数据到结构体
encryptedData:包括敏感数据在内的完整用户信息的加密数据,小程序获取到 iv:加密算法的初始向量,小程序获取到 sessionKey:会话密钥,通过 gopay.Code2Session() 方法获取到 beanPtr:需要解析到的结构体指针,操作完后,声明的结构体会被赋值 文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html
func GetAppPaySign ¶
func GetAppPaySign(appid, partnerid, noncestr, prepayid, signType, timestamp, apiKey string) (paySign string)
APP支付,统一下单获取支付参数后,再次计算APP支付所需要的的sign
appId:APPID partnerid:partnerid nonceStr:随即字符串 prepayId:统一下单成功后得到的值 signType:此处签名方式,务必与统一下单时用的签名方式一致 timeStamp:时间 ApiKey:API秘钥值 APP支付官方文档:https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12
func GetH5PaySign ¶
微信内H5支付,统一下单获取支付参数后,再次计算出微信内H5支付需要用的paySign
appId:APPID nonceStr:随即字符串 packages:统一下单成功后拼接得到的值 signType:签名类型 timeStamp:时间 ApiKey:API秘钥值 微信内H5支付官方文档:https://pay.weixin.qq.com/wiki/doc/api/external/jsapi.php?chapter=7_7&index=6
func GetMiniPaySign ¶
JSAPI支付,统一下单获取支付参数后,再次计算出小程序用的paySign
appId:APPID nonceStr:随即字符串 prepayId:统一下单成功后得到的值 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 ¶
获取微信支付所需参数里的Sign值(通过支付参数计算Sign值)
注意:BodyMap中如无 sign_type 参数,默认赋值 sign_type 为 MD5 appId:应用ID mchId:商户ID ApiKey:API秘钥值 返回参数 sign:通过Appid、MchId、ApiKey和BodyMap中的参数计算出的Sign值
func GetSanBoxParamSign ¶
获取微信支付沙箱环境所需参数里的Sign值(通过支付参数计算Sign值)
注意:沙箱环境默认 sign_type 为 MD5 appId:应用ID mchId:商户ID ApiKey:API秘钥值 返回参数 sign:通过Appid、MchId、ApiKey和BodyMap中的参数计算出的Sign值
func ParseNotifyResultToBodyMap ¶
解析微信支付异步通知的结果到BodyMap
req:*http.Request 返回参数bm:Notify请求的参数 返回参数err:错误信息
func VerifySign ¶
微信同步返回参数验签或异步通知参数验签
ApiKey:API秘钥值 signType:签名类型(调用API方法时填写的类型) bean:微信同步返回的结构体 wxRsp 或 异步通知解析的结构体 notifyReq 返回参数ok:是否验签通过 返回参数err:错误信息
Types ¶
type AccessToken ¶
type AccessToken struct { AccessToken string `json:"access_token,omitempty"` // 获取到的凭证 ExpiresIn int `json:"expires_in,omitempty"` // SessionKey超时时间(秒) Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
func GetAppletAccessToken ¶
func GetAppletAccessToken(appId, appSecret string) (accessToken *AccessToken, err error)
获取微信小程序全局唯一后台接口调用凭据(AccessToken:157字符)
appId:APPID appSecret:AppSecret 获取access_token文档:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html
type AppLoginAccessToken ¶
type AppLoginAccessToken struct { AccessToken string `json:"access_token,omitempty"` ExpiresIn int `json:"expires_in,omitempty"` Openid string `json:"openid,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` Scope string `json:"scope,omitempty"` Unionid string `json:"unionid,omitempty"` Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
App应用微信第三方登录,code换取access_token
func GetAppLoginAccessToken ¶
func GetAppLoginAccessToken(appId, appSecret, code string) (accessToken *AppLoginAccessToken, err error)
App应用微信第三方登录,code换取access_token
appId:应用唯一标识,在微信开放平台提交应用审核通过后获得 appSecret:应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 code:App用户换取access_token的code
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 ¶ added in v2.0.3
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"` 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"` 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 Client ¶
type Client struct { AppId string MchId string ApiKey string BaseURL string IsProd bool // contains filtered or unexported fields }
func (*Client) AddCertFilePath ¶
添加微信证书 Path 路径
certFilePath:apiclient_cert.pem 路径 keyFilePath:apiclient_key.pem 路径 pkcs12FilePath:apiclient_cert.p12 路径 返回err
func (*Client) AuthCodeToOpenId ¶ added in v2.0.3
func (w *Client) AuthCodeToOpenId(bm gopay.BodyMap) (wxRsp *AuthCodeToOpenIdResponse, err error)
授权码查询openid(正式)
文档地址:https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_13&index=9
func (*Client) BatchQueryComment ¶
func (w *Client) BatchQueryComment(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp string, err error)
拉取订单评价数据(正式)
注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传空字符串 "",否则,3证书Path均不可空 貌似不支持沙箱环境,因为沙箱环境默认需要用MD5签名,但是此接口仅支持HMAC-SHA256签名 文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_17&index=11
func (*Client) CloseOrder ¶
func (w *Client) CloseOrder(bm gopay.BodyMap) (wxRsp *CloseOrderResponse, err error)
关闭订单
文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3
func (*Client) DownloadBill ¶
下载对账单
文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6
func (*Client) DownloadFundFlow ¶
func (w *Client) DownloadFundFlow(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp string, err error)
下载资金账单(正式)
注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传空字符串 "",否则,3证书Path均不可空 貌似不支持沙箱环境,因为沙箱环境默认需要用MD5签名,但是此接口仅支持HMAC-SHA256签名 文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_18&index=7
func (*Client) EntrustAppPre ¶ added in v2.0.3
func (w *Client) EntrustAppPre(bm gopay.BodyMap) (wxRsp *EntrustAppPreResponse, err error)
APP纯签约-预签约接口-获取预签约ID(正式)
文档地址:https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_5&index=2
func (*Client) EntrustH5 ¶ added in v2.0.3
func (w *Client) EntrustH5(bm gopay.BodyMap) (wxRsp *EntrustH5Response, err error)
H5纯签约(正式)
文档地址:https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_16&index=4
func (*Client) EntrustPaying ¶ added in v2.0.3
func (w *Client) EntrustPaying(bm gopay.BodyMap) (wxRsp *EntrustPayingResponse, err error)
支付中签约(正式)
文档地址:https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_13&index=5
func (*Client) EntrustPublic ¶
func (w *Client) EntrustPublic(bm gopay.BodyMap) (wxRsp *EntrustPublicResponse, err error)
公众号纯签约(正式)
文档地址:https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_1&index=1
func (*Client) Micropay ¶
func (w *Client) Micropay(bm gopay.BodyMap) (wxRsp *MicropayResponse, err error)
提交付款码支付
文档地址:https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_10&index=1
func (*Client) QueryOrder ¶
func (w *Client) QueryOrder(bm gopay.BodyMap) (wxRsp *QueryOrderResponse, err error)
查询订单
文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2
func (*Client) QueryRefund ¶
func (w *Client) QueryRefund(bm gopay.BodyMap) (wxRsp *QueryRefundResponse, err error)
查询退款
文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5
func (*Client) Refund ¶
func (w *Client) Refund(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp *RefundResponse, err error)
申请退款
注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传空字符串 "",否则,3证书Path均不可空 文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4
func (*Client) Report ¶ added in v2.0.3
func (w *Client) Report(bm gopay.BodyMap) (wxRsp *ReportResponse, err error)
交易保障
文档地址:(JSAPI)https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_8&index=9 文档地址:(付款码)https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_14&index=8 文档地址:(Native)https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_8&index=9 文档地址:(APP)https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_8&index=10 文档地址:(H5)https://pay.weixin.qq.com/wiki/doc/api/H5.php?chapter=9_8&index=9 文档地址:(微信小程序)https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_8&index=9
func (*Client) Reverse ¶
func (w *Client) Reverse(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp *ReverseResponse, err error)
撤销订单
注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传空字符串 "",否则,3证书Path均不可空 文档地址:https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=9_11&index=3
func (*Client) SetCountry ¶
设置支付国家(默认:中国国内)
根据支付地区情况设置国家 country:<China:中国国内,China2:中国国内(冗灾方案),SoutheastAsia:东南亚,Other:其他国家>
func (*Client) Transfer ¶
func (w *Client) Transfer(bm gopay.BodyMap, certFilePath, keyFilePath, pkcs12FilePath string) (wxRsp *TransfersResponse, err error)
企业向微信用户个人付款(正式)
注意:如已使用client.AddCertFilePath()添加过证书,参数certFilePath、keyFilePath、pkcs12FilePath全传空字符串 "",否则,3证书Path均不可空 注意:此方法未支持沙箱环境,默认正式环境,转账请慎重 文档地址:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
func (*Client) UnifiedOrder ¶
func (w *Client) UnifiedOrder(bm gopay.BodyMap) (wxRsp *UnifiedOrderResponse, err error)
统一下单
文档地址:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
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"` MchId string `xml:"mch_id,omitempty" json:"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 Code2SessionRsp ¶
type Code2SessionRsp struct { SessionKey string `json:"session_key,omitempty"` // 会话密钥 ExpiresIn int `json:"expires_in,omitempty"` // SessionKey超时时间(秒) Openid string `json:"openid,omitempty"` // 用户唯一标识 Unionid string `json:"unionid,omitempty"` // 用户在开放平台的唯一标识符 Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
func Code2Session ¶
func Code2Session(appId, appSecret, wxCode string) (sessionRsp *Code2SessionRsp, err error)
获取微信小程序用户的OpenId、SessionKey、UnionId
appId:APPID appSecret:AppSecret wxCode:小程序调用wx.login 获取的code 文档:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html
type EntrustAppPreResponse ¶ added in v2.0.3
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"` Appid string `xml:"appid,omitempty" json:"appid,omitempty"` MchId string `xml:"mch_id,omitempty" json:"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 ¶ added in v2.0.3
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 ¶ added in v2.0.3
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"` MchId string `xml:"mch_id,omitempty" json:"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 int `xml:"plan_id,omitempty" json:"plan_id,omitempty"` RequestSerial int `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 ¶ added in v2.0.3
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"` MchId string `xml:"mch_id,omitempty" json:"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 int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee int `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` CouponFee int `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CashFee int `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"` MchId string `xml:"mch_id,omitempty" json:"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 int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee int `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CouponFee int `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CouponCount int `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"` CouponId0 string `xml:"coupon_id_0,omitempty" json:"coupon_id_0,omitempty"` CouponId1 string `xml:"coupon_id_1,omitempty" json:"coupon_id_1,omitempty"` CouponFee0 int `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"` CouponFee1 int `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,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 ParseNotifyResult ¶
func ParseNotifyResult(req *http.Request) (notifyReq *NotifyRequest, err error)
解析微信支付异步通知的参数
req:*http.Request 返回参数notifyReq:Notify请求的参数 返回参数err:错误信息
type NotifyResponse ¶
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"` 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"` 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(appId, mchId, apiKey, authCode, nonceStr string) (openIdRsp *OpenIdByAuthCodeRsp, err error)
授权码查询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 PaidUnionId struct { Unionid string `json:"unionid,omitempty"` // 用户在开放平台的唯一标识符 Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
func GetAppletPaidUnionId ¶
func GetAppletPaidUnionId(accessToken, openId, transactionId string) (unionId *PaidUnionId, err error)
微信小程序用户支付完成后,获取该用户的 UnionId,无需用户授权。
accessToken:接口调用凭据 openId:用户的OpenID transactionId:微信支付订单号 文档:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPaidUnionId.html
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"` 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"` 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 int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee int `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CouponFee int `xml:"coupon_fee,omitempty" json:"coupon_fee,omitempty"` CouponCount int `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"` CouponId0 string `xml:"coupon_id_0,omitempty" json:"coupon_id_0,omitempty"` CouponId1 string `xml:"coupon_id_1,omitempty" json:"coupon_id_1,omitempty"` CouponFee0 int `xml:"coupon_fee_0,omitempty" json:"coupon_fee_0,omitempty"` CouponFee1 int `xml:"coupon_fee_1,omitempty" json:"coupon_fee_1,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 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"` 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"` TotalRefundCount int `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 int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee int `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` RefundCount int `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"` RefundId0 string `xml:"refund_id_0,omitempty" json:"refund_id_0,omitempty"` RefundId1 string `xml:"refund_id_1,omitempty" json:"refund_id_1,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"` RefundFee int `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` RefundFee0 int `xml:"refund_fee_0,omitempty" json:"refund_fee_0,omitempty"` RefundFee1 int `xml:"refund_fee_1,omitempty" json:"refund_fee_1,omitempty"` SettlementRefundFee0 int `xml:"settlement_refund_fee_0,omitempty" json:"settlement_refund_fee_0,omitempty"` SettlementRefundFee1 int `xml:"settlement_refund_fee_1,omitempty" json:"settlement_refund_fee_1,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"` CouponRefundFee0 int `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"` CouponRefundFee1 int `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"` CouponRefundCount0 int `xml:"coupon_refund_count_0,omitempty" json:"coupon_refund_count_0,omitempty"` CouponRefundCount1 int `xml:"coupon_refund_count_1,omitempty" json:"coupon_refund_count_1,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"` CouponRefundFee00 int `xml:"coupon_refund_fee_0_0,omitempty" json:"coupon_refund_fee_0_0,omitempty"` CouponRefundFee01 int `xml:"coupon_refund_fee_0_1,omitempty" json:"coupon_refund_fee_0_1,omitempty"` CouponRefundFee10 int `xml:"coupon_refund_fee_1_0,omitempty" json:"coupon_refund_fee_1_0,omitempty"` CouponRefundFee11 int `xml:"coupon_refund_fee_1_1,omitempty" json:"coupon_refund_fee_1_1,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"` RefundAccount0 string `xml:"refund_account_0,omitempty" json:"refund_account_0,omitempty"` RefundAccount1 string `xml:"refund_account_1,omitempty" json:"refund_account_1,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"` 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"` }
type RefreshAppLoginAccessTokenRsp ¶
type RefreshAppLoginAccessTokenRsp struct { AccessToken string `json:"access_token,omitempty"` ExpiresIn int `json:"expires_in,omitempty"` Openid string `json:"openid,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` Scope string `json:"scope,omitempty"` Errcode int `json:"errcode,omitempty"` // 错误码 Errmsg string `json:"errmsg,omitempty"` // 错误信息 }
刷新App应用微信第三方登录后,获取的 access_token
func RefreshAppLoginAccessToken ¶
func RefreshAppLoginAccessToken(appId, refreshToken string) (accessToken *RefreshAppLoginAccessTokenRsp, err error)
刷新App应用微信第三方登录后,获取的 access_token
appId:应用唯一标识,在微信开放平台提交应用审核通过后获得 appSecret:应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 code:App用户换取access_token的code
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 int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee int `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` RefundFee int `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` SettlementRefundFee int `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)
解密微信退款异步通知的加密数据
reqInfo:gopay.ParseRefundNotifyResult() 方法获取的加密数据 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"` MchId string `xml:"mch_id,omitempty" json:"mch_id,omitempty"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str,omitempty"` ReqInfo string `xml:"req_info,omitempty" json:"req_info,omitempty"` }
func ParseRefundNotifyResult ¶
func ParseRefundNotifyResult(req *http.Request) (notifyReq *RefundNotifyRequest, err error)
解析微信退款异步通知的参数
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"` 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"` 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 int `xml:"refund_fee,omitempty" json:"refund_fee,omitempty"` SettlementRefundFee int `xml:"settlement_refund_fee,omitempty" json:"settlement_refund_fee,omitempty"` TotalFee int `xml:"total_fee,omitempty" json:"total_fee,omitempty"` SettlementTotalFee int `xml:"settlement_total_fee,omitempty" json:"settlement_total_fee,omitempty"` FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` CashFee int `xml:"cash_fee,omitempty" json:"cash_fee,omitempty"` CashFeeType string `xml:"cash_fee_type,omitempty" json:"cash_fee_type,omitempty"` CashRefundFee int `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"` CouponRefundFee int `xml:"coupon_refund_fee,omitempty" json:"coupon_refund_fee,omitempty"` CouponRefundFee0 int `xml:"coupon_refund_fee_0,omitempty" json:"coupon_refund_fee_0,omitempty"` CouponRefundFee1 int `xml:"coupon_refund_fee_1,omitempty" json:"coupon_refund_fee_1,omitempty"` CouponRefundCount int `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"` }
type ReportResponse ¶ added in v2.0.3
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"` 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"` 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 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"` MchId string `xml:"mch_id,omitempty" json:"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"` }
type UserInfo ¶
type UserInfo 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时是未知 Language string `json:"language,omitempty"` // 用户的语言,简体中文为zh_CN City string `json:"city,omitempty"` // 用户所在城市 Province string `json:"province,omitempty"` // 用户所在省份 Country string `json:"country,omitempty"` // 用户所在国家 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"` // 错误信息 }