Documentation ¶
Index ¶
- Constants
- type App
- func (app *App) GetJsApi(param GetJsApi) (params GetJsApiResult, err error)
- 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)
- type ErrResp
- type GetJsApi
- type GetJsApiResult
- 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
Constants ¶
const ( WechatPayAPIServer = "https://api.mch.weixin.qq.com/v3" // 微信支付 API 地址 WechatPayAPIServerBackup = "https://api2.mch.weixin.qq.com/v3" // 微信支付 API 备份地址 )
微信支付 API 地址
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 }
func (*App) GetJsApi ¶
func (app *App) GetJsApi(param GetJsApi) (params GetJsApiResult, err error)
GetJsApi JSAPI调起支付API https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_4.shtml
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
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 返回参数