Documentation ¶
Index ¶
- func MapToString(params Params) string
- type Client
- func (c *Client) CreateOrder(body, outTradeNo string, totalFee int64) (rslt *OrderInfo, err error)
- func (c *Client) Notify(req *http.Request) (msgData *NotifyMsgData, ret *NotifyReturn, err error)
- func (c *Client) QueryOrder(outTradeNo string) (rslt *QueryOrderRespData, err error)
- func (c *Client) Refund(outTradeNo, outRefundNo, refundDesc string, refundFee int64) (refundNo string, err error)
- func (c *Client) RefundNotify(req *http.Request) (msgData *RefundNotifyMsgData, ret *NotifyReturn, err error)
- func (c *Client) RefundQuery(outRefundNo string) (rslt *RefundQueryData, err error)
- func (c *Client) SetRefundNotifyUrl(refundNotifyUrl string)
- func (c *Client) ValidSign(params Params) bool
- type CreateOrderReq
- type CreateOrderResp
- type NotifyMsgData
- type NotifyReq
- type NotifyReturn
- type OrderInfo
- type Params
- type QueryOrderResp
- type QueryOrderRespData
- type RefundNotifyMsgData
- type RefundQueryData
- type RefundQueryResp
- type RefundResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapToString ¶
Types ¶
type Client ¶
type Client struct { AppId string //传入的appID NotifyURL string //异步通知地址 OrderTime int //订单有效分钟数 SALT string //向小程序平台发送请求时的密钥 Token string //小程序平台向开发者服务端发送请求时的密钥 Extra string //开发者自定义字段,回调原样回传 RefundNotifyUrl string //退款回调地址 }
func (*Client) CreateOrder ¶
预下单
func (*Client) Notify ¶
func (c *Client) Notify(req *http.Request) (msgData *NotifyMsgData, ret *NotifyReturn, err error)
回调
func (*Client) QueryOrder ¶
func (c *Client) QueryOrder(outTradeNo string) (rslt *QueryOrderRespData, err error)
订单查询
func (*Client) Refund ¶ added in v0.6.8
func (c *Client) Refund(outTradeNo, outRefundNo, refundDesc string, refundFee int64) (refundNo string, err error)
申请退款
func (*Client) RefundNotify ¶ added in v0.6.8
func (c *Client) RefundNotify(req *http.Request) (msgData *RefundNotifyMsgData, ret *NotifyReturn, err error)
退款回调
func (*Client) RefundQuery ¶ added in v0.6.8
func (c *Client) RefundQuery(outRefundNo string) (rslt *RefundQueryData, err error)
退款查询
func (*Client) SetRefundNotifyUrl ¶ added in v0.6.8
type CreateOrderReq ¶
type CreateOrderReq struct { AppId string `json:"app_id"` Sign string `json:"sign"` OutOrderNo string `json:"out_order_no"` TotalAmount int64 `json:"total_amount"` Subject string `json:"subject"` Body string `json:"body"` ValidTime int64 `json:"valid_time"` CpExtra string `json:"cp_extra"` NotifyUrl string `json:"notify_url"` DisableMsg int64 `json:"disable_msg"` }
type CreateOrderResp ¶
type CreateOrderResp struct { ErrNo int64 `json:"err_no"` ErrTips string `json:"err_tips"` Data *OrderInfo `json:"data"` }
预下单应答参数
type NotifyMsgData ¶
type NotifyMsgData struct { Appid string `json:"appid"` CpOrderno string `json:"cp_orderno"` //开发者传入订单号 Way string `json:"way"` //way 字段中标识了支付渠道:2-支付宝,1-微信 CpExtra string `json:"cp_extra"` //预下单时开发者传入字段 }
回调信息包括 msg 信息为以下内容序列化得到的 json 字符串
type NotifyReq ¶
type NotifyReq struct { Timestamp int64 `json:"timestamp"` Nonce string `json:"nonce"` //随机数 Msg string `json:"msg"` //订单信息的json字符串 Type string `json:"type"` //回调类型标记,支付成功回调为"payment" MsgSignature string `json:"msg_signature"` //签名 }
支付回调请求参数
type NotifyReturn ¶
回调响应参数
type QueryOrderResp ¶
type QueryOrderResp struct { ErrNo int64 `json:"err_no"` ErrTips string `json:"err_tips"` OutOrderNo string `json:"out_order_no"` OrderId string `json:"order_id"` PaymentInfo *QueryOrderRespData `json:"payment_info"` }
查询订单应答参数
type QueryOrderRespData ¶ added in v0.6.4
type QueryOrderRespData struct { TotalFee int64 `json:"total_fee"` OrderStatus string `json:"order_status"` //PROCESSING-处理中|SUCCESS-成功|FAIL-失败|TIMEOUT-超时 PayTime string `json:"pay_time"` //支付时间 Way int64 `json:"way"` //支付渠道 2-支付宝,1-微信,3-银行卡 ChannelNo string `json:"channel_no"` //渠道单号 ChannelGatewayNo string `json:"channel_gateway_no"` //渠道网关号 }
type RefundNotifyMsgData ¶ added in v0.6.8
type RefundNotifyMsgData struct { Appid string `json:"appid"` CpRefundno string `json:"cp_refundno"` //开发者自定义的退款单号 CpExtra string `json:"cp_extra"` //预下单时开发者传入字段 Status string `json:"status"` //退款状态 PROCESSING-处理中|SUCCESS-成功|FAIL-失败 RefundAmount int64 `json:"refund_amount"` //退款金额 }
退款回调信息包括 msg 信息为以下内容序列化得到的 json 字符串
type RefundQueryData ¶ added in v0.6.8
type RefundQueryResp ¶ added in v0.6.8
type RefundQueryResp struct { ErrNo int64 `json:"err_no"` ErrTips string `json:"err_tips"` RefundInfo *RefundQueryData `json:"refundInfo"` }
查询退款应答参数
type RefundResp ¶ added in v0.6.8
type RefundResp struct { ErrNo int64 `json:"err_no"` ErrTips string `json:"err_tips"` RefundNo string `json:"refund_no"` }
申请退款应答参数
Click to show internal directories.
Click to hide internal directories.