Documentation
¶
Index ¶
- Constants
- func BytesToString(data []byte) string
- func CreateAuthorization(ctx *MchParam, method string, rawUrl string, signBody string) (authorization string, err error)
- func DecryptAES256GCM(aesKey, associatedData, nonce, ciphertext string) (string, error)
- func GenerateNonce() (string, error)
- func GetPlatCertificate(ctx *MchParam, serial_no string) *x509.Certificate
- func HttpCallBackReturn(w http.ResponseWriter, status int, code string, message string)
- func LoadCertificate(certificateStr string) (certificate *x509.Certificate, err error)
- func LoadCertificateWithPath(path string) (certificate *x509.Certificate, err error)
- func LoadPrivateKey(privateKeyStr string) (privateKey *rsa.PrivateKey, err error)
- func LoadPrivateKeyWithPath(path string) (privateKey *rsa.PrivateKey, err error)
- func LoadPublicKey(publicKeyStr string) (publicKey *rsa.PublicKey, err error)
- func LoadPublicKeyWithPath(path string) (publicKey *rsa.PublicKey, err error)
- func ResponseValidate(sign_param *WxSignParam, certificate *x509.Certificate) error
- func SetDebugLogger(logger DebugLogger)
- func SetLoggerPrefix(prefix string)
- func ShowDebugLog(show bool)
- func SignSHA256WithRSA(privateKey *rsa.PrivateKey, source string) (signature string, err error)
- func WxPayGetV3(ctx *MchParam, url string) (string, error)
- func WxPayPostV3(ctx *MchParam, url string, data []byte) (string, error)
- type CloseOrderReq
- type DebugLogger
- type JsApiOrderCreateReq
- type JsApiOrderCreateRet
- type JsApiOrderData
- type MchApp
- type MchH5
- type MchJsApi
- type MchNative
- type MchParam
- type MchWxApp
- type MidApp
- type MidH5
- type MidJsApi
- type MidNative
- type MidWxApp
- type NativeOrderCreateNewReq
- type NativeOrderCreateReq
- type NativeOrderCreateRet
- type NativeOrderData
- type NativeOrderDataNew
- type NoticeResource
- type OrderAmount
- type OrderCreateAmount
- type OrderCreateSettle
- type OrderPayer
- type OsAppOrderCreateReq
- type OsAppOrderCreateRet
- type OsAppOrderData
- type QueryByOutTradeNoReq
- type QueryByTransactionIdReq
- type RawAppPayParam
- type RefundCreateAmount
- type RefundCreateReq
- type RefundOrderAmount
- type RefundOrderAmountCB
- type RefundOrderInfo
- type RefundOrderInfoCB
- type RefundQueryReq
- type SimpleLogger
- type WeixinPayNotice
- type WxAppOrderCreateReq
- type WxAppOrderCreateRet
- type WxAppOrderData
- type WxAppPayParam
- type WxCertRet
- type WxCertRetItem
- type WxCertificate
- type WxH5Info
- type WxH5OrderCreateReq
- type WxH5OrderCreateRet
- type WxH5OrderData
- type WxH5SceneInfo
- type WxPayInfo
- type WxPayMch
- func (ent *WxPayMch) CloseOrder(out_trade_no string, mchid string) error
- func (ent *WxPayMch) CreateOrderApp(data OsAppOrderData) (RawAppPayParam, error)
- func (ent *WxPayMch) CreateOrderH5(data WxH5OrderData) (string, error)
- func (ent *WxPayMch) CreateOrderJsApi(data JsApiOrderData) (WxAppPayParam, error)
- func (ent *WxPayMch) CreateOrderNative(data NativeOrderData) (string, error)
- func (ent *WxPayMch) CreateOrderNativeNew(data NativeOrderDataNew) (string, error)
- func (ent *WxPayMch) QueryByOutTradeNo(out_trade_no string, mchid string) (WxPayInfo, error)
- func (ent *WxPayMch) QueryByTransactionId(transaction_id string, mchid string) (WxPayInfo, error)
- func (ent *WxPayMch) QueryRefundOrder(out_refund_no string, mchid string) (RefundOrderInfo, error)
- func (ent *WxPayMch) RefundOrder(data RefundCreateReq) (RefundOrderInfo, error)
- type WxPayMid
- func (ent *WxPayMid) CloseOrder(out_trade_no string, mchid string) error
- func (ent *WxPayMid) CreateOrderApp(data OsAppOrderData) (RawAppPayParam, error)
- func (ent *WxPayMid) CreateOrderH5(data WxH5OrderData) (string, error)
- func (ent *WxPayMid) CreateOrderJsApi(data JsApiOrderData) (WxAppPayParam, error)
- func (ent *WxPayMid) CreateOrderNative(data NativeOrderData) (string, error)
- func (ent *WxPayMid) QueryByOutTradeNo(out_trade_no string, mchid string) (WxPayInfo, error)
- func (ent *WxPayMid) QueryByOutTradeNo1(out_trade_no string, mchid string) (WxPayInfo, error)
- func (ent *WxPayMid) QueryByTransactionId(transaction_id string, mchid string) (WxPayInfo, error)
- func (ent *WxPayMid) QueryRefundOrder(out_refund_no string, mchid string) (RefundOrderInfo, error)
- func (ent *WxPayMid) RefundOrder(data RefundCreateReq) (RefundOrderInfo, error)
- type WxPayNotifyRet
- type WxPayer
- type WxSignParam
Constants ¶
const NonceSymbols = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
生成32个字节的请求随机串
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func CreateAuthorization ¶
func CreateAuthorization(ctx *MchParam, method string, rawUrl string, signBody string) (authorization string, err error)
生成请求报文头中的Authorization信息 method:HTTP请求的方法(GET,POST) rawUrl:请求的绝对URL,用于获取除域名部分得到参与签名的URL signBody:请求报文主体
func DecryptAES256GCM ¶
使用 AEAD_AES_256_GCM 算法进行解密 你可以使用此算法完成微信支付平台证书和回调报文解密
func GenerateNonce ¶
func GetPlatCertificate ¶
func GetPlatCertificate(ctx *MchParam, serial_no string) *x509.Certificate
func HttpCallBackReturn ¶
func HttpCallBackReturn(w http.ResponseWriter, status int, code string, message string)
支付通知返回
func LoadCertificate ¶
func LoadCertificate(certificateStr string) (certificate *x509.Certificate, err error)
通过证书的文本内容加载证书
func LoadCertificateWithPath ¶
func LoadCertificateWithPath(path string) (certificate *x509.Certificate, err error)
通过证书的文件路径加载证书
func LoadPrivateKey ¶
func LoadPrivateKey(privateKeyStr string) (privateKey *rsa.PrivateKey, err error)
通过私钥的文本内容加载私钥
func LoadPrivateKeyWithPath ¶
func LoadPrivateKeyWithPath(path string) (privateKey *rsa.PrivateKey, err error)
通过私钥的文件路径内容加载私钥
func LoadPublicKey ¶
LoadPublicKey 通过公钥的文本内容加载公钥
func LoadPublicKeyWithPath ¶
通过公钥的文件路径加载公钥
func ResponseValidate ¶
func ResponseValidate(sign_param *WxSignParam, certificate *x509.Certificate) error
对微信支付应答报文进行验证 resp_ent:微信支付应答报文数据 certificate:微信支付平台证书中,使用微信支付平台证书中的公钥验签
func SetDebugLogger ¶
func SetDebugLogger(logger DebugLogger)
func SetLoggerPrefix ¶
func SetLoggerPrefix(prefix string)
func ShowDebugLog ¶
func ShowDebugLog(show bool)
func SignSHA256WithRSA ¶
func SignSHA256WithRSA(privateKey *rsa.PrivateKey, source string) (signature string, err error)
使用商户私钥对待签名串进行SHA256 with RSA签名,并对签名结果进行Base64编码
func WxPayGetV3 ¶
通过http GET方法调用支付接口 ctx:商户上下文对象 url:接口的调用地址
Types ¶
type CloseOrderReq ¶
type CloseOrderReq struct { //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` }
关闭支付订单参数
type DebugLogger ¶
type JsApiOrderCreateReq ¶
type JsApiOrderCreateReq struct { //应用ID(普通商户) Appid string `json:"appid,omitempty"` //直连商户号(普通商户) Mchid string `json:"mchid,omitempty"` //服务商用ID(服务商) Sp_appid string `json:"sp_appid,omitempty"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid,omitempty"` //订单数据 JsApiOrderData }
统一下单请求参数
type JsApiOrderCreateRet ¶
type JsApiOrderCreateRet struct { //详细错误码 Return_code string `json:"code"` //错误描述 Return_msg string `json:"message"` //预支付交易会话标识。用于后续接口调用中使用,该值有效期为2小时 Prepay_id string `json:"prepay_id"` }
统一下单返回参数
type JsApiOrderData ¶
type JsApiOrderData struct { //子商户用ID(服务商) Sub_appid string `json:"sub_appid,omitempty"` //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商品描述 Description string `json:"description"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //交易结束时间 Time_expire string `json:"time_expire,omitempty"` //附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 Attach string `json:"attach,omitempty"` //通知URL必须为直接可访问的URL,不允许携带查询串 Notify_url string `json:"notify_url"` //订单优惠标记 Goods_tag string `json:"goods_tag,omitempty"` //订单金额信息 Amount OrderCreateAmount `json:"amount"` //支付者信息 Payer OrderPayer `json:"payer"` //统一下单结算信息 Settle_info OrderCreateSettle `json:"settle_info"` }
统一下单请求参数
type MchApp ¶
type MchApp struct {
WxPayMch
}
func NewMchApp ¶
func NewMchApp(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MchApp
func (*MchApp) CreateOrder ¶
func (ent *MchApp) CreateOrder(data OsAppOrderData) (RawAppPayParam, error)
支付统一下单
type MchH5 ¶
type MchH5 struct {
WxPayMch
}
func NewMchH5 ¶
func NewMchH5(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MchH5
func (*MchH5) CreateOrder ¶
func (ent *MchH5) CreateOrder(data WxH5OrderData) (string, error)
支付统一下单
type MchJsApi ¶
type MchJsApi struct {
WxPayMch
}
func NewMchJsApi ¶
func NewMchJsApi(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MchJsApi
func (*MchJsApi) CreateOrder ¶
func (ent *MchJsApi) CreateOrder(data JsApiOrderData) (WxAppPayParam, error)
支付统一下单
type MchNative ¶
type MchNative struct {
WxPayMch
}
func NewMchNative ¶
func NewMchNative(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MchNative
func (*MchNative) CreateOrder ¶
func (ent *MchNative) CreateOrder(data NativeOrderData) (string, error)
支付统一下单
func (*MchNative) CreateOrderNew ¶ added in v0.0.2
func (ent *MchNative) CreateOrderNew(data NativeOrderDataNew) (string, error)
支付统一下单
type MchParam ¶
type MchParam struct { //商户对应的appid Appid string //商户号 Mchid string //商户的API v3密钥 MchAPIKey string //商户API私钥 MchPrivateKey *rsa.PrivateKey //商户 API 证书 MchCertificate *x509.Certificate }
func (*MchParam) HttpCallBackReturn ¶
func (ent *MchParam) HttpCallBackReturn(w http.ResponseWriter, status int, code string, message string)
支付通知返回
func (*MchParam) ParsePayCallBack ¶
支付回调请求处理,返回订单信息
func (*MchParam) ParseRefundCallBack ¶
func (ent *MchParam) ParseRefundCallBack(r *http.Request) (RefundOrderInfoCB, error)
退款回调请求处理,返回退款信息
type MchWxApp ¶
type MchWxApp struct {
WxPayMch
}
func NewMchWxApp ¶
func NewMchWxApp(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MchWxApp
func (*MchWxApp) CreateOrder ¶
func (ent *MchWxApp) CreateOrder(data JsApiOrderData) (WxAppPayParam, error)
支付统一下单
type MidApp ¶
type MidApp struct {
WxPayMid
}
func NewMidApp ¶
func NewMidApp(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MidApp
func (*MidApp) CreateOrder ¶
func (ent *MidApp) CreateOrder(data OsAppOrderData) (RawAppPayParam, error)
支付统一下单
type MidH5 ¶
type MidH5 struct {
WxPayMid
}
func NewMidH5 ¶
func NewMidH5(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MidH5
func (*MidH5) CreateOrder ¶
func (ent *MidH5) CreateOrder(data WxH5OrderData) (string, error)
支付统一下单
type MidJsApi ¶
type MidJsApi struct {
WxPayMid
}
func NewMidJsApi ¶
func NewMidJsApi(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MidJsApi
func (*MidJsApi) CreateOrder ¶
func (ent *MidJsApi) CreateOrder(data JsApiOrderData) (WxAppPayParam, error)
支付统一下单
type MidNative ¶
type MidNative struct {
WxPayMid
}
func NewMidNative ¶
func NewMidNative(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MidNative
func (*MidNative) CreateOrder ¶
func (ent *MidNative) CreateOrder(data NativeOrderData) (string, error)
支付统一下单
type MidWxApp ¶
type MidWxApp struct {
WxPayMid
}
func NewMidWxApp ¶
func NewMidWxApp(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *MidWxApp
func (*MidWxApp) CreateOrder ¶
func (ent *MidWxApp) CreateOrder(data JsApiOrderData) (WxAppPayParam, error)
支付统一下单
type NativeOrderCreateNewReq ¶ added in v0.0.2
type NativeOrderCreateNewReq struct { //应用ID(普通商户) Appid string `json:"appid,omitempty"` //直连商户号(普通商户) Mchid string `json:"mchid,omitempty"` //服务商用ID(服务商) Sp_appid string `json:"sp_appid,omitempty"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid,omitempty"` //订单数据 NativeOrderDataNew }
统一下单请求参数
type NativeOrderCreateReq ¶
type NativeOrderCreateReq struct { //应用ID(普通商户) Appid string `json:"appid,omitempty"` //直连商户号(普通商户) Mchid string `json:"mchid,omitempty"` ////服务商用ID(服务商) //Sp_appid string `json:"sp_appid,omitempty"` ////服务商户号(服务商) //Sp_mchid string `json:"sp_mchid,omitempty"` //订单数据 NativeOrderData }
统一下单请求参数
type NativeOrderCreateRet ¶
type NativeOrderCreateRet struct { //详细错误码 Return_code string `json:"code"` //错误描述 Return_msg string `json:"message"` //二维码链接,此URL用于生成支付二维码,然后提供给用户扫码支付。 Code_url string `json:"code_url"` }
统一下单返回参数
type NativeOrderData ¶
type NativeOrderData struct { //子商户用ID(服务商) //Sub_appid string `json:"sub_appid,omitempty"` ////子商户的商户号(服务商) //Sub_mchid string `json:"sub_mchid,omitempty"` //商品描述 Description string `json:"description"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //交易结束时间 Time_expire string `json:"time_expire,omitempty"` //附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 Attach string `json:"attach,omitempty"` //通知URL必须为直接可访问的URL,不允许携带查询串 Notify_url string `json:"notify_url"` //订单优惠标记 Goods_tag string `json:"goods_tag,omitempty"` //订单金额信息 Amount OrderCreateAmount `json:"amount"` //统一下单结算信息 Settle_info OrderCreateSettle `json:"settle_info"` }
统一下单请求参数
type NativeOrderDataNew ¶ added in v0.0.2
type NativeOrderDataNew struct { Description string `json:"description"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //交易结束时间 Time_expire string `json:"time_expire,omitempty"` //附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 Attach string `json:"attach,omitempty"` //通知URL必须为直接可访问的URL,不允许携带查询串 Notify_url string `json:"notify_url"` //订单优惠标记 Goods_tag string `json:"goods_tag,omitempty"` //订单金额信息 Amount OrderCreateAmount `json:"amount"` //统一下单结算信息 Settle_info OrderCreateSettle `json:"settle_info"` }
type NoticeResource ¶
type OrderAmount ¶
type OrderAmount struct { //订单总金额,单位为分 Total int `json:"total"` //用户支付金额,单位为分 Payer_total int `json:"payer_total"` //货币类型:CNY(人民币),境内商户号仅支持人民币。 Currency string `json:"currency"` //用户支付币种 Payer_currency string `json:"payer_currency"` }
订单金额信息
type OrderCreateAmount ¶
type OrderCreateAmount struct { //订单总金额,单位为分。 Total int `json:"total"` //货币类型:CNY(人民币),境内商户号仅支持人民币。 Currency string `json:"currency,omitempty"` }
统一下单订单金额信息
type OrderCreateSettle ¶
type OrderCreateSettle struct { //是否指定分账,枚举值:true(是), false(否) Profit_sharing bool `json:"profit_sharing,omitempty"` }
统一下单结算信息
type OrderPayer ¶
type OrderPayer struct { //用用户在直连商户appid下的唯一标识 Openid string `json:"openid,omitempty"` //用户在服务商appid下的唯一标识 Sp_openid string `json:"sp_openid,omitempty"` //用户在子商户appid下的唯一标识。若传sub_openid,那sub_appid必填 Sub_openid string `json:"sub_openid,omitempty"` }
支付者信息
type OsAppOrderCreateReq ¶
type OsAppOrderCreateReq struct { //应用ID(普通商户) Appid string `json:"appid,omitempty"` //直连商户号(普通商户) Mchid string `json:"mchid,omitempty"` //服务商用ID(服务商) Sp_appid string `json:"sp_appid,omitempty"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid,omitempty"` //订单数据 OsAppOrderData }
统一下单请求参数
type OsAppOrderCreateRet ¶
type OsAppOrderCreateRet struct { //详细错误码 Return_code string `json:"code"` //错误描述 Return_msg string `json:"message"` //预支付交易会话标识。用于后续接口调用中使用,该值有效期为2小时 Prepay_id string `json:"prepay_id"` }
统一下单返回参数
type OsAppOrderData ¶
type OsAppOrderData struct { //子商户用ID(服务商) Sub_appid string `json:"sub_appid,omitempty"` //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商品描述 Description string `json:"description"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //交易结束时间 Time_expire string `json:"time_expire,omitempty"` //附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 Attach string `json:"attach,omitempty"` //通知URL必须为直接可访问的URL,不允许携带查询串 Notify_url string `json:"notify_url"` //订单优惠标记 Goods_tag string `json:"goods_tag,omitempty"` //订单金额信息 Amount OrderCreateAmount `json:"amount"` //统一下单结算信息 Settle_info OrderCreateSettle `json:"settle_info"` }
统一下单请求参数
type QueryByOutTradeNoReq ¶
type QueryByOutTradeNoReq struct { //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` }
支付订单查询参数
type QueryByTransactionIdReq ¶
type QueryByTransactionIdReq struct { //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //微信支付订单号 Transaction_id string `json:"transaction_id"` }
支付订单查询参数
type RawAppPayParam ¶
type RawAppPayParam struct { Appid string PartnerId string Prepay_id string Package string NonceStr string TimeStamp string PaySign string }
返回给小程序的微信支付数据
func (*RawAppPayParam) GenPaySignV3 ¶
func (ent *RawAppPayParam) GenPaySignV3(mch_pem_key *rsa.PrivateKey) (string, error)
使用商户私钥对签名串进行SHA256 with RSA签名,并对签名结果进行Base64编码得到签名值
type RefundCreateAmount ¶
type RefundCreateAmount struct { //退款金额,单位为分 Refund int `json:"refund"` //原订单金额,单位为分 Total int `json:"total"` //退款币种:CNY(人民币),境内商户号仅支持人民币。 Currency string `json:"currency"` }
退款金额信息
type RefundCreateReq ¶
type RefundCreateReq struct { //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no,omitempty"` //微信支付订单号 Transaction_id string `json:"transaction_id,omitempty"` //商户系统内部的退款单号 Out_refund_no string `json:"out_refund_no"` //退款原因 Reason string `json:"reason,omitempty"` //退款结果回调的URL,不允许携带查询串 Notify_url string `json:"notify_url,omitempty"` //退款金额信息 Amount RefundCreateAmount `json:"amount"` }
微信支付退款申请请求参数
type RefundOrderAmount ¶
type RefundOrderAmount struct { //原订单金额,单位为分 Total int `json:"total"` //退款金额,单位为分 Refund int `json:"refund"` //用户支付金额,单位为分 Payer_total int `json:"payer_total,omitempty"` //退款给用户的金额,不包含所有优惠券金额 Payer_refund int `json:"payer_refund,omitempty"` //应结退款金额 Settlement_refund int `json:"settlement_refund"` //应结订单金额 Settlement_total int `json:"settlement_total"` //优惠退款金额 Discount_refund int `json:"discount_refund"` //退款币种:CNY(人民币),境内商户号仅支持人民币。 Currency string `json:"currency"` }
退款金额信息
type RefundOrderAmountCB ¶
type RefundOrderAmountCB struct { //退款金额,单位为分 Refund int `json:"refund"` //原订单金额,单位为分 Total int `json:"total"` //退款币种:CNY(人民币),境内商户号仅支持人民币。 Currency string `json:"currency"` //用户支付金额,单位为分 Payer_total int `json:"payer_total,omitempty"` //退款给用户的金额,不包含所有优惠券金额 Payer_refund int `json:"payer_refund,omitempty"` }
退款金额信息
type RefundOrderInfo ¶
type RefundOrderInfo struct { //服务商户号(普通商户) Mchid string `json:"mchid"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid"` //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid"` //微信支付退款单号 Refund_id string `json:"refund_id"` //商户系统内部的退款单号 Out_refund_no string `json:"out_refund_no"` //微信支付订单号 Transaction_id string `json:"transaction_id"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //退款渠道 枚举值: - ORIGINAL—原路退款 - BALANCE—退回到余额 - OTHER_BALANCE—原账户异常退到其他余额账户 - OTHER_BANKCARD—原银行卡异常退到其他银行卡 * `ORIGINAL` - 原路退款 * `BALANCE` - 退回到余额 * `OTHER_BALANCE` - 原账户异常退到其他余额账户 * `OTHER_BANKCARD` - 原银行卡异常退到其他银行卡 Channel string `json:"channel"` //退款入账账户 User_received_account string `json:"user_received_account"` //退款成功时间 Success_time string `json:"success_time"` //退款创建时间 Create_time string `json:"create_time"` //退款状态,UCCESS:退款成功 CLOSED:退款关闭/PROCESSING:退款处理中 ABNORMAL:退款异常 Status string `json:"status"` //退款所使用资金对应的资金账户类型 枚举值:UNSETTLED : 未结算资金AVAILABLE : 可用余额UNAVAILABLE : 不可用余额OPERATION : 运营户BASIC : 基本账户 Funds_account string `json:"funds_account"` //订单金额信息 Amount RefundOrderAmount `json:"amount"` }
微信退款订单信息
type RefundOrderInfoCB ¶
type RefundOrderInfoCB struct { //服务商户号(普通商户) Mchid string `json:"mchid"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid"` //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid"` //微信支付订单号 Transaction_id string `json:"transaction_id"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //微信支付退款单号 Refund_id string `json:"refund_id"` //商户系统内部的退款单号 Out_refund_no string `json:"out_refund_no"` //退款状态,SUCCESS:退款成功 CLOSE:退款关闭 ABNORMAL:退款异常 Refund_status string `json:"refund_status"` //退款成功时间 Success_time string `json:"success_time"` //退款入账账户 User_received_account string `json:"user_received_account"` //订单金额信息 Amount RefundOrderAmountCB `json:"amount"` }
微信退款订单信息
type RefundQueryReq ¶
type RefundQueryReq struct { //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商户系统内部的退款单号 Out_refund_no string `json:"out_refund_no"` }
查询单笔退款参数
type SimpleLogger ¶
type SimpleLogger struct {
// contains filtered or unexported fields
}
func NewSimpleLogger ¶
func NewSimpleLogger() *SimpleLogger
func (*SimpleLogger) Output ¶
func (lg *SimpleLogger) Output(prefix string, msg string)
type WeixinPayNotice ¶
type WeixinPayNotice struct { //通知的唯一ID ReqId string `json:"id"` //通知创建的时间 CreateTime string `json:"create_time"` //通知的类型,支付成功通知的类型为TRANSACTION.SUCCESS Event_type string `json:"event_type"` //通知的资源数据类型,支付成功通知为encrypt-resource ResourceType string `json:"resource_type"` //回调摘要 Summary string `json:"summary"` //通知资源数据 Resource NoticeResource `json:"resource"` }
支付回调数据定义
type WxAppOrderCreateReq ¶
type WxAppOrderCreateReq struct { //应用ID(普通商户) Appid string `json:"appid,omitempty"` //直连商户号(普通商户) Mchid string `json:"mchid,omitempty"` //服务商用ID(服务商) Sp_appid string `json:"sp_appid,omitempty"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid,omitempty"` //订单数据 WxAppOrderData }
统一下单请求参数
type WxAppOrderCreateRet ¶
type WxAppOrderCreateRet struct { //详细错误码 Return_code string `json:"code"` //错误描述 Return_msg string `json:"message"` //预支付交易会话标识。用于后续接口调用中使用,该值有效期为2小时 Prepay_id string `json:"prepay_id"` }
统一下单返回参数
type WxAppOrderData ¶
type WxAppOrderData struct { //子商户用ID(服务商) Sub_appid string `json:"sub_appid,omitempty"` //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商品描述 Description string `json:"description"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //交易结束时间 Time_expire string `json:"time_expire,omitempty"` //附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 Attach string `json:"attach,omitempty"` //通知URL必须为直接可访问的URL,不允许携带查询串 Notify_url string `json:"notify_url"` //订单优惠标记 Goods_tag string `json:"goods_tag,omitempty"` //订单金额信息 Amount OrderCreateAmount `json:"amount"` //支付者信息 Payer OrderPayer `json:"payer"` //统一下单结算信息 Settle_info OrderCreateSettle `json:"settle_info"` }
统一下单请求参数
type WxAppPayParam ¶
type WxAppPayParam struct { Appid string TimeStamp string NonceStr string Prepay_id string Package string SignType string PaySign string }
返回给小程序的微信支付数据
func (*WxAppPayParam) GenPaySignV3 ¶
func (ent *WxAppPayParam) GenPaySignV3(mch_pem_key *rsa.PrivateKey) (string, error)
使用商户私钥对签名串进行SHA256 with RSA签名,并对签名结果进行Base64编码得到签名值
type WxCertRetItem ¶
type WxCertRetItem struct { EffectiveTime string `json:"effective_time"` Certificate WxCertificate `json:"encrypt_certificate"` ExpireTime string `json:"expire_time"` SerialNo string `json:"serial_no"` }
type WxCertificate ¶
type WxH5Info ¶
type WxH5Info struct { //场景类型:示例值:iOS, Android, Wap SceneType string `json:"type"` //应用名称 App_name string `json:"app_name,omitempty"` //网站URL App_url string `json:"app_url,omitempty"` //iOS平台BundleID Bundle_id string `json:"bundle_id,omitempty"` //Android平台PackageName Package_name string `json:"package_name,omitempty"` }
支付场景描述
type WxH5OrderCreateReq ¶
type WxH5OrderCreateReq struct { //应用ID(普通商户) Appid string `json:"appid,omitempty"` //直连商户号(普通商户) Mchid string `json:"mchid,omitempty"` //服务商用ID(服务商) Sp_appid string `json:"sp_appid,omitempty"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid,omitempty"` //订单数据 WxH5OrderData }
统一下单请求参数
type WxH5OrderCreateRet ¶
type WxH5OrderCreateRet struct { //详细错误码 Return_code string `xml:"code"` //错误描述 Return_msg string `xml:"message"` //h5_url为拉起微信支付收银台的中间页面,可通过访问该url来拉起微信客户端,完成支付,h5_url的有效期为5分钟。 H5_url string `xml:"h5_url"` }
统一下单返回参数
type WxH5OrderData ¶
type WxH5OrderData struct { //子商户用ID(服务商) Sub_appid string `json:"sub_appid,omitempty"` //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid,omitempty"` //商品描述 Description string `json:"description"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //交易结束时间 Time_expire string `json:"time_expire,omitempty"` //附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 Attach string `json:"attach,omitempty"` //通知URL必须为直接可访问的URL,不允许携带查询串 Notify_url string `json:"notify_url"` //订单优惠标记 Goods_tag string `json:"goods_tag,omitempty"` //订单金额信息 Amount OrderCreateAmount `json:"amount"` //统一下单结算信息 Settle_info OrderCreateSettle `json:"settle_info"` //支付场景描述 Scene_info WxH5SceneInfo `json:"scene_info"` }
统一下单请求参数
type WxH5SceneInfo ¶
type WxPayInfo ¶
type WxPayInfo struct { //应用ID(普通商户) Appid string `json:"appid"` //服务商户号(普通商户) Mchid string `json:"mchid"` //服务商用ID(服务商) Sp_appid string `json:"sp_appid"` //服务商户号(服务商) Sp_mchid string `json:"sp_mchid"` //子商户用ID(服务商) Sub_appid string `json:"sub_appid"` //子商户的商户号(服务商) Sub_mchid string `json:"sub_mchid"` //商户系统内部订单号 Out_trade_no string `json:"out_trade_no"` //微信支付订单号 Transaction_id string `json:"transaction_id"` //交易类型,枚举值:JSAPI Trade_type string `json:"trade_type"` //交易状态,SUCCESS:支付成功 REFUND:转入退款 NOTPAY:未支付 CLOSED:已关闭 PAYERROR:支付失败 Trade_state string `json:"trade_state"` //交易状态描述 Trade_state_desc string `json:"trade_state_desc"` //付款银行 Bank_type string `json:"bank_type"` //附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 Attach string `json:"attach"` //支付完成时间 Success_time string `json:"success_time"` //订单金额信息 Amount OrderAmount `json:"amount"` //支付者信息 Payer OrderPayer `json:"payer"` }
微信支付订单在信息
type WxPayMch ¶
type WxPayMch struct {
MchParam
}
func NewWxPayMch ¶
func NewWxPayMch(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *WxPayMch
func (*WxPayMch) CloseOrder ¶
关闭支付订单 out_trade_no:业务订单号 mchid:商户号
func (*WxPayMch) CreateOrderApp ¶
func (ent *WxPayMch) CreateOrderApp(data OsAppOrderData) (RawAppPayParam, error)
App支付统一下单
func (*WxPayMch) CreateOrderH5 ¶
func (ent *WxPayMch) CreateOrderH5(data WxH5OrderData) (string, error)
H5支付统一下单
func (*WxPayMch) CreateOrderJsApi ¶
func (ent *WxPayMch) CreateOrderJsApi(data JsApiOrderData) (WxAppPayParam, error)
JsApi支付统一下单 data:支付订单信息 sub_mch_id:子商户号, 传空格即可
func (*WxPayMch) CreateOrderNative ¶
func (ent *WxPayMch) CreateOrderNative(data NativeOrderData) (string, error)
Native支付统一下单
func (*WxPayMch) CreateOrderNativeNew ¶ added in v0.0.2
func (ent *WxPayMch) CreateOrderNativeNew(data NativeOrderDataNew) (string, error)
Native支付统一下单
func (*WxPayMch) QueryByOutTradeNo ¶
支付订单查询 out_trade_no:业务订单号 mchid:商户号
func (*WxPayMch) QueryByTransactionId ¶
支付订单查询 transaction_id:微信支付订单号 mchid:商户号
func (*WxPayMch) QueryRefundOrder ¶
func (ent *WxPayMch) QueryRefundOrder(out_refund_no string, mchid string) (RefundOrderInfo, error)
查询单笔退款 out_refund_no:商户系统内部的退款单号 mchid:商户号
func (*WxPayMch) RefundOrder ¶
func (ent *WxPayMch) RefundOrder(data RefundCreateReq) (RefundOrderInfo, error)
提交退款申请
type WxPayMid ¶
type WxPayMid struct {
MchParam
}
func NewWxPayMid ¶
func NewWxPayMid(mchid, appid, mch_api_key string, pem_cert *x509.Certificate, pem_key *rsa.PrivateKey) *WxPayMid
func (*WxPayMid) CloseOrder ¶
关闭支付订单 out_trade_no:业务订单号 mchid:子商户号
func (*WxPayMid) CreateOrderApp ¶
func (ent *WxPayMid) CreateOrderApp(data OsAppOrderData) (RawAppPayParam, error)
App支付统一下单
func (*WxPayMid) CreateOrderH5 ¶
func (ent *WxPayMid) CreateOrderH5(data WxH5OrderData) (string, error)
H5支付统一下单
func (*WxPayMid) CreateOrderJsApi ¶
func (ent *WxPayMid) CreateOrderJsApi(data JsApiOrderData) (WxAppPayParam, error)
JsApi支付统一下单 data:支付订单信息 sub_mch_id:子商户号
func (*WxPayMid) CreateOrderNative ¶
func (ent *WxPayMid) CreateOrderNative(data NativeOrderData) (string, error)
Native支付统一下单
func (*WxPayMid) QueryByOutTradeNo ¶
支付订单查询 out_trade_no:业务订单号 mchid:子商户号
func (*WxPayMid) QueryByOutTradeNo1 ¶
支付订单查询 out_trade_no:业务订单号 mchid:子商户号
func (*WxPayMid) QueryByTransactionId ¶
支付订单查询 transaction_id:微信支付订单号 mchid:子商户号
func (*WxPayMid) QueryRefundOrder ¶
func (ent *WxPayMid) QueryRefundOrder(out_refund_no string, mchid string) (RefundOrderInfo, error)
查询单笔退款 out_refund_no:商户系统内部的退款单号 mchid:子商户号
func (*WxPayMid) RefundOrder ¶
func (ent *WxPayMid) RefundOrder(data RefundCreateReq) (RefundOrderInfo, error)
提交退款申请
type WxPayNotifyRet ¶
支付通知返回数据结构
type WxPayer ¶
type WxPayer interface { // App支付统一下单 CreateOrderApp(data OsAppOrderData) (RawAppPayParam, error) // JsApi支付统一下单 CreateOrderJsApi(data JsApiOrderData) (WxAppPayParam, error) // Native支付统一下单 CreateOrderNative(data NativeOrderData) (string, error) // H5支付统一下单 CreateOrderH5(data WxH5OrderData) (string, error) // 支付订单查询 QueryByTransactionId(transaction_id string, mchid string) (WxPayInfo, error) // 支付订单查询 QueryByOutTradeNo(out_trade_no string, mchid string) (WxPayInfo, error) // 关闭支付订单 CloseOrder(out_trade_no string, mchid string) error // 提交退款申请 RefundOrder(data RefundCreateReq) (RefundOrderInfo, error) // 查询单笔退款 QueryRefundOrder(out_refund_no string, mchid string) (RefundOrderInfo, error) }
type WxSignParam ¶
type WxSignParam struct { Timestamp string //微信支付回包时间戳 Nonce string //微信支付回包随机字符串 Signature string //微信支付回包签名信息 CertSerial string //微信支付回包平台序列号 RequestId string //微信支付回包请求ID Body string }
func (*WxSignParam) BuildResponseMessage ¶
func (ent *WxSignParam) BuildResponseMessage() string
构造验签名串
func (*WxSignParam) GetFromCallBackRequest ¶
func (ent *WxSignParam) GetFromCallBackRequest(r *http.Request, body string) error
func (*WxSignParam) GetFromHttpResponse ¶
func (ent *WxSignParam) GetFromHttpResponse(response *http.Response, body string) error
Source Files
¶
- base_aes_gcm.go
- base_http.go
- base_rsa_sign.go
- data_base_notice.go
- data_base_pay.go
- data_base_refund.go
- data_mch_app.go
- data_mch_h5.go
- data_mch_jsapi.go
- data_mch_native.go
- data_mch_wxapp.go
- logger.go
- param_app.go
- param_wxapp.go
- pem_base.go
- pem_plat.go
- wx_mch.go
- wx_mch_app.go
- wx_mch_h5.go
- wx_mch_jsapi.go
- wx_mch_native.go
- wx_mch_wxapp.go
- wx_mid.go
- wx_mid_app.go
- wx_mid_h5.go
- wx_mid_jsapi.go
- wx_mid_native.go
- wx_mid_wxapp.go
- wx_pay.go