Documentation ¶
Index ¶
- type App
- func (app *App) GetJsApi(param GetJsApi) (result GetJsApiResult, err error)
- func (app *App) NewParamsWith(params ...Params) Params
- func (app *App) PayTransactionsId(param PayTransactionsId) (resp PayTransactionsIdResult, result ErrResp, err error)
- func (app *App) PayTransactionsJsapi(param PayTransactionsJsapi) (resp PayTransactionsJsapiResult, result ErrResp, err error)
- func (app *App) PayTransactionsOutTradeNo(param PayTransactionsOutTradeNo) (resp PayTransactionsOutTradeNoResult, result ErrResp, err error)
- func (app *App) PayTransactionsOutTradeNoClose(OutTradeNo string) (result ErrResp, err error)
- func (app *App) RefundDomesticRefunds(notMustParams ...Params) (resp RefundDomesticRefundsResult, result ErrResp, err error)
- func (app *App) RefundDomesticRefundsOutRefundNo(OutRefundNo string) (resp RefundDomesticRefundsOutRefundNoResult, result ErrResp, err error)
- type ErrResp
- type GetJsApi
- type GetJsApiResult
- type Params
- type PayTransactionsId
- type PayTransactionsIdResult
- type PayTransactionsJsapi
- type PayTransactionsJsapiAmount
- type PayTransactionsJsapiDetail
- type PayTransactionsJsapiDetailGoodsDetail
- type PayTransactionsJsapiPayer
- type PayTransactionsJsapiResult
- type PayTransactionsJsapiSceneInfo
- type PayTransactionsJsapiSceneInfoStoreInfo
- type PayTransactionsJsapiSettleInfo
- type PayTransactionsOutTradeNo
- type PayTransactionsOutTradeNoResult
- type RefundDomesticRefundsOutRefundNoResult
- type RefundDomesticRefundsResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { AppId string // 小程序或者公众号的appid AppSecret string MchId string // 微信支付的商户id AesKey string ApiV3 string PrivateSerialNo string // 私钥证书号 MchPrivateKey string // 商户私有证书内容 apiclient_key.pem }
App 微信支付服务
func (*App) GetJsApi ¶
func (app *App) GetJsApi(param GetJsApi) (result GetJsApiResult, err error)
GetJsApi JSAPI调起支付API https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_4.shtml
func (*App) NewParamsWith ¶ added in v1.0.38
func (*App) PayTransactionsId ¶
func (app *App) PayTransactionsId(param PayTransactionsId) (resp PayTransactionsIdResult, result ErrResp, err error)
PayTransactionsId 微信支付订单号查询 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml
func (*App) PayTransactionsJsapi ¶
func (app *App) PayTransactionsJsapi(param PayTransactionsJsapi) (resp PayTransactionsJsapiResult, result ErrResp, err error)
PayTransactionsJsapi 小程序 JSAPI下单 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_1.shtml
func (*App) PayTransactionsOutTradeNo ¶
func (app *App) PayTransactionsOutTradeNo(param PayTransactionsOutTradeNo) (resp PayTransactionsOutTradeNoResult, result ErrResp, err error)
PayTransactionsOutTradeNo 商户订单号查询 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml
func (*App) PayTransactionsOutTradeNoClose ¶ added in v1.0.38
PayTransactionsOutTradeNoClose 关闭订单API https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_3.shtml
func (*App) RefundDomesticRefunds ¶ added in v1.0.38
func (app *App) RefundDomesticRefunds(notMustParams ...Params) (resp RefundDomesticRefundsResult, result ErrResp, err error)
RefundDomesticRefunds 申请退款API https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_26.shtml
func (*App) RefundDomesticRefundsOutRefundNo ¶ added in v1.0.38
func (app *App) RefundDomesticRefundsOutRefundNo(OutRefundNo string) (resp RefundDomesticRefundsOutRefundNoResult, result ErrResp, err error)
RefundDomesticRefundsOutRefundNo 查询单笔退款API https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_5_10.shtml
type ErrResp ¶
type ErrResp struct { Code string `json:"code"` Message string `json:"message"` Detail struct { Field string `json:"field,omitempty"` Value interface{} `json:"value"` Issue string `json:"issue,omitempty"` Location string `json:"location"` } `json:"detail"` }
ErrResp 错误返回
type GetJsApiResult ¶
type GetJsApiResult struct { AppId string // 应用ID TimeStamp string // 时间戳 NonceStr string // 随机字符串 Package string // 订单详情扩展字符串 SignType string // 签名方式 PaySign string // 签名 }
GetJsApiResult 返回参数
type PayTransactionsId ¶
type PayTransactionsId struct {
TransactionId string `json:"transaction_id"`
}
type PayTransactionsIdResult ¶
type PayTransactionsIdResult struct { Appid string `json:"appid"` Mchid string `json:"mchid"` OutTradeNo string `json:"out_trade_no"` TransactionId string `json:"transaction_id,omitempty"` TradeType string `json:"trade_type,omitempty"` TradeState string `json:"trade_state"` TradeStateDesc string `json:"trade_state_desc"` BankType string `json:"bank_type,omitempty"` Attach string `json:"attach,omitempty"` SuccessTime string `json:"success_time,omitempty"` Payer struct { Openid string `json:"openid"` } `json:"payer"` Amount struct { Total int `json:"total,omitempty"` PayerTotal int `json:"payer_total,omitempty"` Currency string `json:"currency,omitempty"` PayerCurrency string `json:"payer_currency,omitempty"` } `json:"amount,omitempty"` SceneInfo struct { DeviceId string `json:"device_id,omitempty"` } PromotionDetail []struct { CouponId string `json:"coupon_id"` Name string `json:"name,omitempty"` Scope string `json:"scope,omitempty"` Type string `json:"type,omitempty"` Amount int `json:"amount"` StockId string `json:"stock_id,omitempty"` WechatpayContribute int `json:"wechatpay_contribute,omitempty"` MerchantContribute int `json:"merchant_contribute,omitempty"` OtherContribute int `json:"other_contribute,omitempty"` Currency string `json:"currency,omitempty"` GoodsDetail []struct { GoodsId string `json:"goods_id"` Quantity int `json:"quantity"` UnitPrice int `json:"unit_price"` DiscountAmount int `json:"discount_amount"` GoodsRemark string `json:"goods_remark,omitempty"` } `json:"goods_detail"` } }
PayTransactionsIdResult 返回参数
type PayTransactionsJsapi ¶
type PayTransactionsJsapi struct { Description string `json:"description"` //【是】商品描述 OutTradeNo string `json:"out_trade_no"` //【是】商户订单号 TimeExpire time.Time `json:"time_expire,omitempty"` //【否】交易结束时间 Attach string `json:"attach,omitempty"` //【否】附加数据 NotifyUrl string `json:"notify_url"` //【是】通知地址 GoodsTag string `json:"goods_tag,omitempty"` //【否】订单优惠标记 Amount *PayTransactionsJsapiAmount `json:"amount"` //【是】订单金额 Payer *PayTransactionsJsapiPayer `json:"payer"` //【是】支付者 Detail *PayTransactionsJsapiDetail `json:"detail,omitempty"` //【否】优惠功能 SceneInfo *PayTransactionsJsapiSceneInfo `json:"scene_info,omitempty"` //【否】场景信息 SettleInfo *PayTransactionsJsapiSettleInfo `json:"settle_info,omitempty"` //【否】结算信息 }
PayTransactionsJsapi 入参
type PayTransactionsJsapiAmount ¶
type PayTransactionsJsapiAmount struct { Total int `json:"total"` //【是】总金额 Currency string `json:"currency,omitempty"` //【否】货币类型 }
PayTransactionsJsapiAmount 订单金额
type PayTransactionsJsapiDetail ¶
type PayTransactionsJsapiDetail struct { CostPrice int `json:"cost_price,omitempty"` //【否】订单原价 InvoiceId string `json:"invoice_id,omitempty"` //【否】商品小票ID GoodsDetail []PayTransactionsJsapiDetailGoodsDetail `json:"goods_detail,omitempty"` //【否】单品列表 }
PayTransactionsJsapiDetail 优惠功能
type PayTransactionsJsapiDetailGoodsDetail ¶
type PayTransactionsJsapiDetailGoodsDetail struct { MerchantGoodsId string `json:"merchant_goods_id"` //【是】商户侧商品编码 WechatpayGoodsId string `json:"wechatpay_goods_id,omitempty"` //【否】微信侧商品编码 GoodsName string `json:"goods_name,omitempty"` //【否】商品名称 Quantity int `json:"quantity"` //【是】商品数量 UnitPrice int `json:"unit_price"` //【是】商品单价 }
PayTransactionsJsapiDetailGoodsDetail 单品列表
type PayTransactionsJsapiPayer ¶
type PayTransactionsJsapiPayer struct {
Openid string `json:"openid"` //【是】用户标识
}
PayTransactionsJsapiPayer 支付者
type PayTransactionsJsapiResult ¶
type PayTransactionsJsapiResult struct {
PrepayId string `json:"prepay_id"`
}
PayTransactionsJsapiResult 返回参数
type PayTransactionsJsapiSceneInfo ¶
type PayTransactionsJsapiSceneInfo struct { PayerClientIp string `json:"payer_client_ip"` //【是】用户终端IP DeviceId string `json:"device_id,omitempty"` //【否】商户端设备号 StoreInfo *PayTransactionsJsapiSceneInfoStoreInfo `json:"store_info,omitempty"` //【否】商户门店信息 }
PayTransactionsJsapiSceneInfo 场景信息
type PayTransactionsJsapiSceneInfoStoreInfo ¶
type PayTransactionsJsapiSceneInfoStoreInfo struct { Id string `json:"id"` //【是】门店编号 Name string `json:"name,omitempty"` //【否】门店名称 AreaCode string `json:"area_code,omitempty"` //【否】地区编码 Address string `json:"address,omitempty"` //【否】详细地址 }
PayTransactionsJsapiSceneInfoStoreInfo 商户门店信息
type PayTransactionsJsapiSettleInfo ¶
type PayTransactionsJsapiSettleInfo struct {
ProfitSharing bool `json:"profit_sharing,omitempty"` //【否】是否指定分账
}
PayTransactionsJsapiSettleInfo 结算信息
type PayTransactionsOutTradeNo ¶
type PayTransactionsOutTradeNo struct {
OutTradeNo string `json:"out_trade_no"`
}
type PayTransactionsOutTradeNoResult ¶
type PayTransactionsOutTradeNoResult struct { Appid string `json:"appid"` Mchid string `json:"mchid"` OutTradeNo string `json:"out_trade_no"` TransactionId string `json:"transaction_id,omitempty"` TradeType string `json:"trade_type,omitempty"` TradeState string `json:"trade_state"` TradeStateDesc string `json:"trade_state_desc"` BankType string `json:"bank_type,omitempty"` Attach string `json:"attach,omitempty"` SuccessTime string `json:"success_time,omitempty"` Payer struct { Openid string `json:"openid"` } `json:"payer"` Amount struct { Total int `json:"total,omitempty"` PayerTotal int `json:"payer_total,omitempty"` Currency string `json:"currency,omitempty"` PayerCurrency string `json:"payer_currency,omitempty"` } `json:"amount,omitempty"` SceneInfo struct { DeviceId string `json:"device_id,omitempty"` } PromotionDetail []struct { CouponId string `json:"coupon_id"` Name string `json:"name,omitempty"` Scope string `json:"scope,omitempty"` Type string `json:"type,omitempty"` Amount int `json:"amount"` StockId string `json:"stock_id,omitempty"` WechatpayContribute int `json:"wechatpay_contribute,omitempty"` MerchantContribute int `json:"merchant_contribute,omitempty"` OtherContribute int `json:"other_contribute,omitempty"` Currency string `json:"currency,omitempty"` GoodsDetail []struct { GoodsId string `json:"goods_id"` Quantity int `json:"quantity"` UnitPrice int `json:"unit_price"` DiscountAmount int `json:"discount_amount"` GoodsRemark string `json:"goods_remark,omitempty"` } `json:"goods_detail"` } }
PayTransactionsOutTradeNoResult 返回参数
type RefundDomesticRefundsOutRefundNoResult ¶ added in v1.0.38
type RefundDomesticRefundsOutRefundNoResult struct { RefundId string `json:"refund_id"` // 微信支付退款单号 OutRefundNo string `json:"out_refund_no"` // 商户退款单号 TransactionId string `json:"transaction_id"` // 微信支付订单号 OutTradeNo string `json:"out_trade_no"` // 商户订单号 Channel string `json:"channel"` // 退款渠道 UserReceivedAccount string `json:"user_received_account"` // 退款入账账户 SuccessTime string `json:"success_time,omitempty"` // 退款成功时间 CreateTime string `json:"create_time"` // 退款创建时间 Status string `json:"status"` // 退款状态 FundsAccount string `json:"funds_account,omitempty"` // 资金账户 Amount struct { Total int `json:"total"` // 订单金额 Refund int `json:"refund"` // 退款金额 From []struct { Account string `json:"account"` // 出资账户类型 Amount int `json:"amount"` // 出资金额 } `json:"from,omitempty"` PayerTotal int `json:"payer_Total"` // 用户支付金额 PayerRefund int `json:"payer_Refund"` // 用户退款金额 SettlementRefund int `json:"settlement_Refund"` // 应结退款金额 SettlementTotal int `json:"settlement_total"` // 应结订单金额 DiscountRefund int `json:"discount_refund"` // 优惠退款金额 Currency string `json:"currency"` // 退款币种 } `json:"amount"` // 金额信息 PromotionDetail []struct { PromotionId string `json:"promotion_id"` // 券ID Scope string `json:"scope"` // 优惠范围 Type string `json:"type"` // 优惠类型 Amount int `json:"amount"` // 优惠券面额 RefundAmount int `json:"refund_amount"` // 优惠退款金额 GoodsDetail []struct { MerchantGoodsId string `json:"merchant_goods_id"` // 商户侧商品编码 WechatpayGoodsId string `json:"wechatpay_goods_id,omitempty"` // 微信侧商品编码 GoodsName string `json:"goods_name,omitempty"` // 商品名称 UnitPrice int `json:"unit_price"` // 商品单价 RefundAmount int `json:"refund_amount"` // 商品退款金额 RefundQuantity int `json:"refund_quantity"` // 商品退货数量 } `json:"goods_detail"` } `json:"promotion_detail,omitempty"` // 优惠退款信息 }
type RefundDomesticRefundsResult ¶ added in v1.0.38
type RefundDomesticRefundsResult struct { RefundId string `json:"refund_id"` // 微信支付退款单号 OutRefundNo string `json:"out_refund_no"` // 商户退款单号 TransactionId string `json:"transaction_id"` // 微信支付订单号 OutTradeNo string `json:"out_trade_no"` // 商户订单号 Channel string `json:"channel"` // 退款渠道 UserReceivedAccount string `json:"user_received_account"` // 退款入账账户 SuccessTime string `json:"success_time,omitempty"` // 退款成功时间 CreateTime string `json:"create_time"` // 退款创建时间 Status string `json:"status"` // 退款状态 FundsAccount string `json:"funds_account,omitempty"` // 资金账户 Amount struct { Total int `json:"total"` // 订单金额 Refund int `json:"refund"` // 退款金额 From []struct { Account string `json:"account"` // 出资账户类型 Amount int `json:"amount"` // 出资金额 } `json:"from,omitempty"` PayerTotal int `json:"payer_Total"` // 用户支付金额 PayerRefund int `json:"payer_Refund"` // 用户退款金额 SettlementRefund int `json:"settlement_Refund"` // 应结退款金额 SettlementTotal int `json:"settlement_total"` // 应结订单金额 DiscountRefund int `json:"discount_refund"` // 优惠退款金额 Currency string `json:"currency"` // 退款币种 } `json:"amount"` // 金额信息 PromotionDetail []struct { PromotionId string `json:"promotion_id"` // 券ID Scope string `json:"scope"` // 优惠范围 Type string `json:"type"` // 优惠类型 Amount int `json:"amount"` // 优惠券面额 RefundAmount int `json:"refund_amount"` // 优惠退款金额 GoodsDetail []struct { MerchantGoodsId string `json:"merchant_goods_id"` // 商户侧商品编码 WechatpayGoodsId string `json:"wechatpay_goods_id,omitempty"` // 微信侧商品编码 GoodsName string `json:"goods_name,omitempty"` // 商品名称 UnitPrice int `json:"unit_price"` // 商品单价 RefundAmount int `json:"refund_amount"` // 商品退款金额 RefundQuantity int `json:"refund_quantity"` // 商品退货数量 } `json:"goods_detail"` } `json:"promotion_detail,omitempty"` // 优惠退款信息 }