Documentation ¶
Index ¶
- Variables
- type APIResult
- type APP
- func (payment *APP) CloseOrder(ctx context.Context, req *CloseOrderRequest) (*core.APIResult, error)
- func (payment *APP) Prepay(ctx context.Context, req interface{}) (interface{}, *core.APIResult, error)
- func (payment *APP) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
- func (payment *APP) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
- type Amount
- type Bridge
- func (b *Bridge) CloseOrder(ctx context.Context, req *CloseOrderRequest) (*core.APIResult, error)
- func (b *Bridge) Prepay(ctx context.Context, req interface{}) (interface{}, *core.APIResult, error)
- func (b *Bridge) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
- func (b *Bridge) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
- type CloseOrderRequest
- type CombineApp
- func (payment *CombineApp) CloseOrder(ctx context.Context, req *CloseOrderRequest) (*core.APIResult, error)
- func (payment *CombineApp) Prepay(ctx context.Context, req interface{}) (*Response, *core.APIResult, error)
- func (payment *CombineApp) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
- func (payment *CombineApp) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
- type CombineAppPrepayRequest
- type CombineTransaction
- type H5Payment
- func (payment *H5Payment) CloseOrder(ctx context.Context, req *CloseOrderRequest) (*core.APIResult, error)
- func (payment *H5Payment) Prepay(ctx context.Context, req interface{}) (interface{}, *core.APIResult, error)
- func (payment *H5Payment) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
- func (payment *H5Payment) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
- type Jsapi
- func (payment *Jsapi) CloseOrder(ctx context.Context, req *CloseOrderRequest) (*core.APIResult, error)
- func (payment *Jsapi) Prepay(ctx context.Context, req interface{}) (interface{}, *core.APIResult, error)
- func (payment *Jsapi) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
- func (payment *Jsapi) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
- type Native
- func (payment *Native) CloseOrder(ctx context.Context, req *CloseOrderRequest) (*core.APIResult, error)
- func (payment *Native) Prepay(ctx context.Context, req interface{}) (interface{}, *core.APIResult, error)
- func (payment *Native) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
- func (payment *Native) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
- type Option
- func WithAppId(appId string) Option
- func WithCertSerialNum(certSerialNum string) Option
- func WithCertificate(cert string) Option
- func WithCertificateFile(certFile string) Option
- func WithKey(key string) Option
- func WithMchId(mchId string) Option
- func WithNotifyUrl(notifyUrl string) Option
- func WithPrivateKey(privateKey string) Option
- func WithPrivateKeyFile(privateKeyFile string) Option
- func WithRefundNotifyUrl(refundNotifyUrl string) Option
- type Options
- type PayerInfo
- type Payment
- type PaymentType
- type PrepayRequest
- type PromotionDetail
- type PromotionGoodsDetail
- type QueryOrderByIdRequest
- type QueryOrderByOutTradeNoRequest
- type Response
- type SceneInfo
- type SettleInfo
- type StoreInfo
- type SubOrder
- type TransactionAmount
- type TransactionPayer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotSupportPayApiType = errors.New("未支持的支付类型") ErrorPrepayConf = errors.New("错误的配置类型") )
Functions ¶
This section is empty.
Types ¶
type APIResult ¶
type APIResult struct { // 本次请求所使用的 HTTPRequest Request *http.Request // 本次请求所获得的 HTTPResponse Response *http.Response }
APIResult 微信支付API v3 请求结果
type APP ¶
type APP struct {
// contains filtered or unexported fields
}
func (*APP) CloseOrder ¶
func (*APP) QueryOrderById ¶
func (payment *APP) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
func (*APP) QueryOrderByTradeNo ¶
func (payment *APP) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
type Amount ¶
type Amount struct { // 订单总金额,单位为分 Total *int64 `json:"total"` // CNY:人民币,境内商户号仅支持人民币。 Currency *string `json:"currency,omitempty"` }
func (Amount) MarshalJSON ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
func (*Bridge) CloseOrder ¶
func (*Bridge) QueryOrderById ¶
func (b *Bridge) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
func (*Bridge) QueryOrderByTradeNo ¶
func (b *Bridge) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
type CloseOrderRequest ¶
type CloseOrderRequest struct {
OutTradeNo string
}
type CombineApp ¶
func (*CombineApp) CloseOrder ¶
func (payment *CombineApp) CloseOrder(ctx context.Context, req *CloseOrderRequest) (*core.APIResult, error)
func (*CombineApp) QueryOrderById ¶
func (payment *CombineApp) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
func (*CombineApp) QueryOrderByTradeNo ¶
func (payment *CombineApp) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
type CombineAppPrepayRequest ¶
type CombineAppPrepayRequest struct { // 合单商户appid CombineAppid *string `json:"combine_appid"` // 合单商户号 CombineMchid *string `json:"combine_mchid"` // 合单商户订单号 CombineOutTradeNo *string `json:"combine_out_trade_no"` // 场景信息 SceneInfo []SceneInfo `json:"scene_info,omitempty"` // 子单信息 SubOrders []SubOrder `json:"sub_orders"` // 支付者 CombinePayerInfo []PayerInfo `json:"combine_payer_info,omitempty"` // 交易起始时间 TimeStart *string `json:"time_start,omitempty"` // 交易结束时间 TimeExpire *string `json:"time_expire,omitempty"` // 通知地址 NotifyUrl *string `json:"notify_url"` }
func (CombineAppPrepayRequest) Clone ¶
func (c CombineAppPrepayRequest) Clone() *CombineAppPrepayRequest
func (CombineAppPrepayRequest) MarshalJSON ¶
func (c CombineAppPrepayRequest) MarshalJSON() ([]byte, error)
func (CombineAppPrepayRequest) String ¶
func (c CombineAppPrepayRequest) String() string
type CombineTransaction ¶
type CombineTransaction struct { Mchid *string `json:"mchid,omitempty"` TradeType *string `json:"trade_type,omitempty"` TradeState *string `json:"trade_state,omitempty"` BankType *string `json:"bank_type,omitempty"` Attach *string `json:"attach,omitempty"` SuccessTime *string `json:"success_time,omitempty"` TransactionId *string `json:"transaction_id,omitempty"` OutTradeNo *string `json:"out_trade_no,omitempty"` PromotionDetail []PromotionDetail `json:"promotion_detail,omitempty"` // 优惠 Amount *TransactionAmount `json:"amount,omitempty"` }
type H5Payment ¶
type H5Payment struct {
// contains filtered or unexported fields
}
func (*H5Payment) CloseOrder ¶
func (*H5Payment) QueryOrderById ¶
func (payment *H5Payment) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
func (*H5Payment) QueryOrderByTradeNo ¶
func (payment *H5Payment) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
type Jsapi ¶
type Jsapi struct {
// contains filtered or unexported fields
}
func (*Jsapi) CloseOrder ¶
func (*Jsapi) QueryOrderById ¶
func (payment *Jsapi) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
func (*Jsapi) QueryOrderByTradeNo ¶
func (payment *Jsapi) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
type Native ¶
type Native struct {
// contains filtered or unexported fields
}
func (*Native) CloseOrder ¶
func (*Native) QueryOrderById ¶
func (payment *Native) QueryOrderById(ctx context.Context, req *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error)
func (*Native) QueryOrderByTradeNo ¶
func (payment *Native) QueryOrderByTradeNo(ctx context.Context, req *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error)
type Option ¶
type Option func(*Options)
func WithCertSerialNum ¶
func WithCertificate ¶
func WithCertificateFile ¶
func WithNotifyUrl ¶
func WithPrivateKey ¶
func WithPrivateKeyFile ¶
func WithRefundNotifyUrl ¶
type PayerInfo ¶
type PayerInfo struct {
OpenId *string `json:"open_id,omitempty"`
}
func (PayerInfo) MarshalJSON ¶
type Payment ¶
type Payment interface { CloseOrder(context.Context, *CloseOrderRequest) (*core.APIResult, error) Prepay(context.Context, interface{}) (interface{}, *core.APIResult, error) QueryOrderById(context.Context, *QueryOrderByIdRequest) (*payments.Transaction, *core.APIResult, error) QueryOrderByTradeNo(context.Context, *QueryOrderByOutTradeNoRequest) (*payments.Transaction, *core.APIResult, error) }
type PaymentType ¶
type PaymentType string
const ( PaymentTypeAPP PaymentType = "APP" // app 支付 PaymentTypeJSAPI PaymentType = "JSAPI" // jsapi 支付 或 小程序支付 PaymentTypeH5 PaymentType = "H5" // h5 支付 PaymentTypeNative PaymentType = "NATIVE" // native 网页支付 PaymentTypeJSSDK PaymentType = "JSSDK" )
type PrepayRequest ¶
type PrepayRequest struct { Description *string // 商品描述 OutTradeNo *string // 商户订单号 TimeExpire *time.Time // 订单失效时间 Attach *string // 附加数据 GoodsTag *string // 回调 URL 地址 LimitPay []string // 商品标记 SupportFapiao *bool // 传入true时,支付成功消息和支付详情页将出现开票入口。需要在微信支付商户平台或微信公众平台开通电子发票功能,传此字段才可生效。 Total *int64 // 订单总金额 Currency *string // 支付币种 CostPrice *int64 // 1.商户侧一张小票订单可能被分多次支付,订单原价用于记录整张小票的交易金额。 2.当订单原价与支付金额不相等,则不享受优惠。 3.该字段主要用于防止同一张小票分多次支付,以享受多次优惠的情况,正常支付订单不必上传此参数。 InvoiceId *string // 商家小票ID。 GoodsName *string // 商品的实际名称。 MerchantGoodsId *string // 由半角的大小写字母、数字、中划线、下划线中的一种或几种组成。 Quantity *int64 // 用户购买的数量。 UnitPrice *int64 // 商品单价,单位为分。 WechatpayGoodsId *string // 微信支付定义的统一商品编号(没有可不传)。 ProfitSharing *bool // 是否指定分账 DeviceId *string // 商户端设备号 ClientIp *string // 用户终端IP StoreAddress *string // 详细的商户门店地址 StoreAreaCode *string // 地区编码,详细请见微信支付提供的文档 StoreId *string // 商户侧门店编号 StoreName *string // 商户侧门店名称 NotifyUrl *string // 支付回调地址 }
type PromotionDetail ¶
type PromotionDetail struct { // 券ID CouponId *string `json:"coupon_id,omitempty"` // 优惠名称 Name *string `json:"name,omitempty"` // GLOBAL:全场代金券;SINGLE:单品优惠 Scope *string `json:"scope,omitempty"` // CASH:充值;NOCASH:预充值。 Type *string `json:"type,omitempty"` // 优惠券面额 Amount *int64 `json:"amount,omitempty"` // 活动ID,批次ID StockId *string `json:"stock_id,omitempty"` // 单位为分 WechatpayContribute *int64 `json:"wechatpay_contribute,omitempty"` // 单位为分 MerchantContribute *int64 `json:"merchant_contribute,omitempty"` // 单位为分 OtherContribute *int64 `json:"other_contribute,omitempty"` // CNY:人民币,境内商户号仅支持人民币。 Currency *string `json:"currency,omitempty"` GoodsDetail []PromotionGoodsDetail `json:"goods_detail,omitempty"` }
PromotionDetail
type PromotionGoodsDetail ¶
type PromotionGoodsDetail struct { // 商品编码 GoodsId *string `json:"goods_id"` // 商品数量 Quantity *int64 `json:"quantity"` // 商品价格 UnitPrice *int64 `json:"unit_price"` // 商品优惠金额 DiscountAmount *int64 `json:"discount_amount"` // 商品备注 GoodsRemark *string `json:"goods_remark,omitempty"` }
PromotionGoodsDetail
type QueryOrderByIdRequest ¶
type QueryOrderByIdRequest struct {
TransactionId string
}
type QueryOrderByOutTradeNoRequest ¶
type QueryOrderByOutTradeNoRequest struct {
OutTradeNo string
}
type SceneInfo ¶
type SceneInfo struct { // 用户终端IP PayerClientIp *string `json:"payer_client_ip"` // 商户端设备号 DeviceId *string `json:"device_id,omitempty"` StoreInfo *StoreInfo `json:"store_info,omitempty"` }
SceneInfo 支付场景描述
func (SceneInfo) MarshalJSON ¶
type SettleInfo ¶
type SettleInfo struct { // 是否指定分账 ProfitSharing *bool `json:"profit_sharing,omitempty"` // 补差金额 SubsidyAmount *int64 `json:"subsidy_amount,omitempty"` }
SettleInfo
func (SettleInfo) Clone ¶
func (o SettleInfo) Clone() *SettleInfo
func (SettleInfo) MarshalJSON ¶
func (o SettleInfo) MarshalJSON() ([]byte, error)
func (SettleInfo) String ¶
func (o SettleInfo) String() string
type StoreInfo ¶
type StoreInfo struct { // 商户侧门店编号 Id *string `json:"id"` // 商户侧门店名称 Name *string `json:"name,omitempty"` // 地区编码,详细请见微信支付提供的文档 AreaCode *string `json:"area_code,omitempty"` // 详细的商户门店地址 Address *string `json:"address,omitempty"` }
StoreInfo 商户门店信息
func (StoreInfo) MarshalJSON ¶
type SubOrder ¶
type SubOrder struct { // 子单商户号 Mchid *string `json:"mchid"` // 附加数据 Attach *string `json:"attach"` // 订单金额 Amount *Amount `json:"amount"` // 子单商户订单号 OutTradeNo *string `json:"out_trade_no"` // 订单优惠标记 GoodsTag *string `json:"goods_tag,omitempty"` // 商品描述 Description *string `json:"description"` SettleInfo *SettleInfo `json:"settle_info,omitempty"` }
SubOrder 子单信息
func (SubOrder) MarshalJSON ¶
type TransactionAmount ¶
type TransactionAmount struct { Currency *string `json:"currency,omitempty"` PayerCurrency *string `json:"payer_currency,omitempty"` PayerTotal *int64 `json:"payer_total,omitempty"` Total *int64 `json:"total,omitempty"` }
TransactionAmount
type TransactionPayer ¶
type TransactionPayer struct {
Openid *string `json:"openid,omitempty"`
}
TransactionPayer
Click to show internal directories.
Click to hide internal directories.