Documentation ¶
Index ¶
- Variables
- func CloseOrder2(outTradeNo string) (err error)
- func GetInt64Str(d int64) string
- func GetIntStr(d int) string
- func GetLocalIp() string
- func GetMchBillno() string
- func GetOutRefundNo() string
- func GetOutTradeNo() string
- func GetPartnerRefundNo() string
- func InitWechatMch(app_id, mch_id, api_key string, certKeys ...string) error
- func JsapiUnifiedOrder(totalFee int64, ...) (resp *pay.UnifiedOrderResponse, err error)
- func Md5(key string) string
- func MicroPay2(totalFee int64, outTradeNo, body, spbillCreateIP, authCode string) (resp *pay.MicroPayResponse, err error)
- func OrderQuery2(outTradeNo string, params ...string) (resp *pay.OrderQueryResponse, err error)
- func Refund2(totalFee, refundFee int64, outTradeNo, outRefundNo string, params ...string) (resp *pay.RefundResponse, err error)
- func RefundQuery2(outTradeNo string, params ...string) (resp *pay.RefundQueryResponse, err error)
- func Reverse2(outTradeNo string, params ...string) (resp *pay.ReverseResponse, err error)
- func UnifiedOrder(req *pay.UnifiedOrderRequest) (resp *pay.UnifiedOrderResponse, err error)
- type CommonConfig
Constants ¶
This section is empty.
Variables ¶
var ( MchCommonConfig *CommonConfig MchClient *core.Client MchTLSClient *core.Client )
Functions ¶
func GetInt64Str ¶
func GetLocalIp ¶
func GetLocalIp() string
func InitWechatMch ¶
构建通用配置
func JsapiUnifiedOrder ¶
func JsapiUnifiedOrder(totalFee int64, openId, outTradeNo, body, spbillCreateIP, notifyURL, detail, attach, goodsTag string) (resp *pay.UnifiedOrderResponse, err error)
简化 wechat.v2 中部分参数
totalFee 订单总金额,单位为分,详见支付金额 openId 用户在商户appid下的唯一标识 outTradeNo 商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号 body 商品或支付单简要描述 spbillCreateIP APP和网页支付提交用户端ip,Native支付填调用微信支付API的机器IP notifyURL 接收微信支付异步通知回调地址,通知url必须为直接可访问的url,不能携带参数 detail 商品名称明细列表。 attach 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
UnifiedOrderResponse PrepayId为微信生成预支付绘画标示,用于后续接口使用,有效期为两小时 TradeType为取值如下:JSAPI,NATIVE,APP, JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付,统一下单接口trade_type的传参可参考这里 MICROPAY--刷卡支付,刷卡支付有单独的支付接口,不调用统一下单接口
统一下单
func MicroPay2 ¶
func MicroPay2(totalFee int64, outTradeNo, body, spbillCreateIP, authCode string) (resp *pay.MicroPayResponse, err error)
func OrderQuery2 ¶
func OrderQuery2(outTradeNo string, params ...string) (resp *pay.OrderQueryResponse, err error)
查询订单
func Refund2 ¶
func Refund2(totalFee, refundFee int64, outTradeNo, outRefundNo string, params ...string) (resp *pay.RefundResponse, err error)
Refund 申请退款. NOTE: 请求需要双向证书.
func RefundQuery2 ¶
func RefundQuery2(outTradeNo string, params ...string) (resp *pay.RefundQueryResponse, err error)
RefundQuery 查询退款. out_trade_no // 商户订单号 transaction_id // 微信订单号 out_refund_no // 商户退款单号 refund_id // 微信退款单号
func Reverse2 ¶
func Reverse2(outTradeNo string, params ...string) (resp *pay.ReverseResponse, err error)
Reverse 撤销订单. NOTE: 请求需要双向证书.
func UnifiedOrder ¶
func UnifiedOrder(req *pay.UnifiedOrderRequest) (resp *pay.UnifiedOrderResponse, err error)
Types ¶
type CommonConfig ¶
type CommonConfig struct { AppId string `json:"app_id"` //微信分配的公众号id MchId string `json:"mch_id"` //微信支付分配的商户号 ApiKey string `json:"api_key"` //微信支付分配的商户号 }
func (*CommonConfig) SetApiKey ¶
func (m *CommonConfig) SetApiKey(api_key string)
func (*CommonConfig) SetAppId ¶
func (m *CommonConfig) SetAppId(app_id string)
func (*CommonConfig) SetMchId ¶
func (m *CommonConfig) SetMchId(mch_id string)