Documentation
¶
Index ¶
- func VerifySignMd5(verifyParams map[string]string, payKey string, sign string) bool
- func WaxVerifyParams(req WaxPayNotifyReq) map[string]string
- func WaxpayVerifySign(verifyParams map[string]string, signKey string, sign string) bool
- func WxVerifyParams(req *WxPayNotifyReq) map[string]string
- type AppPayRet
- type AppRet
- type AppUnifiedOrder
- type RedPack
- type RedPackResp
- type SendRedPackReq
- type UnifiedOrder
- type UnifiedOrderResp
- type WaxPayNotifyReq
- type WaxPayNotifyResp
- type WaxPayRet
- type WaxRet
- type WePay
- func (m *WePay) AppPay(totalFee int) (results *AppPayRet, outTradeNo string, err error)
- func (m *WePay) AppPayStruct(order AppUnifiedOrder) (results *AppPayRet, outTradeNo string, err error)
- func (m *WePay) SendRedPack(totalAmount int64, openID, sendName, wishing, actName, remark string) (string, *RedPackResp, error)
- func (m *WePay) SendRedPackByStruct(req *SendRedPackReq) (string, *RedPackResp, error)
- func (m *WePay) WaxPay(totalFee int, openID string) (results *WaxPayRet, outTradeNo string, err error)
- type WxPayNotifyReq
- type WxPayNotifyReqCoupon
- type WxaUnifiedOrder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifySignMd5 ¶
VerifySignMd5 验证签名
func WaxVerifyParams ¶
func WaxVerifyParams(req WaxPayNotifyReq) map[string]string
WaxVerifyParams 微信小程序待验证参数
func WaxpayVerifySign ¶
WaxpayVerifySign 微信小程序支付签名验证
func WxVerifyParams ¶
func WxVerifyParams(req *WxPayNotifyReq) map[string]string
WxVerifyParams Struct2Map
Types ¶
type AppPayRet ¶
type AppPayRet struct { AppRet AppID string `json:"appid,omitempty"` // 应用ID PartnerID string `json:"partnerid,omitempty"` // 微信支付分配的商户号 PrepayID string `json:"prepayid,omitempty"` // 预支付交易会话ID Package string `json:"package,omitempty"` // 扩展字段 暂填写固定值Sign=WXPay Sign string `json:"sign,omitempty"` // 签名 }
AppPayRet 下单返回内容
type AppRet ¶
type AppRet struct { Timestamp string `json:"timestamp,omitempty"` // 时间戳 NonceStr string `json:"noncestr,omitempty"` // 随机字符串 }
AppRet 返回的基本内容
type AppUnifiedOrder ¶
type AppUnifiedOrder struct { UnifiedOrder SceneInfo string `json:"scene_info"` //场景信息 }
AppUnifiedOrder APP统一下单
type RedPack ¶
type RedPack interface {
Send(payKey, certFile, keyFile, rootCaFile string) (*RedPackResp, error)
}
RedPack 发送红包接口
type RedPackResp ¶
type RedPackResp struct { ReturnMsg string `xml:"return_msg"` MchID string `xml:"mch_id"` WxAppID string `xml:"wxappid"` ReOpenid string `xml:"re_openid"` TotalAmount string `xml:"total_amount"` ReturnCode string `xml:"return_code"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` MchBillNo string `xml:"mch_billno"` // 以下发送裂变红包的时候才会用到 SendTime string `xml:"send_time"` SendListID string `xml:"send_listid"` }
RedPackResp 发送红包返回值
type SendRedPackReq ¶
type SendRedPackReq struct { XMLName xml.Name `xml:"xml"` NonceStr string `xml:"nonce_str,omitempty" json:"nonce_str"` // NonceStr 随机字符串 Sign string `xml:"sign,omitempty" json:"sign"` // Sign 签名 MchBillNo string `xml:"mch_billno,omitempty" json:"mch_billno"` // MchBillNo 商户订单号 MchID string `xml:"mch_id,omitempty" json:"mch_id"` // MchID 商户号 WxAppID string `xml:"wxappid,omitempty" json:"wxappid"` // WxAppID 公众账号APPID SendName string `xml:"send_name,omitempty" json:"send_name"` // SendName 商户名称,发送者名称 ReOpenID string `xml:"re_openid,omitempty" json:"re_openid"` // ReOpenID 用户OpenID TotalAmount int64 `xml:"total_amount,omitempty" json:"total_amount"` // TotalAmount 发送金额大小 TotalNum int `xml:"total_num,omitempty" json:"total_num"` // TotalNum 发送数量 Wishing string `xml:"wishing,omitempty" json:"wishing"` // Wishing 红包祝福语 ClientIP string `xml:"client_ip,omitempty" json:"client_ip"` // ClientIP 服务器ID ActName string `xml:"act_name,omitempty" json:"act_name"` // ActName 活动名称 Remark string `xml:"remark,omitempty" json:"remark"` // Remark 备注 SceneID string `xml:"scene_id,omitempty" json:"scene_id"` // SceneID 场景ID RiskInfo string `xml:"risk_info,omitempty" json:"risk_info"` // RiskInfo 活动信息 ConsumeMchID string `xml:"consume_mch_id,omitempty" json:"consume_mch_id"` // ConsumeMchID 资金授权商户号 }
SendRedPackReq 发送普通红包请求参数
func (*SendRedPackReq) Send ¶
func (m *SendRedPackReq) Send(payKey string, certFile, keyFile, rootCaFile string) (*RedPackResp, error)
Send 发送普通红包
type UnifiedOrder ¶
type UnifiedOrder struct { XMLName xml.Name `xml:"xml"` //xml标签 AppID string `xml:"appid" json:"appid"` //Appid MchID string `xml:"mch_id" json:"mch_id"` //微信支付分配的商户号,必须 DeviceInfo string `xml:"device_info" json:"device_info"` //微信支付填"WEB",必须 NonceStr string `xml:"nonce_str" json:"nonce_str"` //随机字符串,必须 Sign string `xml:"sign" json:"sign"` //签名,必须 SignType string `xml:"sign_type" json:"sign_type"` //"HMAC-SHA256"或者"MD5",非必须,默认MD5 Body string `xml:"body" json:"body"` //商品简单描述,必须 Detail string `xml:"detail,omitempty" json:"detail,omitempty"` //商品详细列表,使用json格式 Attach string `xml:"attach" json:"attach"` //附加数据,如"贵阳分店",非必须 OutTradeNo string `xml:"out_trade_no" json:"out_trade_no"` //订单号,必须 FeeType string `xml:"fee_type,omitempty" json:"fee_type,omitempty"` //默认人民币:CNY,非必须 TotalFee int `xml:"total_fee" json:"total_fee"` //订单金额,单位分,必须 SpBillCreateIP string `xml:"spbill_create_ip" json:"spbill_create_ip"` //支付提交客户端IP,如“123.123.123.123”,必须 TimeStart string `xml:"time_start,omitempty" json:"time_start,omitempty"` //订单生成时间,格式为yyyyMMddHHmmss,如20170324094700,非必须 TimeExpire string `xml:"time_expire,omitempty" json:"time_expire,omitempty"` //订单结束时间,格式同上,非必须 GoodsTag string `xml:"goods_tag,omitempty" json:"goods_tag,omitempty"` //商品标记,代金券或立减优惠功能的参数,非必须 NotifyURL string `xml:"notify_url" json:"notify_url"` //接收微信支付异步通知回调地址,不能携带参数,必须 TradeType string `xml:"trade_type" json:"trade_type"` //交易类型,小程序写"JSAPI",APP 写 APP LimitPay string `xml:"limit_pay,omitempty" json:"limit_pay,omitempty"` //限制某种支付方式,非必须 }
UnifiedOrder 统一下单公共参数
type UnifiedOrderResp ¶
type UnifiedOrderResp struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` AppID string `xml:"appid"` MchID string `xml:"mch_id"` DeviceInfo string `xml:"device_info"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` TradeType string `xml:"trade_type"` PrepayID string `xml:"prepay_id"` }
UnifiedOrderResp 统一下单返回
func NewUnifiedOrder ¶
func NewUnifiedOrder(unifiedOrder interface{}) (unifiedOrderResp UnifiedOrderResp, err error)
NewUnifiedOrder 统一下单
type WaxPayNotifyReq ¶
type WaxPayNotifyReq struct { AppID string `xml:"appid"` MchID string `xml:"mch_id"` BankType string `xml:"bank_type"` CashFee float64 `xml:"cash_fee"` FeeType string `xml:"fee_type"` IsSubscribe string `xml:"is_subscribe"` NonceStr string `xml:"nonce_str"` OpenID string `xml:"openid"` OutTradeNo string `xml:"out_trade_no"` ResultCode string `xml:"result_code"` ReturnCode string `xml:"return_code"` Sign string `xml:"sign"` TimeEnd string `xml:"time_end"` TotalFee float64 `xml:"total_fee"` TradeType string `xml:"trade_type"` TransactionID string `xml:"transaction_id"` }
WaxPayNotifyReq WaxPayNotifyReq
type WaxPayNotifyResp ¶
type WaxPayNotifyResp struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` }
WaxPayNotifyResp WaxPayNotifyResp
type WaxPayRet ¶
type WaxPayRet struct { WaxRet AppID string `json:"appId,omitempty"` // 应用ID Package string `json:"package,omitempty"` // 扩展字段 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=* SignType string `json:"signType,omitempty"` // 签名算法,暂支持 MD5 PaySign string `json:"paySign,omitempty"` // 签名 }
WaxPayRet 微信小程序下单返回内容
type WaxRet ¶
type WaxRet struct { Timestamp string `json:"timeStamp,omitempty"` // 时间戳 NonceStr string `json:"nonceStr,omitempty"` // 随机字符串 }
WaxRet 返回的基本内容
type WePay ¶
type WePay struct { AppID string // 微信应用APPId或小程序APPId MchID string // 商户号 PayKey string // 支付密钥 NotifyURL string // 回调地址 TradeType string // 小程序写"JSAPI",客户端写"APP" Body string // 商品描述 必填 CertFile string // 微信支付平台证书 RootCaFile string // 微信支付平台根证书 // contains filtered or unexported fields }
WePay 微信支付配置类
func (*WePay) AppPayStruct ¶
func (m *WePay) AppPayStruct(order AppUnifiedOrder) (results *AppPayRet, outTradeNo string, err error)
AppPayStruct 自定义参数实现,需要自定义
func (*WePay) SendRedPack ¶
func (m *WePay) SendRedPack(totalAmount int64, openID, sendName, wishing, actName, remark string) (string, *RedPackResp, error)
SendRedPack 简单调用方法
func (*WePay) SendRedPackByStruct ¶
func (m *WePay) SendRedPackByStruct(req *SendRedPackReq) (string, *RedPackResp, error)
SendRedPackByStruct 自定义发送红包参数
type WxPayNotifyReq ¶
type WxPayNotifyReq struct { XMLName xml.Name `xml:"xml" json:"-"` Appid string `xml:"appid" json:"appid,omitempty"` // APPID MchID string `xml:"mch_id" json:"mch_id,omitempty"` // 商户号 DeviceInfo string `xml:"device_info" json:"device_info,omitempty"` // 微信支付分配的终端设备号, NonceStr string `xml:"nonce_str" json:"nonce_str,omitempty"` // 随机字符串,不长于32位 Sign string `xml:"sign" json:"-"` // 签名 ResultCode string `xml:"result_code" json:"result_code,omitempty"` // 业务状态 ErrCode string `xml:"err_code" json:"err_code,omitempty"` // 错误代码 ErrCodeDes string `xml:"err_code_des" json:"err_code_des,omitempty"` // 错误代码描述 Openid string `xml:"openid" json:"openid,omitempty"` // 用户OpenID IsSubscribe string `xml:"is_subscribe" json:"is_subscribe,omitempty"` // 是否关注公众号 TradeType string `xml:"trade_type" json:"trade_type,omitempty"` // 交易类型 BankType string `xml:"bank_type" json:"bank_type,omitempty"` // 付款银行 TotalFee string `xml:"total_fee" json:"total_fee,omitempty"` // 总金额 FeeType string `xml:"fee_type" json:"fee_type,omitempty"` // 货币种类 CashFee string `xml:"cash_fee" json:"cash_fee,omitempty"` // 现金支付金额 CashFeeType string `xml:"cash_fee_type" json:"cash_fee_type,omitempty"` // 现金支付类型 CouponFee string `xml:"coupon_fee" json:"coupon_fee,omitempty"` // 代币券金额 CouponCount string `xml:"coupon_count" json:"coupon_count,omitempty"` // 代币券使用数量 Coupon []WxPayNotifyReqCoupon `xml:"-" json:"-"` // 代币券数组 TransactionID string `xml:"transaction_id" json:"transaction_id,omitempty"` // 微信支付ID OutTradeNo string `xml:"out_trade_no" json:"out_trade_no,omitempty"` // 商户支付ID Attach string `xml:"attach" json:"attach,omitempty"` // 商家数据包 TimeEnd string `xml:"time_end" json:"time_end,omitempty"` // 支付完成时间 SubMchID string `xml:"sub_mch_id" json:"sub_mch_id,omitempty"` // 商户号 ReturnCode string `xml:"return_code" json:"return_code,omitempty"` // 返回状态 }
type WxPayNotifyReqCoupon ¶
type WxaUnifiedOrder ¶
type WxaUnifiedOrder struct { UnifiedOrder OpenID string `xml:"openid" json:"openid"` //微信用户唯一标识,必须 }
WxaUnifiedOrder 微信小程序统一下单
Click to show internal directories.
Click to hide internal directories.