Documentation
¶
Index ¶
- func DyCheckSign(timestamp, nonce, body, signature, pubKeyStr string) (bool, error)
- func PemToRSAPublicKey(pemKeyStr string) (*rsa.PublicKey, error)
- type AccessTokenData
- type AccessTokenReq
- type AccessTokenResp
- type CensorImgResponse
- type Client
- func (u *Client) CensorImage(ctx context.Context, bm gopay.BodyMap) (resp *CensorImgResponse, err error)
- func (u *Client) Code2Session(ctx context.Context, bm gopay.BodyMap) (resp *Code2SessionData, err error)
- func (u *Client) CreateOrder(ctx context.Context, bm gopay.BodyMap) (createOrderData *CreateOrderData, err error)
- func (u *Client) GetAccessToken(ctx context.Context) (*AccessTokenData, error)
- func (u *Client) GetByteAuthorization(orderInfo *RequestOrderData, privateKeyStr, timestamp, keyVersion string) (string, error)
- func (u *Client) PushOrder(ctx context.Context, bm gopay.BodyMap) (resp *PushOrderResponse, err error)
- func (u *Client) QueryOrder(ctx context.Context, bm gopay.BodyMap) (createOrderData *CreateOrderData, err error)
- func (c *Client) SetBodySize(sizeMB int)
- func (c *Client) SetToken(token string)
- func (u *Client) TextAnti(ctx context.Context, bm gopay.BodyMap) (resp *TextAntiResponse, err error)
- func (c *Client) VerifySign(notifyReq *NotifyRequest) (err error)
- type Code2SessionData
- type Code2SessionResponse
- type CpsInfoData
- type CreateOrderData
- type CreateOrderResponse
- type NotifyMsgResp
- type NotifyRequest
- type NotifyResp
- type PaymentInfoData
- type Predict
- type PushOrderResponse
- type QueryOrderResponse
- type RequestOrderData
- type RequestOrderRespFail
- type RequestOrderRespSuccess
- type RequestOrderSchema
- type RequestOrderSkuList
- type TextAntiData
- type TextAntiResponse
- type TextPredict
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DyCheckSign ¶
验签示例
Types ¶
type AccessTokenData ¶
type AccessTokenReq ¶
type AccessTokenResp ¶
type AccessTokenResp struct { Data *AccessTokenData `json:"data,omitempty"` ErrCode int `json:"err_no"` ErrMsg string `json:"err_tips"` }
type CensorImgResponse ¶
type Client ¶
type Client struct { AppId string MchId string ApiKey string BaseURL string NotifyUrl string Salt string // 盐值 Token string // 支付设置 token IsProd bool // 是否生产环境 DebugSwitch gopay.DebugSwitch // 调试开关,是否打印日志 // contains filtered or unexported fields }
Client douyin
func (*Client) CensorImage ¶
func (*Client) Code2Session ¶
func (u *Client) Code2Session(ctx context.Context, bm gopay.BodyMap) (resp *Code2SessionData, err error)
https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/server/log-in/code-2-session 小程序免登
func (*Client) CreateOrder ¶
func (u *Client) CreateOrder(ctx context.Context, bm gopay.BodyMap) (createOrderData *CreateOrderData, err error)
预下单接口 https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/server/ecpay/pay-list/pay
func (*Client) GetAccessToken ¶
func (u *Client) GetAccessToken(ctx context.Context) (*AccessTokenData, error)
func (*Client) GetByteAuthorization ¶
func (u *Client) GetByteAuthorization(orderInfo *RequestOrderData, privateKeyStr, timestamp, keyVersion string) (string, error)
通用交易支付
func (*Client) PushOrder ¶
func (*Client) QueryOrder ¶
func (u *Client) QueryOrder(ctx context.Context, bm gopay.BodyMap) (createOrderData *CreateOrderData, err error)
支付结果查询 https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/server/ecpay/pay-list/query
func (*Client) SetBodySize ¶
SetBodySize 设置http response body size(MB)
func (*Client) TextAnti ¶
func (*Client) VerifySign ¶
func (c *Client) VerifySign(notifyReq *NotifyRequest) (err error)
担保支付回调签名算法 参数:"strArr" 所有字段(验证时注意不包含 sign 签名本身,不包含空字段与 type 常量字段)内容与平台上配置的 token
type Code2SessionData ¶
type Code2SessionResponse ¶
type Code2SessionResponse struct { ErrNo int `json:"err_no,omitempty"` // 执行结果 ErrTips string `json:"err_tips,omitempty"` // 返回错误信息 Data *Code2SessionData `json:"data,omitempty"` }
type CpsInfoData ¶
type CreateOrderData ¶
type CreateOrderResponse ¶
type CreateOrderResponse struct { ErrNo int `json:"err_no,omitempty"` // 执行结果 ErrTips string `json:"err_tips,omitempty"` // 返回错误信息 Data *CreateOrderData `json:"data"` }
type NotifyMsgResp ¶
type NotifyMsgResp struct { AppId string `json:"appid,omitempty"` // 当前交易发起的小程序id CpOrderno string `json:"cp_orderno,omitempty"` // 开发者侧的订单号 CpExtra string `json:"cp_extra,omitempty"` // 预下单时开发者传入字段 Way string `json:"way,omitempty"` // 支付渠道 1-微信支付,2-支付宝支付,10-抖音支付 ChannelNo string `json:"channel_no,omitempty"` // 支付渠道侧单号 PaymentOrderNo string `json:"payment_order_no,omitempty"` // 支付渠道侧PC单号 TotalAmount int `json:"total_amount,omitempty"` // 支付金额,单位为分 Status string `json:"status,omitempty"` // 固定 SUCCESS ItemId string `json:"item_id,omitempty"` // 订单来源视频对应视频 id SellerUid string `json:"seller_uid,omitempty"` // 该笔交易卖家商户号 PaidAt int64 `json:"paid_at,omitempty"` // 支付时间,Unix 时间戳 OrderId string `json:"order_id,omitempty"` // 抖音侧订单号 }
func ParseNotify ¶
func ParseNotify(req *http.Request) (*NotifyMsgResp, error)
type NotifyRequest ¶
type NotifyResp ¶
type PaymentInfoData ¶
type PaymentInfoData struct { TotalFee int `json:"total_fee,omitempty"` // 支付金额 OrderStatus string `json:"order_status,omitempty"` // 支付状态枚举值 PayTime string `json:"pay_time,omitempty"` // 支付完成时间 Way int `json:"way,omitempty"` // 支付渠道 ChannelNo string `json:"channel_no,omitempty"` // 支付渠道侧的支付单号 SellerUid string `json:"seller_uid,omitempty"` // 该笔交易卖家商户号 ItemId string `json:"item_id,omitempty"` // 订单来源视频对应视频 id CpExtra string `json:"cp_extra,omitempty"` // 预下单时开发者传入字段 }
type PushOrderResponse ¶
type QueryOrderResponse ¶
type QueryOrderResponse struct { ErrNo int `json:"err_no,omitempty"` // 执行结果 ErrTips string `json:"err_tips,omitempty"` // 返回错误信息 OutOrderNo string `json:"out_order_no,omitempty"` // 开发者侧的订单号 OrderId string `json:"order_id,omitempty"` // 抖音侧的订单号 PaymentInfo *PaymentInfoData `json:"payment_info,omitempty"` // 支付信息 CpsInfo *CpsInfoData `json:"cps_info,omitempty"` // cps信息 }
type RequestOrderData ¶
type RequestOrderData struct { SkuList []*RequestOrderSkuList `json:"skuList,omitempty"` // 下单商品信息 OutOrderNo string `json:"outOrderNo,omitempty"` // 外部订单号 TotalAmount int64 `json:"totalAmount,omitempty"` // 订单总金额 PayExpireSeconds int `json:"payExpireSeconds,omitempty"` // 支付超时时间 PayNotifyUrl string `json:"payNotifyUrl,omitempty"` // 支付结果通知地址 MerchantUid string `json:"merchantUid,omitempty"` // 开发者自定义收款商户号 OrderEntrySchema *RequestOrderSchema `json:"orderEntrySchema,omitempty"` // 订单详情页 LimitPayWayList []int `json:"limitPayWayList,omitempty"` // 屏蔽的支付方式 }
type RequestOrderRespFail ¶
type RequestOrderRespSuccess ¶
type RequestOrderSchema ¶
type RequestOrderSchema struct { Path string `json:"path,omitempty"` Params string `json:"params,omitempty"` }
商品详情页链接
type RequestOrderSkuList ¶
type RequestOrderSkuList struct { SkuId string `json:"skuId,omitempty"` // 外部商品id Price int64 `json:"price,omitempty"` // 价格 单位:分 Quantity int `json:"quantity,omitempty"` // 购买数量 0 < quantity <= 100 Title string `json:"title,omitempty"` ImageList []string `json:"imageList,omitempty"` Type int `json:"type,omitempty"` // 根据接入规范,选择适合的商品类型ID传入 TagGroupId string `json:"tagGroupId,omitempty"` EntrySchema *RequestOrderSchema `json:"entrySchema,omitempty"` // 商品详情页链接 }
type TextAntiData ¶
type TextAntiData struct { Msg string `json:"msg,omitempty"` Code int `json:"code,omitempty"` TaskId string `json:"task_id,omitempty"` Predicts []TextPredict `json:"predicts,omitempty"` }
type TextAntiResponse ¶
type TextPredict ¶
Click to show internal directories.
Click to hide internal directories.