wechat

package
v1.5.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success     = 0
	SignTypeRSA = "RSA"

	MethodGet           = "GET"
	MethodPost          = "POST"
	MethodPut           = "PUT"
	MethodDelete        = "DELETE"
	HeaderAuthorization = "Authorization"

	HeaderTimestamp = "Wechatpay-Timestamp"
	HeaderNonce     = "Wechatpay-Nonce"
	HeaderSignature = "Wechatpay-Signature"
	HeaderSerial    = "Wechatpay-Serial"

	Authorization = "WECHATPAY2-SHA256-RSA2048"

	// 订单号类型,1-微信订单号,2-商户订单号,3-微信侧回跳到商户前端时用于查单的单据查询id(查询支付分订单中会使用)
	TransactionId OrderNoType = 1
	OutTradeNo    OrderNoType = 2
	QueryId       OrderNoType = 3

	// v3 异步通知订单状态
	TradeStateSuccess  = "SUCCESS"    // 支付成功
	TradeStateRefund   = "REFUND"     // 转入退款
	TradeStateNoPay    = "NOTPAY"     // 未支付
	TradeStateClosed   = "CLOSED"     // 已关闭
	TradeStateRevoked  = "REVOKED"    // 已撤销(付款码支付)
	TradeStatePaying   = "USERPAYING" // 用户支付中(付款码支付)
	TradeStatePayError = "PAYERROR"   // 支付失败(其他原因,如银行返回失败)
)

Variables

This section is empty.

Functions

func V3ParseNotifyToBodyMap

func V3ParseNotifyToBodyMap(req *http.Request) (bm gopay.BodyMap, err error)

Deprecated 解析微信回调请求的参数到 gopay.BodyMap

暂时不推荐此方法,请使用 wechat.V3ParseNotify()

func V3VerifySign

func V3VerifySign(timestamp, nonce, signBody, sign, wxPkContent string) (err error)

V3VerifySign 微信V3 版本验签

wxPkContent:微信平台证书公钥内容,通过client.GetPlatformCerts() 获取

Types

type Amount

type Amount struct {
	Total         int    `json:"total,omitempty"`          // 订单总金额,单位为分
	PayerTotal    int    `json:"payer_total,omitempty"`    // 用户支付金额,单位为分
	Currency      string `json:"currency,omitempty"`       // CNY:人民币,境内商户号仅支持人民币
	PayerCurrency string `json:"payer_currency,omitempty"` // 用户支付币种
}

type AppPayParams

type AppPayParams struct {
	Appid     string `json:"appid"`
	Partnerid string `json:"partnerid"`
	Prepayid  string `json:"prepayid"`
	Package   string `json:"package"`
	Noncestr  string `json:"noncestr"`
	Timestamp string `json:"timestamp"`
	PaySign   string `json:"paySign"`
}

type AppletParams

type AppletParams struct {
	AppId     string `json:"appId"`
	TimeStamp string `json:"timeStamp"`
	NonceStr  string `json:"nonceStr"`
	Package   string `json:"package"`
	SignType  string `json:"signType"`
	PaySign   string `json:"paySign"`
}

type BillDetail

type BillDetail struct {
	BillSequence int    `json:"bill_sequence"` // 商户将多个文件按账单文件序号的顺序合并为完整的资金账单文件,起始值为1
	HashType     string `json:"hash_type"`
	HashValue    string `json:"hash_value"`
	DownloadUrl  string `json:"download_url"`
	EncryptKey   string `json:"encrypt_key"` // 加密账单文件使用的加密密钥。密钥用商户证书的公钥进行加密,然后进行Base64编码
	Nonce        string `json:"nonce"`       // 加密账单文件使用的随机字符串
}

type BillRsp

type BillRsp struct {
	Code     int        `json:"-"`
	SignInfo *SignInfo  `json:"-"`
	Response *TradeBill `json:"response,omitempty"`
	Error    string     `json:"-"`
}

交易、资金账单 Rsp

type ClientV3

type ClientV3 struct {
	Appid    string
	Mchid    string
	SerialNo string

	DebugSwitch gopay.DebugSwitch
	// contains filtered or unexported fields
}

ClientV3 微信支付 V3

func NewClientV3

func NewClientV3(appid, mchid, serialNo, apiV3Key, pkContent string) (client *ClientV3, err error)

NewClientV3 初始化微信客户端 V3

appid:appid 或者服务商模式的 sp_appid
mchid:商户ID 或者服务商模式的 sp_mchid
serialNo:商户证书的证书序列号
apiV3Key:apiV3Key,商户平台获取
pkContent:私钥 apiclient_key.pem 读取后的字符串内容

func (*ClientV3) AutoVerifySign

func (c *ClientV3) AutoVerifySign(wxPkContent string)

AutoVerifySign 开启请求完自动验签功能(默认不开启,推荐开启)

注意:未获取到微信平台公钥时,不要开启,请调用 client.GetPlatformCerts() 获取微信平台证书公钥

func (*ClientV3) DecryptCerts

func (c *ClientV3) DecryptCerts(ciphertext, nonce, additional string) (wxCerts string, err error)

解密加密的证书

func (*ClientV3) GetPlatformCerts

func (c *ClientV3) GetPlatformCerts() (certs *PlatformCertRsp, err error)

获取微信平台证书公钥(获取后自行保存使用,如需定期刷新功能,自行实现)

注意事项
如果自行实现验证平台签名逻辑的话,需要注意以下事项:
  - 程序实现定期更新平台证书的逻辑,不要硬编码验证应答消息签名的平台证书
  - 定期调用该接口,间隔时间小于12 小时
  - 加密请求消息中的敏感信息时,使用最新的平台证书(即:证书启用时间较晚的证书)
文档说明:https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay5_1.shtml

func (*ClientV3) PaySignOfApp

func (c *ClientV3) PaySignOfApp(prepayid string) (app *AppPayParams, err error)

PaySignOfApp 获取 App paySign

文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_4.shtml

func (*ClientV3) PaySignOfApplet

func (c *ClientV3) PaySignOfApplet(prepayid string) (applet *AppletParams, err error)

PaySignOfApplet 获取 小程序 paySign

文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_4.shtml

func (*ClientV3) PaySignOfJSAPI

func (c *ClientV3) PaySignOfJSAPI(prepayid string) (jsapi *JSAPIPayParams, err error)

PaySignOfJSAPI 获取 JSAPI paySign

文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_4.shtml

func (*ClientV3) V3BillDownLoadBill

func (c *ClientV3) V3BillDownLoadBill(downloadUrl string) (fileBytes []byte, err error)

下载账单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/bill/chapter3_3.shtml

func (*ClientV3) V3BillFundFlowBill

func (c *ClientV3) V3BillFundFlowBill(bm gopay.BodyMap) (wxRsp *BillRsp, err error)

申请资金账单API

Code = 0 is success
注意:账单日期不可写当天日期
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/bill/chapter3_2.shtml

func (*ClientV3) V3BillLevel2FundFlowBill

func (c *ClientV3) V3BillLevel2FundFlowBill(bm gopay.BodyMap) (wxRsp *Level2FundFlowBillRsp, err error)

申请二级商户资金账单API

Code = 0 is success
注意:账单日期不可写当天日期
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/bill/chapter3_2.shtml

func (*ClientV3) V3BillTradeBill

func (c *ClientV3) V3BillTradeBill(bm gopay.BodyMap) (wxRsp *BillRsp, err error)

申请交易账单API

Code = 0 is success
注意:账单日期不可写当天日期
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/bill/chapter3_1.shtml

func (*ClientV3) V3CombineCloseOrder added in v1.5.34

func (c *ClientV3) V3CombineCloseOrder(tradeNo string, bm gopay.BodyMap) (wxRsp *CloseOrderRsp, err error)

合单关闭订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_12.shtml

func (*ClientV3) V3CombineQueryOrder added in v1.5.34

func (c *ClientV3) V3CombineQueryOrder(traderNo string) (wxRsp *CombineQueryOrderRsp, err error)

合单查询订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_11.shtml

func (*ClientV3) V3CombineTransactionApp added in v1.5.26

func (c *ClientV3) V3CombineTransactionApp(bm gopay.BodyMap) (wxRsp *PrepayRsp, err error)

合单APP下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_1.shtml

func (*ClientV3) V3CombineTransactionH5 added in v1.5.26

func (c *ClientV3) V3CombineTransactionH5(bm gopay.BodyMap) (wxRsp *H5Rsp, err error)

合单H5下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_2.shtml

func (*ClientV3) V3CombineTransactionJsapi added in v1.5.26

func (c *ClientV3) V3CombineTransactionJsapi(bm gopay.BodyMap) (wxRsp *PrepayRsp, err error)

合单JSAPI/小程序下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_3.shtml
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_4.shtml

func (*ClientV3) V3CombineTransactionNative added in v1.5.26

func (c *ClientV3) V3CombineTransactionNative(bm gopay.BodyMap) (wxRsp *NativeRsp, err error)

合单Native下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_5.shtml

func (*ClientV3) V3ComplaintComplete added in v1.5.41

func (c *ClientV3) V3ComplaintComplete(complaintId, complaintedMchid string) (wxRsp *EmptyRsp, err error)

反馈处理完成API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_15.shtml

func (*ClientV3) V3ComplaintDetail added in v1.5.41

func (c *ClientV3) V3ComplaintDetail(complaintId string) (wxRsp *ComplaintDetailRsp, err error)

查询投诉单详情API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_13.shtml

func (*ClientV3) V3ComplaintList added in v1.5.41

func (c *ClientV3) V3ComplaintList(beginDate, endDate, complaintedMchid string, limit, offset int) (wxRsp *ComplaintListRsp, err error)

查询投诉单列表API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_11.shtml

func (*ClientV3) V3ComplaintNegotiationHistory added in v1.5.41

func (c *ClientV3) V3ComplaintNegotiationHistory(complaintId string, limit, offset int) (wxRsp *ComplaintNegotiationHistoryRsp, err error)

查询投诉协商历史API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_12.shtml

func (*ClientV3) V3ComplaintNotifyUrlCreate added in v1.5.41

func (c *ClientV3) V3ComplaintNotifyUrlCreate(url string) (wxRsp *ComplaintNotifyUrlRsp, err error)

创建投诉通知回调地址API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_2.shtml

func (*ClientV3) V3ComplaintNotifyUrlDelete added in v1.5.41

func (c *ClientV3) V3ComplaintNotifyUrlDelete() (wxRsp *EmptyRsp, err error)

删除投诉通知回调地址API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_5.shtml

func (*ClientV3) V3ComplaintNotifyUrlQuery added in v1.5.41

func (c *ClientV3) V3ComplaintNotifyUrlQuery() (wxRsp *ComplaintNotifyUrlRsp, err error)

查询投诉通知回调地址API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_3.shtml

func (*ClientV3) V3ComplaintNotifyUrlUpdate added in v1.5.41

func (c *ClientV3) V3ComplaintNotifyUrlUpdate(url string) (wxRsp *ComplaintNotifyUrlRsp, err error)

更新投诉通知回调地址API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_4.shtml

func (*ClientV3) V3ComplaintResponse added in v1.5.41

func (c *ClientV3) V3ComplaintResponse(complaintId, complaintedMchid, content string, mediaIds []string) (wxRsp *EmptyRsp, err error)

提交回复API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_14.shtml

func (*ClientV3) V3ComplaintUploadImage added in v1.5.41

func (c *ClientV3) V3ComplaintUploadImage(fileName, fileSha256 string, img *util.File) (wxRsp *ComplaintUploadImageRsp, err error)

商户上传反馈图片API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter10_2_10.shtml

func (*ClientV3) V3PartnerCloseOrder added in v1.5.31

func (c *ClientV3) V3PartnerCloseOrder(subMchid, tradeNo string) (wxRsp *CloseOrderRsp, err error)

(服务商模式)关单API

Code = 0 is success
注意:sub_mchid 需作为参数传入
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter5_6.shtml

func (*ClientV3) V3PartnerQueryOrder added in v1.5.31

func (c *ClientV3) V3PartnerQueryOrder(orderNoType OrderNoType, subMchid, orderNo string) (wxRsp *PartnerQueryOrderRsp, err error)

(服务商模式)查询订单API

Code = 0 is success
注意:sub_mchid 需作为参数传入
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter5_5.shtml

func (*ClientV3) V3PartnerTransactionApp added in v1.5.31

func (c *ClientV3) V3PartnerTransactionApp(bm gopay.BodyMap) (wxRsp *PrepayRsp, err error)

(服务商模式)APP下单API

Code = 0 is success
注意:sub_appid、sub_mchid 需作为参数自己传入BodyMap
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter5_1.shtml

func (*ClientV3) V3PartnerTransactionH5 added in v1.5.31

func (c *ClientV3) V3PartnerTransactionH5(bm gopay.BodyMap) (wxRsp *H5Rsp, err error)

(服务商模式)H5下单API

Code = 0 is success
注意:sub_appid、sub_mchid 需作为参数自己传入BodyMap
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter5_4.shtml

func (*ClientV3) V3PartnerTransactionJsapi added in v1.5.31

func (c *ClientV3) V3PartnerTransactionJsapi(bm gopay.BodyMap) (wxRsp *PrepayRsp, err error)

(服务商模式)JSAPI/小程序下单API

Code = 0 is success
注意:sub_appid、sub_mchid 需作为参数自己传入BodyMap
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter5_2.shtml

func (*ClientV3) V3PartnerTransactionNative added in v1.5.31

func (c *ClientV3) V3PartnerTransactionNative(bm gopay.BodyMap) (wxRsp *NativeRsp, err error)

(服务商模式)Native下单API

Code = 0 is success
注意:sub_appid、sub_mchid 需作为参数自己传入BodyMap
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter5_3.shtml

func (*ClientV3) V3ProfitShareAddReceiver added in v1.5.41

func (c *ClientV3) V3ProfitShareAddReceiver(bm gopay.BodyMap) (*ProfitShareAddReceiverRsp, error)

新增分账接收方API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_8.shtml

func (*ClientV3) V3ProfitShareDeleteReceiver added in v1.5.41

func (c *ClientV3) V3ProfitShareDeleteReceiver(bm gopay.BodyMap) (*ProfitShareDeleteReceiverRsp, error)

删除分账接收方API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_9.shtml

func (*ClientV3) V3ProfitShareOrder added in v1.5.41

func (c *ClientV3) V3ProfitShareOrder(bm gopay.BodyMap) (*ProfitShareOrderRsp, error)

请求分账API

微信会在接到请求后立刻返回请求接收结果,分账结果需要自行调用查询接口来获取
Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_1.shtml

func (*ClientV3) V3ProfitShareOrderQuery added in v1.5.41

func (c *ClientV3) V3ProfitShareOrderQuery(orderNo, transId string) (*ProfitShareOrderQueryRsp, error)

查询分账结果API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_2.shtml

func (*ClientV3) V3ProfitShareOrderUnfreeze added in v1.5.41

func (c *ClientV3) V3ProfitShareOrderUnfreeze(tradeNo, transId, description string) (*ProfitShareOrderUnfreezeRsp, error)

解冻剩余资金API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_5.shtml

func (*ClientV3) V3ProfitShareReturn added in v1.5.41

func (c *ClientV3) V3ProfitShareReturn(bm gopay.BodyMap) (*ProfitShareReturnRsp, error)

请求分账回退API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_3.shtml

func (*ClientV3) V3ProfitShareReturnResult added in v1.5.41

func (c *ClientV3) V3ProfitShareReturnResult(returnNo, orderNo string) (*ProfitShareReturnResultRsp, error)

查询分账回退结果API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_4.shtml

func (*ClientV3) V3ProfitShareUnsplitAmount added in v1.5.41

func (c *ClientV3) V3ProfitShareUnsplitAmount(transId string) (*ProfitShareUnsplitAmountRsp, error)

查询剩余待分金额API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter8_1_6.shtml

func (*ClientV3) V3Refund added in v1.5.28

func (c *ClientV3) V3Refund(bm gopay.BodyMap) (wxRsp *RefundRsp, err error)

申请退款API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter5_1_14.shtml

func (*ClientV3) V3RefundQuery added in v1.5.30

func (c *ClientV3) V3RefundQuery(outRefundNo string) (wxRsp *RefundQueryRsp, err error)

查询单笔退款API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_10.shtml

func (*ClientV3) V3ScoreDirectComplete added in v1.5.40

func (c *ClientV3) V3ScoreDirectComplete(bm gopay.BodyMap) (wxRsp *ScoreDirectCompleteRsp, err error)

创单结单合并API

Code = 0 is success
注意:限制条件:【免确认订单模式】,用户已授权状态下,可调用该接口。
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_1.shtml

func (*ClientV3) V3ScoreOrderCancel added in v1.5.39

func (c *ClientV3) V3ScoreOrderCancel(tradeNo, serviceId, reason string) (wxRsp *ScoreOrderCancelRsp, err error)

取消支付分订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_16.shtml

func (*ClientV3) V3ScoreOrderComplete added in v1.5.39

func (c *ClientV3) V3ScoreOrderComplete(tradeNo string, bm gopay.BodyMap) (wxRsp *ScoreOrderCompleteRsp, err error)

完结支付分订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_18.shtml

func (*ClientV3) V3ScoreOrderCreate added in v1.5.39

func (c *ClientV3) V3ScoreOrderCreate(bm gopay.BodyMap) (wxRsp *ScoreOrderCreateRsp, err error)

创建支付分订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_14.shtml

func (*ClientV3) V3ScoreOrderModify added in v1.5.39

func (c *ClientV3) V3ScoreOrderModify(tradeNo string, bm gopay.BodyMap) (wxRsp *ScoreOrderModifyRsp, err error)

修改订单金额API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_17.shtml

func (*ClientV3) V3ScoreOrderPay added in v1.5.39

func (c *ClientV3) V3ScoreOrderPay(tradeNo, serviceId string) (wxRsp *ScoreOrderPayRsp, err error)

商户发起催收扣款API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_19.shtml

func (*ClientV3) V3ScoreOrderQuery added in v1.5.39

func (c *ClientV3) V3ScoreOrderQuery(orderNoType OrderNoType, orderNo, serviceId string) (wxRsp *ScoreOrderQueryRsp, err error)

查询支付分订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_15.shtml

func (*ClientV3) V3ScoreOrderSync added in v1.5.39

func (c *ClientV3) V3ScoreOrderSync(tradeNo string, bm gopay.BodyMap) (wxRsp *ScoreOrderSyncRsp, err error)

同步服务订单信息API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_20.shtml

func (*ClientV3) V3ScorePermission added in v1.5.40

func (c *ClientV3) V3ScorePermission(bm gopay.BodyMap) (wxRsp *ScorePermissionRsp, err error)

商户预授权API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_2.shtml

func (*ClientV3) V3ScorePermissionOpenidQuery added in v1.5.40

func (c *ClientV3) V3ScorePermissionOpenidQuery(openId, serviceId string) (wxRsp *ScorePermissionOpenidQueryRsp, err error)

查询用户授权记录(openid)API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_5.shtml

func (*ClientV3) V3ScorePermissionOpenidTerminate added in v1.5.40

func (c *ClientV3) V3ScorePermissionOpenidTerminate(openId, serviceId, reason string) (wxRsp *EmptyRsp, err error)

解除用户授权关系(openid)API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_6.shtml

func (*ClientV3) V3ScorePermissionQuery added in v1.5.40

func (c *ClientV3) V3ScorePermissionQuery(authCode, serviceId string) (wxRsp *ScorePermissionQueryRsp, err error)

查询用户授权记录(授权协议号)API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_3.shtml

func (*ClientV3) V3ScorePermissionTerminate added in v1.5.40

func (c *ClientV3) V3ScorePermissionTerminate(authCode, serviceId, reason string) (wxRsp *EmptyRsp, err error)

解除用户授权关系(授权协议号)API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_4.shtml

func (*ClientV3) V3TransactionApp

func (c *ClientV3) V3TransactionApp(bm gopay.BodyMap) (wxRsp *PrepayRsp, err error)

(直连模式)APP下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_2_1.shtml

func (*ClientV3) V3TransactionCloseOrder

func (c *ClientV3) V3TransactionCloseOrder(tradeNo string) (wxRsp *CloseOrderRsp, err error)

(直连模式)关闭订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_6.shtml

func (*ClientV3) V3TransactionH5

func (c *ClientV3) V3TransactionH5(bm gopay.BodyMap) (wxRsp *H5Rsp, err error)

(直连模式)H5下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_3_1.shtml

func (*ClientV3) V3TransactionJsapi

func (c *ClientV3) V3TransactionJsapi(bm gopay.BodyMap) (wxRsp *PrepayRsp, err error)

(直连模式)JSAPI/小程序下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_1.shtml

func (*ClientV3) V3TransactionNative

func (c *ClientV3) V3TransactionNative(bm gopay.BodyMap) (wxRsp *NativeRsp, err error)

(直连模式)Native下单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_1.shtml

func (*ClientV3) V3TransactionQueryOrder

func (c *ClientV3) V3TransactionQueryOrder(orderNoType OrderNoType, orderNo string) (wxRsp *QueryOrderRsp, err error)

(直连模式)查询订单API

Code = 0 is success
文档:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_5.shtml

type CloseOrderRsp

type CloseOrderRsp struct {
	Code     int       `json:"-"`
	SignInfo *SignInfo `json:"-"`
	Error    string    `json:"-"`
}

关闭订单 Rsp

type Collection added in v1.5.39

type Collection struct {
	State        string     `json:"state"`                   // 收款状态,USER_PAYING:待支付,USER_PAID:已支付
	TotalAmount  int        `json:"total_amount,omitempty"`  // 总金额,大于等于0的数字,单位为分,只能为整数
	PayingAmount int        `json:"paying_amount,omitempty"` // 等待用户付款金额,只能为整数
	PaidAmount   int        `json:"paid_amount,omitempty"`   // 用户已付款的金额,只能为整数
	Details      []*Details `json:"details,omitempty"`       // 收款明细列表
}

type CombineAmount added in v1.5.26

type CombineAmount struct {
	TotalAmount   int    `json:"total_amount,omitempty"`   // 订单总金额,单位为分
	Currency      string `json:"currency,omitempty"`       // 标价币种:符合ISO 4217标准的三位字母代码,人民币:CNY
	PayerAmount   int    `json:"payer_amount"`             // 订单现金支付金额
	PayerCurrency string `json:"payer_currency,omitempty"` // 现金支付币种:符合ISO 4217标准的三位字母代码,默认人民币:CNY
}

type CombineQueryOrder added in v1.5.26

type CombineQueryOrder struct {
	CombineAppid      string       `json:"combine_appid"`        // 合单发起方的appid
	CombineMchid      string       `json:"combine_mchid"`        // 合单发起方商户号
	CombineOutTradeNo string       `json:"combine_out_trade_no"` // 合单支付总订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一
	SceneInfo         *SceneInfo   `json:"scene_info,omitempty"` // 支付场景描述
	SubOrders         []*SubOrders `json:"sub_orders"`           // 最多支持子单条数:50
	CombinePayerInfo  *Payer       `json:"combine_payer_info"`   // 支付者信息
}

type CombineQueryOrderRsp added in v1.5.26

type CombineQueryOrderRsp struct {
	Code     int                `json:"-"`
	SignInfo *SignInfo          `json:"-"`
	Response *CombineQueryOrder `json:"response,omitempty"`
	Error    string             `json:"-"`
}

合单查询订单 Rsp

type ComplaintDetail added in v1.5.41

type ComplaintDetail struct {
	ComplaintId           string                `json:"complaint_id"`                   // 投诉单对应的投诉单号
	ComplaintTime         string                `json:"complaint_time"`                 // 投诉时间, 例如:2015-05-20T13:29:35.120+08:00表示北京时间2015年05月20日13点29分35秒
	ComplaintDetail       string                `json:"complaint_detail"`               // 投诉的具体描述
	ComplaintedMchid      string                `json:"complainted_mchid,omitempty"`    // 投诉单对应的被诉商户号。
	ComplaintState        string                `json:"complaint_state"`                // 投诉单状态, PENDING:待处理, PROCESSING:处理中, PROCESSED:已处理完成
	PayerPhone            string                `json:"payer_phone,omitempty"`          // 投诉人联系方式。该字段已做加密处理
	PayerOpenid           string                `json:"payer_openid"`                   // 投诉人在商户appid下的唯一标识
	ComplaintOrderInfo    []*ComplaintOrderInfo `json:"complaint_order_info,omitempty"` // 投诉单关联订单信息
	ComplaintFullRefunded bool                  `json:"complaint_full_refunded"`        // 投诉单下所有订单是否已全部全额退款
	IncomingUserResponse  bool                  `json:"incoming_user_response"`         // 投诉单是否有待回复的用户留言
	UserComplaintTimes    int                   `json:"user_complaint_times"`           // 用户投诉次数
}

type ComplaintDetailRsp added in v1.5.41

type ComplaintDetailRsp struct {
	Code     int              `json:"-"`
	SignInfo *SignInfo        `json:"-"`
	Response *ComplaintDetail `json:"response,omitempty"`
	Error    string           `json:"-"`
}

查询投诉单详情 Rsp

type ComplaintList added in v1.5.41

type ComplaintList struct {
	Data       []*ComplaintListItem `json:"data,omitempty"`        // 用户投诉信息详情
	Limit      int                  `json:"limit"`                 // 设置该次请求返回的最大投诉条数,范围【1,50】
	Offset     int                  `json:"offset"`                // 该次请求的分页开始位置,从0开始计数,例如offset=10,表示从第11条记录开始返回。
	TotalCount int                  `json:"total_count,omitempty"` // 投诉总条数,当offset=0时返回
}

type ComplaintListItem added in v1.5.41

type ComplaintListItem struct {
	ComplaintId           string                `json:"complaint_id"`                   // 投诉单对应的投诉单号
	ComplaintTime         string                `json:"complaint_time"`                 // 投诉时间, 例如:2015-05-20T13:29:35.120+08:00表示北京时间2015年05月20日13点29分35秒
	ComplaintDetail       string                `json:"complaint_detail"`               // 投诉的具体描述
	ComplaintState        string                `json:"complaint_state"`                // 投诉单状态, PENDING:待处理, PROCESSING:处理中, PROCESSED:已处理完成
	PayerPhone            string                `json:"payer_phone,omitempty"`          // 投诉人联系方式。该字段已做加密处理
	ComplaintOrderInfo    []*ComplaintOrderInfo `json:"complaint_order_info,omitempty"` // 投诉单关联订单信息
	ComplaintFullRefunded bool                  `json:"complaint_full_refunded"`        // 投诉单下所有订单是否已全部全额退款
	IncomingUserResponse  bool                  `json:"incoming_user_response"`         // 投诉单是否有待回复的用户留言
	UserComplaintTimes    int                   `json:"user_complaint_times"`           // 用户投诉次数
}

type ComplaintListRsp added in v1.5.41

type ComplaintListRsp struct {
	Code     int            `json:"-"`
	SignInfo *SignInfo      `json:"-"`
	Response *ComplaintList `json:"response,omitempty"`
	Error    string         `json:"-"`
}

查询投诉单列表 Rsp

type ComplaintNegotiationHistory added in v1.5.41

type ComplaintNegotiationHistory struct {
	Data       []*ComplaintNegotiationHistoryItem `json:"data,omitempty"`        // 投诉协商历史
	Limit      int                                `json:"limit"`                 // 设置该次请求返回的最大投诉条数,范围【1,50】
	Offset     int                                `json:"offset"`                // 该次请求的分页开始位置,从0开始计数,例如offset=10,表示从第11条记录开始返回。
	TotalCount int                                `json:"total_count,omitempty"` // 投诉总条数,当offset=0时返回
}

type ComplaintNegotiationHistoryItem added in v1.5.41

type ComplaintNegotiationHistoryItem struct {
	LogId          string   `json:"log_id"`          // 操作流水号
	Operator       string   `json:"operator"`        // 当前投诉协商记录的操作人
	OperateTime    string   `json:"operate_time"`    // 当前投诉协商记录的操作时间
	OperateType    string   `json:"operate_type"`    // 当前投诉协商记录的操作类型
	OperateDetails string   `json:"operate_details"` // 当前投诉协商记录的具体内容
	ImageList      []string `json:"image_list"`      // 当前投诉协商记录提交的图片凭证(url格式),最多返回4张图片,url有效时间为1小时。如未查询到协商历史图片凭证,则返回空数组。
}

type ComplaintNegotiationHistoryRsp added in v1.5.41

type ComplaintNegotiationHistoryRsp struct {
	Code     int                          `json:"-"`
	SignInfo *SignInfo                    `json:"-"`
	Response *ComplaintNegotiationHistory `json:"response,omitempty"`
	Error    string                       `json:"-"`
}

查询投诉单详情 Rsp

type ComplaintNotifyUrl added in v1.5.41

type ComplaintNotifyUrl struct {
	Mchid string `json:"mchid"` // 返回创建回调地址的商户号,由微信支付生成并下发。
	Url   string `json:"url"`   // 通知地址,仅支持https。
}

type ComplaintNotifyUrlRsp added in v1.5.41

type ComplaintNotifyUrlRsp struct {
	Code     int                 `json:"-"`
	SignInfo *SignInfo           `json:"-"`
	Response *ComplaintNotifyUrl `json:"response,omitempty"`
	Error    string              `json:"-"`
}

创建、查询、更新投诉通知回调地址 Rsp

type ComplaintOrderInfo added in v1.5.41

type ComplaintOrderInfo struct {
	TransactionId string `json:"transaction_id"` // 投诉单关联的微信订单号
	OutTradeNo    string `json:"out_trade_no"`   // 投诉单关联的商户订单号
	Amount        int    `json:"amount"`         // 订单金额,单位(分)
}

type ComplaintUploadImage added in v1.5.41

type ComplaintUploadImage struct {
	MediaId string `json:"media_id"` // 微信返回的媒体文件标识ID。
}

type ComplaintUploadImageRsp added in v1.5.41

type ComplaintUploadImageRsp struct {
	Code     int                   `json:"-"`
	SignInfo *SignInfo             `json:"-"`
	Response *ComplaintUploadImage `json:"response,omitempty"`
	Error    string                `json:"-"`
}

商户上传反馈图片 Rsp

type Details added in v1.5.39

type Details struct {
	Seq             int                `json:"seq,omitempty"`              // 收款序号
	Amount          int                `json:"amount,omitempty"`           // 单笔收款动作的金额,只能为整数
	PaidType        string             `json:"paid_type,omitempty"`        // 收款成功渠道,NEWTON:微信支付分,MCH:商户渠道
	PaidTime        string             `json:"paid_time,omitempty"`        // 支付成功时间,支持两种格式:yyyyMMddHHmmss和yyyyMMdd
	TransactionId   string             `json:"transaction_id,omitempty"`   // 结单交易单号,等于普通支付接口中的transaction_id
	PromotionDetail []*PromotionDetail `json:"promotion_detail,omitempty"` // 优惠功能,享受优惠时返回该字段
}

type DownloadBill

type DownloadBill struct {
	DownloadBillCount int           `json:"download_bill_count"`
	DownloadBillList  []*BillDetail `json:"download_bill_list"`
}

type EmptyRsp added in v1.5.41

type EmptyRsp struct {
	Code     int       `json:"-"`
	SignInfo *SignInfo `json:"-"`
	Error    string    `json:"-"`
}

type GoodsDetail

type 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"`      // 商品备注信息
	MerchantGoodsID string `json:"merchant_goods_id,omitempty"` // 商户侧商品编码,服务商模式下无此字段
}

type H5Rsp

type H5Rsp struct {
	Code     int       `json:"-"`
	SignInfo *SignInfo `json:"-"`
	Response *H5Url    `json:"response,omitempty"`
	Error    string    `json:"-"`
}

H5 支付Rsp

type H5Url

type H5Url struct {
	H5Url string `json:"h5_url"` // h5_url为拉起微信支付收银台的中间页面,可通过访问该url来拉起微信客户端,完成支付,h5_url的有效期为5分钟
}

type JSAPIPayParams

type JSAPIPayParams struct {
	AppId     string `json:"appId"`
	TimeStamp string `json:"timeStamp"`
	NonceStr  string `json:"nonceStr"`
	Package   string `json:"package"`
	SignType  string `json:"signType"`
	PaySign   string `json:"paySign"`
}

type Level2FundFlowBillRsp

type Level2FundFlowBillRsp struct {
	Code     int           `json:"-"`
	SignInfo *SignInfo     `json:"-"`
	Response *DownloadBill `json:"response,omitempty"`
	Error    string        `json:"-"`
}

二级商户资金账单 Rsp

type Location added in v1.5.39

type Location struct {
	StartLocation string `json:"start_location,omitempty"` // 服务开始地点
	EndLocation   string `json:"end_location,omitempty"`   // 服务结束位置
}

type Native

type Native struct {
	CodeUrl string `json:"code_url"` // 此URL用于生成支付二维码,然后提供给用户扫码支付
}

type NativeRsp

type NativeRsp struct {
	Code     int       `json:"-"`
	SignInfo *SignInfo `json:"-"`
	Response *Native   `json:"response,omitempty"`
	Error    string    `json:"-"`
}

Native 支付Rsp

type OrderNoType

type OrderNoType uint8

type PartnerPayer added in v1.5.31

type PartnerPayer struct {
	SpOpenid  string `json:"sp_openid"`  // 用户在服务商appid下的唯一标识。
	SubOpenid string `json:"sub_openid"` // 用户在子商户appid下的唯一标识。 如果返回sub_appid,那么sub_openid一定会返回。
}

type PartnerQueryOrder added in v1.5.31

type PartnerQueryOrder struct {
	SpAppid         string             `json:"sp_appid"`                   // 服务商申请的公众号或移动应用appid。
	SpMchid         string             `json:"sp_mchid"`                   // 服务商户号,由微信支付生成并下发
	SubAppid        string             `json:"sub_appid"`                  // 子商户申请的公众号或移动应用appid。如果返回sub_appid,那么sub_openid一定会返回。
	SubMchid        string             `json:"sub_mchid"`                  // 子商户的商户号,有微信支付生成并下发。
	OutTradeNo      string             `json:"out_trade_no"`               // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
	TransactionId   string             `json:"transaction_id"`             // 微信支付系统生成的订单号
	TradeType       string             `json:"trade_type"`                 // 交易类型,枚举值:JSAPI:公众号支付, NATIVE:扫码支付, APP:APP支付, MICROPAY:付款码支付, MWEB:H5支付, FACEPAY:刷脸支付
	TradeState      string             `json:"trade_state"`                // 交易状态,枚举值:SUCCESS:支付成功, REFUND:转入退款, NOTPAY:未支付, CLOSED:已关闭, REVOKED:已撤销(付款码支付), USERPAYING:用户支付中(付款码支付), PAYERROR:支付失败(其他原因,如银行返回失败)
	TradeStateDesc  string             `json:"trade_state_desc"`           // 交易状态描述
	BankType        string             `json:"bank_type,omitempty"`        // 银行类型,采用字符串类型的银行标识
	Attach          string             `json:"attach"`                     // 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
	SuccessTime     string             `json:"success_time,omitempty"`     // 支付完成时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒
	Payer           *PartnerPayer      `json:"payer"`                      // 支付者信息
	Amount          *Amount            `json:"amount,omitempty"`           // 订单金额信息,当支付成功时返回该字段
	SceneInfo       *SceneInfo         `json:"scene_info,omitempty"`       // 支付场景描述
	PromotionDetail []*PromotionDetail `json:"promotion_detail,omitempty"` // 优惠功能,享受优惠时返回该字段
}

type PartnerQueryOrderRsp added in v1.5.31

type PartnerQueryOrderRsp struct {
	Code     int                `json:"-"`
	SignInfo *SignInfo          `json:"-"`
	Response *PartnerQueryOrder `json:"response,omitempty"`
	Error    string             `json:"-"`
}

服务商查询订单 Rsp

type Payer

type Payer struct {
	Openid string `json:"openid"` // 用户在直连商户appid下的唯一标识
}

type PlatformCert

type PlatformCert struct {
	Data []*certData `json:"data"`
}

type PlatformCertItem

type PlatformCertItem struct {
	EffectiveTime string `json:"effective_time"`
	ExpireTime    string `json:"expire_time"`
	PublicKey     string `json:"public_key"`
	SerialNo      string `json:"serial_no"`
}

type PlatformCertRsp

type PlatformCertRsp struct {
	Code     int                 `json:"-"`
	SignInfo *SignInfo           `json:"-"`
	Certs    []*PlatformCertItem `json:"certs"`
	Error    string              `json:"-"`
}

type PostDiscounts added in v1.5.39

type PostDiscounts struct {
	Name        string `json:"name,omitempty"`        // 优惠名称说明。
	Description string `json:"description,omitempty"` // 优惠使用条件说明。
	Amount      int    `json:"amount"`                // 优惠金额,只能为整数
	Count       int    `json:"count,omitempty"`       // 优惠的数量。
}

type PostPayments added in v1.5.39

type PostPayments struct {
	Name        string `json:"name,omitempty"`        // 付费项目名称
	Description string `json:"description,omitempty"` // 描述计费规则,不超过30个字符,超出报错处理。
	Amount      int    `json:"amount"`                // 此付费项目总金额,大于等于0,单位为分,等于0时代表不需要扣费,只能为整数
	Count       int    `json:"count,omitempty"`       // 付费项目的数量。
}

type Prepay

type Prepay struct {
	PrepayId string `json:"prepay_id"` // 预支付交易会话标识。用于后续接口调用中使用,该值有效期为2小时
}

type PrepayRsp

type PrepayRsp struct {
	Code     int       `json:"-"`
	SignInfo *SignInfo `json:"-"`
	Response *Prepay   `json:"response,omitempty"`
	Error    string    `json:"-"`
}

Prepay 支付Rsp

type ProfitShareAddReceiver added in v1.5.41

type ProfitShareAddReceiver struct {
	Type           string `json:"type"`                      // 分账接收方类型MERCHANT_ID:商户ID,PERSONAL_OPENID:个人openid(由父商户APPID转换得到)
	Account        string `json:"account"`                   // 分账接收方帐号
	Name           string `json:"name,omitempty"`            // 分账接收方类型是MERCHANT_ID时,是商户全称(必传),当商户是小微商户或个体户时,是开户人姓名 分账接收方类型是PERSONAL_OPENID时,是个人姓名(选传,传则校验)
	RelationType   string `json:"relation_type"`             // 商户与接收方的关系。STORE:门店STAFF:员工	STORE_OWNER:店主	PARTNER:合作伙伴	HEADQUARTER:总部	BRAND:品牌方	DISTRIBUTOR:分销商	USER:用户	SUPPLIER: 供应商	CUSTOM:自定义
	CustomRelation string `json:"custom_relation,omitempty"` // 子商户与接收方具体的关系,本字段最多10个字。当字段relation_type的值为CUSTOM时,本字段必填;当字段relation_type的值不为CUSTOM时,本字段无需填写。
}

type ProfitShareAddReceiverRsp added in v1.5.41

type ProfitShareAddReceiverRsp struct {
	Code     int                     `json:"-"`
	SignInfo *SignInfo               `json:"-"`
	Response *ProfitShareAddReceiver `json:"response,omitempty"`
	Error    string                  `json:"-"`
}

添加分账接收方 Rsp

type ProfitShareDeleteReceiver added in v1.5.41

type ProfitShareDeleteReceiver struct {
	Type    string `json:"type"`    // 分账接收方类型MERCHANT_ID:商户ID,PERSONAL_OPENID:个人openid(由父商户APPID转换得到)
	Account string `json:"account"` // 分账接收方帐号
}

type ProfitShareDeleteReceiverRsp added in v1.5.41

type ProfitShareDeleteReceiverRsp struct {
	Code     int                        `json:"-"`
	SignInfo *SignInfo                  `json:"-"`
	Response *ProfitShareDeleteReceiver `json:"response,omitempty"`
	Error    string                     `json:"-"`
}

删除分账接收方 Rsp

type ProfitShareOrder added in v1.5.41

type ProfitShareOrder struct {
	TransactionId string                   `json:"transaction_id"`      // 微信订单号
	OutOrderNo    string                   `json:"out_order_no"`        // 商户分账单号
	OrderId       string                   `json:"order_id"`            // 微信分账单号
	State         string                   `json:"state"`               // 分账单状态(每个接收方的分账结果请查看receivers中的result字段):PROCESSING:处理中,FINISHED:分账完成
	Receivers     []*ProfitSharingReceiver `json:"receivers,omitempty"` // 分账接收方列表
}

type ProfitShareOrderQuery added in v1.5.41

type ProfitShareOrderQuery struct {
	TransactionId string                   `json:"transaction_id"`      // 微信订单号
	OutOrderNo    string                   `json:"out_order_no"`        // 商户分账单号
	OrderId       string                   `json:"order_id"`            // 微信分账单号
	State         string                   `json:"state"`               // 分账单状态(每个接收方的分账结果请查看receivers中的result字段):PROCESSING:处理中,FINISHED:分账完成
	Receivers     []*ProfitSharingReceiver `json:"receivers,omitempty"` // 分账接收方列表
}

type ProfitShareOrderQueryRsp added in v1.5.41

type ProfitShareOrderQueryRsp struct {
	Code     int                    `json:"-"`
	SignInfo *SignInfo              `json:"-"`
	Response *ProfitShareOrderQuery `json:"response,omitempty"`
	Error    string                 `json:"-"`
}

查询分账结果 Rsp

type ProfitShareOrderRsp added in v1.5.41

type ProfitShareOrderRsp struct {
	Code     int               `json:"-"`
	SignInfo *SignInfo         `json:"-"`
	Response *ProfitShareOrder `json:"response,omitempty"`
	Error    string            `json:"-"`
}

请求分账 Rsp

type ProfitShareOrderUnfreeze added in v1.5.41

type ProfitShareOrderUnfreeze struct {
	TransactionId string                   `json:"transaction_id"`      // 微信支付订单号
	OutOrderNo    string                   `json:"out_order_no"`        // 商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。只能是数字、大小写字母_-|*@
	OrderId       string                   `json:"order_id"`            // 微信分账单号,微信系统返回的唯一标识
	State         string                   `json:"state"`               // 分账单状态(每个接收方的分账结果请查看receivers中的result字段):PROCESSING:处理中,FINISHED:分账完成
	Receivers     []*ProfitSharingReceiver `json:"receivers,omitempty"` // 分账接收方列表
}

type ProfitShareOrderUnfreezeRsp added in v1.5.41

type ProfitShareOrderUnfreezeRsp struct {
	Code     int                       `json:"-"`
	SignInfo *SignInfo                 `json:"-"`
	Response *ProfitShareOrderUnfreeze `json:"response,omitempty"`
	Error    string                    `json:"-"`
}

解冻剩余资金 Rsp

type ProfitShareReturn added in v1.5.41

type ProfitShareReturn struct {
	OrderId     string `json:"order_id"`              // 微信分账单号,微信系统返回的唯一标识
	OutOrderNo  string `json:"out_order_no"`          // 商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。只能是数字、大小写字母_-|*@
	OutReturnNo string `json:"out_return_no"`         // 此回退单号是商户在自己后台生成的一个新的回退单号,在商户后台唯一
	ReturnId    string `json:"return_id"`             // 微信分账回退单号,微信系统返回的唯一标识
	ReturnMchid string `json:"return_mchid"`          // 只能对原分账请求中成功分给商户接收方进行回退
	Amount      int    `json:"amount"`                // 需要从分账接收方回退的金额,单位为分,只能为整数
	Description string `json:"description"`           // 分账回退的原因描述
	Result      string `json:"result"`                // 回退结果: PROCESSING:处理中,SUCCESS:已成功,FAILED:已失败
	FailReason  string `json:"fail_reason,omitempty"` // 失败原因: ACCOUNT_ABNORMAL : 分账接收方账户异常,TIME_OUT_CLOSED : 超时关单
	CreateTime  string `json:"create_time"`           // 分账回退创建时间
	FinishTime  string `json:"finish_time"`           // 分账回退完成时间
}

type ProfitShareReturnResult added in v1.5.41

type ProfitShareReturnResult struct {
	OrderId     string `json:"order_id"`              // 微信分账单号,微信系统返回的唯一标识
	OutOrderNo  string `json:"out_order_no"`          // 商户系统内部的分账单号,在商户系统内部唯一,同一分账单号多次请求等同一次。只能是数字、大小写字母_-|*@
	OutReturnNo string `json:"out_return_no"`         // 此回退单号是商户在自己后台生成的一个新的回退单号,在商户后台唯一
	ReturnId    string `json:"return_id"`             // 微信分账回退单号,微信系统返回的唯一标识
	ReturnMchid string `json:"return_mchid"`          // 只能对原分账请求中成功分给商户接收方进行回退
	Amount      int    `json:"amount"`                // 需要从分账接收方回退的金额,单位为分,只能为整数
	Description string `json:"description"`           // 分账回退的原因描述
	Result      string `json:"result"`                // 回退结果: PROCESSING:处理中,SUCCESS:已成功,FAILED:已失败
	FailReason  string `json:"fail_reason,omitempty"` // 失败原因: ACCOUNT_ABNORMAL : 分账接收方账户异常,TIME_OUT_CLOSED : 超时关单
	CreateTime  string `json:"create_time"`           // 分账回退创建时间
	FinishTime  string `json:"finish_time"`           // 分账回退完成时间
}

type ProfitShareReturnResultRsp added in v1.5.41

type ProfitShareReturnResultRsp struct {
	Code     int                      `json:"-"`
	SignInfo *SignInfo                `json:"-"`
	Response *ProfitShareReturnResult `json:"response,omitempty"`
	Error    string                   `json:"-"`
}

请求分账回退 Rsp

type ProfitShareReturnRsp added in v1.5.41

type ProfitShareReturnRsp struct {
	Code     int                `json:"-"`
	SignInfo *SignInfo          `json:"-"`
	Response *ProfitShareReturn `json:"response,omitempty"`
	Error    string             `json:"-"`
}

请求分账回退 Rsp

type ProfitShareUnsplitAmount added in v1.5.41

type ProfitShareUnsplitAmount struct {
	TransactionId string `json:"transaction_id"` // 微信支付订单号
	UnsplitAmount int    `json:"unsplit_amount"` // 订单剩余待分金额,整数,单位为分
}

type ProfitShareUnsplitAmountRsp added in v1.5.41

type ProfitShareUnsplitAmountRsp struct {
	Code     int                       `json:"-"`
	SignInfo *SignInfo                 `json:"-"`
	Response *ProfitShareUnsplitAmount `json:"response,omitempty"`
	Error    string                    `json:"-"`
}

查询剩余待分金额 Rsp

type ProfitSharingReceiver added in v1.5.41

type ProfitSharingReceiver struct {
	Amount      int    `json:"amount"`      // 分账金额
	Description string `json:"description"` // 分账描述
	Type        string `json:"type"`        // 分账接收方类型
	Account     string `json:"account"`     // 分账接收方帐号
	Result      string `json:"result"`      // 分账结果,PENDING:待分账,SUCCESS:分账成功,CLOSED:已关闭
	FailReason  string `json:"fail_reason"` // 分账失败原因ACCOUNT_ABNORMAL : 分账接收账户异常、NO_RELATION : 分账关系已解除、RECEIVER_HIGH_RISK : 高风险接收方、RECEIVER_REAL_NAME_NOT_VERIFIED : 接收方未实名、NO_AUTH : 分账权限已解除
	CreateTime  string `json:"create_time"` // 分账创建时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE
	FinishTime  string `json:"finish_time"` // 分账完成时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE
}

ProfitSharingReceiver 分账接收方

type PromotionDetail

type PromotionDetail struct {
	Amount              int            `json:"amount"`                         // 优惠券面额
	CouponId            string         `json:"coupon_id"`                      // 券ID
	Name                string         `json:"name,omitempty"`                 // 优惠名称
	Scope               string         `json:"scope,omitempty"`                // 优惠范围:GLOBAL:全场代金券, SINGLE:单品优惠
	Type                string         `json:"type,omitempty"`                 // 优惠类型:CASH:充值, NOCASH:预充值
	StockId             string         `json:"stock_id,omitempty"`             // 活动ID
	WechatpayContribute int            `json:"wechatpay_contribute,omitempty"` // 微信出资,单位为分
	MerchantContribute  int            `json:"merchant_contribute,omitempty"`  // 商户出资,单位为分
	OtherContribute     int            `json:"other_contribute,omitempty"`     // 其他出资,单位为分
	Currency            string         `json:"currency,omitempty"`             // CNY:人民币,境内商户号仅支持人民币
	GoodsDetail         []*GoodsDetail `json:"goods_detail,omitempty"`         // 单品列表信息
}

type QueryOrder

type QueryOrder struct {
	Appid           string             `json:"appid"`                      // 直连商户申请的公众号或移动应用appid
	Mchid           string             `json:"mchid"`                      // 直连商户的商户号,由微信支付生成并下发
	OutTradeNo      string             `json:"out_trade_no"`               // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
	TransactionId   string             `json:"transaction_id"`             // 微信支付系统生成的订单号
	TradeType       string             `json:"trade_type"`                 // 交易类型,枚举值:JSAPI:公众号支付, NATIVE:扫码支付, APP:APP支付, MICROPAY:付款码支付, MWEB:H5支付, FACEPAY:刷脸支付
	TradeState      string             `json:"trade_state"`                // 交易状态,枚举值:SUCCESS:支付成功, REFUND:转入退款, NOTPAY:未支付, CLOSED:已关闭, REVOKED:已撤销(付款码支付), USERPAYING:用户支付中(付款码支付), PAYERROR:支付失败(其他原因,如银行返回失败)
	TradeStateDesc  string             `json:"trade_state_desc"`           // 交易状态描述
	BankType        string             `json:"bank_type,omitempty"`        // 银行类型,采用字符串类型的银行标识
	Attach          string             `json:"attach"`                     // 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
	SuccessTime     string             `json:"success_time,omitempty"`     // 支付完成时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒
	Payer           *Payer             `json:"payer"`                      // 支付者信息
	Amount          *Amount            `json:"amount,omitempty"`           // 订单金额信息,当支付成功时返回该字段
	SceneInfo       *SceneInfo         `json:"scene_info,omitempty"`       // 支付场景描述
	PromotionDetail []*PromotionDetail `json:"promotion_detail,omitempty"` // 优惠功能,享受优惠时返回该字段
}

type QueryOrderRsp

type QueryOrderRsp struct {
	Code     int         `json:"-"`
	SignInfo *SignInfo   `json:"-"`
	Response *QueryOrder `json:"response,omitempty"`
	Error    string      `json:"-"`
}

查询订单 Rsp

type RefundAmount added in v1.5.35

type RefundAmount struct {
	Total       int `json:"total,omitempty"`       // 订单总金额,单位为分,只能为整数
	Refund      int `json:"refund,omitempty"`      // 退款金额,币种的最小单位,只能为整数,不能超过原订单支付金额,如果有使用券,后台会按比例退
	PayerTotal  int `json:"payer_total,omitempty"` // 用户实际支付金额,单位为分,只能为整数
	PayerRefund int `json:"payer_refund"`          // 退款给用户的金额,不包含所有优惠券金额
}

type RefundOrderResponse added in v1.5.28

type RefundOrderResponse 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"`          // 退款成功时间
	CreateTime          string                        `json:"create_time"`           // 退款创建时间
	Status              string                        `json:"status"`                // 退款状态
	FundsAccount        string                        `json:"funds_account"`         // 资金账户
	Amount              *RefundQueryAmount            `json:"amount"`                // 金额信息
	PromotionDetail     []*RefundQueryPromotionDetail `json:"promotion_detail"`      // 优惠退款信息
}

type RefundQueryAmount added in v1.5.30

type RefundQueryAmount struct {
	Total            int    `json:"total"`             // 订单总金额,单位为分
	Refund           int    `json:"refund"`            // 退款金额,币种的最小单位,只能为整数,不能超过原订单支付金额。
	PayerTotal       int    `json:"payer_total"`       // 用户支付金额,单位为分
	PayerRefund      int    `json:"payer_refund"`      // 用户退款金额,不包含所有优惠券金额
	SettlementRefund int    `json:"settlement_refund"` // 应结退款金额,去掉非充值代金券退款金额后的退款金额,单位为分
	DiscountRefund   int    `json:"discount_refund"`   // 优惠退款金额
	Currency         string `json:"currency"`          // CNY:人民币,境内商户号仅支持人民币
}

type RefundQueryGoodsDetail added in v1.5.30

type RefundQueryGoodsDetail 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"`              // 商品退货数量
}

type RefundQueryPromotionDetail added in v1.5.30

type RefundQueryPromotionDetail struct {
	PromotionID  string                    `json:"promotion_id"`           // 券ID,券或立减金额
	Scope        string                    `json:"scope"`                  // 优惠范围,GLOBAL:全场代金券,SINGLE:单品优惠
	Type         string                    `json:"type"`                   // 优惠类型,COUPON:代金券,DISCOUNT:优惠券
	Amount       int                       `json:"amount"`                 // 优惠券面额,用户享受优惠的金额(优惠券面额=微信出资金额+商家出资金额+其他出资方金额),单位为分
	RefundAmount int                       `json:"refund_amount"`          // 优惠退款金额,单位为分
	GoodsDetail  []*RefundQueryGoodsDetail `json:"goods_detail,omitempty"` // 商品列表,优惠商品发送退款时返回商品信息
}

type RefundQueryResponse added in v1.5.30

type RefundQueryResponse 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"`          // 退款成功时间
	CreateTime          string                        `json:"create_time"`           // 退款创建时间
	Status              string                        `json:"status"`                // 退款状态
	FundsAccount        string                        `json:"funds_account"`         // 资金账户
	Amount              *RefundQueryAmount            `json:"amount"`                // 金额信息
	PromotionDetail     []*RefundQueryPromotionDetail `json:"promotion_detail"`      // 优惠退款信息
}

type RefundQueryRsp added in v1.5.30

type RefundQueryRsp struct {
	Code     int                  `json:"-"`
	SignInfo *SignInfo            `json:"-"`
	Response *RefundQueryResponse `json:"response,omitempty"`
	Error    string               `json:"-"`
}

退款查询 Rsp

type RefundRsp added in v1.5.28

type RefundRsp struct {
	Code     int                  `json:"-"`
	SignInfo *SignInfo            `json:"-"`
	Response *RefundOrderResponse `json:"response,omitempty"`
	Error    string               `json:"-"`
}

退款 Rsp

type Resource

type Resource struct {
	OriginalType   string `json:"original_type"`
	Algorithm      string `json:"algorithm"`
	Ciphertext     string `json:"ciphertext"`
	AssociatedData string `json:"associated_data"`
	Nonce          string `json:"nonce"`
}

type RiskFund added in v1.5.39

type RiskFund struct {
	Name        string `json:"name"`                  // 风险金名称。DEPOSIT:押金,ADVANCE:预付款,CASH_DEPOSIT:保证金,ESTIMATE_ORDER_COST:预估订单费用
	Description string `json:"description,omitempty"` // 风险说明
	Amount      int    `json:"amount"`                // 风险金额
}

type SceneInfo

type SceneInfo struct {
	DeviceId string `json:"device_id,omitempty"` // 商户端设备号(发起扣款请求的商户服务器设备号)
}

type ScoreDirectComplete added in v1.5.40

type ScoreDirectComplete struct {
	Appid               string           `json:"appid"`                       // 调用接口提交的公众账号ID。
	Mchid               string           `json:"mchid"`                       // 调用接口提交的商户号。
	OutTradeNo          string           `json:"out_trade_no"`                // 调用接口提交的商户服务订单号。
	ServiceId           string           `json:"service_id"`                  // 调用该接口提交的服务ID。
	OrderId             string           `json:"order_id"`                    // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
	ServiceIntroduction string           `json:"service_introduction"`        // 服务信息,用于介绍本订单所提供的服务。
	State               string           `json:"state"`                       // 表示当前单据状态。枚举值:CREATED:商户已创建服务订单,DOING:服务订单进行中,DONE:服务订单完成,REVOKED:商户取消服务订单,EXPIRED:服务订单已失效
	StateDescription    string           `json:"state_description,omitempty"` // 对服务订单"进行中"状态的附加说明。USER_CONFIRM:用户确认,MCH_COMPLETE:商户完结
	PostPayments        []*PostPayments  `json:"post_payments"`               // 后付费项目列表,最多包含100条付费项目。 如果传入,用户侧则显示此参数。
	PostDiscounts       []*PostDiscounts `json:"post_discounts,omitempty"`    // 后付费商户优惠,最多包含30条付费项目。 如果传入,用户侧则显示此参数。
	TimeRange           *TimeRange       `json:"time_range"`                  // 服务时间范围
	Location            *Location        `json:"location,omitempty"`          // 服务位置信息
	Attach              string           `json:"attach,omitempty"`            // 商户数据包,可存放本订单所需信息,需要先urlencode后传入,总长度不大于256字符,超出报错处理。
	NotifyUrl           string           `json:"notify_url,omitempty"`        // 商户接收用户确认订单或扣款成功回调通知的地址。
	TotalAmount         int              `json:"total_amount"`                // 金额:数字,必须≥0(单位:分)
}

type ScoreDirectCompleteRsp added in v1.5.40

type ScoreDirectCompleteRsp struct {
	Code     int                  `json:"-"`
	SignInfo *SignInfo            `json:"-"`
	Response *ScoreDirectComplete `json:"response,omitempty"`
	Error    string               `json:"-"`
}

创单结单合并 Rsp

type ScoreOrderCancel added in v1.5.39

type ScoreOrderCancel struct {
	Appid      string `json:"appid"`        // 调用接口提交的公众账号ID。
	Mchid      string `json:"mchid"`        // 调用接口提交的商户号。
	ServiceId  string `json:"service_id"`   // 调用该接口提交的服务ID。
	OutTradeNo string `json:"out_trade_no"` // 调用接口提交的商户服务订单号。
	OrderId    string `json:"order_id"`     // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
}

type ScoreOrderCancelRsp added in v1.5.39

type ScoreOrderCancelRsp struct {
	Code     int               `json:"-"`
	SignInfo *SignInfo         `json:"-"`
	Response *ScoreOrderCancel `json:"response,omitempty"`
	Error    string            `json:"-"`
}

取消支付分订单 Rsp

type ScoreOrderComplete added in v1.5.39

type ScoreOrderComplete struct {
	Appid               string           `json:"appid"`                       // 调用接口提交的公众账号ID。
	Mchid               string           `json:"mchid"`                       // 调用接口提交的商户号。
	ServiceId           string           `json:"service_id"`                  // 调用该接口提交的服务ID。
	OutTradeNo          string           `json:"out_trade_no"`                // 调用接口提交的商户服务订单号。
	ServiceIntroduction string           `json:"service_introduction"`        // 服务信息,用于介绍本订单所提供的服务。
	State               string           `json:"state"`                       // 表示当前单据状态。枚举值:CREATED:商户已创建服务订单,DOING:服务订单进行中,DONE:服务订单完成,REVOKED:商户取消服务订单,EXPIRED:服务订单已失效
	StateDescription    string           `json:"state_description,omitempty"` // 对服务订单"进行中"状态的附加说明。USER_CONFIRM:用户确认,MCH_COMPLETE:商户完结
	TotalAmount         int              `json:"total_amount"`                // 总金额,大于等于0的数字,单位为分,只能为整数
	PostPayments        []*PostPayments  `json:"post_payments"`               // 后付费项目列表,最多包含100条付费项目。 如果传入,用户侧则显示此参数。
	PostDiscounts       []*PostDiscounts `json:"post_discounts,omitempty"`    // 后付费商户优惠,最多包含30条付费项目。 如果传入,用户侧则显示此参数。
	RiskFund            *RiskFund        `json:"risk_fund"`                   // 订单风险金信息
	TimeRange           *TimeRange       `json:"time_range,omitempty"`        // 服务时间范围
	Location            *Location        `json:"location,omitempty"`          // 服务位置信息
	OrderId             string           `json:"order_id"`                    // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
	NeedCollection      bool             `json:"need_collection,omitempty"`   // 是否需要收款
}

type ScoreOrderCompleteRsp added in v1.5.39

type ScoreOrderCompleteRsp struct {
	Code     int                 `json:"-"`
	SignInfo *SignInfo           `json:"-"`
	Response *ScoreOrderComplete `json:"response,omitempty"`
	Error    string              `json:"-"`
}

完结支付分订单 Rsp

type ScoreOrderCreate added in v1.5.39

type ScoreOrderCreate struct {
	Appid               string           `json:"appid"`                       // 调用接口提交的公众账号ID。
	Mchid               string           `json:"mchid"`                       // 调用接口提交的商户号。
	OutTradeNo          string           `json:"out_trade_no"`                // 调用接口提交的商户服务订单号。
	ServiceId           string           `json:"service_id"`                  // 调用该接口提交的服务ID。
	ServiceIntroduction string           `json:"service_introduction"`        // 服务信息,用于介绍本订单所提供的服务。
	State               string           `json:"state"`                       // 表示当前单据状态。枚举值:CREATED:商户已创建服务订单,DOING:服务订单进行中,DONE:服务订单完成,REVOKED:商户取消服务订单,EXPIRED:服务订单已失效
	StateDescription    string           `json:"state_description,omitempty"` // 对服务订单"进行中"状态的附加说明。USER_CONFIRM:用户确认,MCH_COMPLETE:商户完结
	PostPayments        []*PostPayments  `json:"post_payments,omitempty"`     // 后付费项目列表,最多包含100条付费项目。 如果传入,用户侧则显示此参数。
	PostDiscounts       []*PostDiscounts `json:"post_discounts,omitempty"`    // 后付费商户优惠,最多包含30条付费项目。 如果传入,用户侧则显示此参数。
	RiskFund            *RiskFund        `json:"risk_fund"`                   // 订单风险金信息
	TimeRange           *TimeRange       `json:"time_range"`                  // 服务时间范围
	Location            *Location        `json:"location,omitempty"`          // 服务位置信息
	Attach              string           `json:"attach,omitempty"`            // 商户数据包,可存放本订单所需信息,需要先urlencode后传入,总长度不大于256字符,超出报错处理。
	NotifyUrl           string           `json:"notify_url,omitempty"`        // 商户接收用户确认订单或扣款成功回调通知的地址。
	OrderId             string           `json:"order_id"`                    // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
	Package             string           `json:"package"`                     // 用户跳转到微信侧小程序订单数据,需确认模式特有API中调起支付分-确认订单传入。该数据一小时内有效。
}

type ScoreOrderCreateRsp added in v1.5.39

type ScoreOrderCreateRsp struct {
	Code     int               `json:"-"`
	SignInfo *SignInfo         `json:"-"`
	Response *ScoreOrderCreate `json:"response,omitempty"`
	Error    string            `json:"-"`
}

创建支付分订单 Rsp

type ScoreOrderModify added in v1.5.39

type ScoreOrderModify struct {
	Appid               string           `json:"appid"`                       // 调用接口提交的公众账号ID。
	Mchid               string           `json:"mchid"`                       // 调用接口提交的商户号。
	ServiceId           string           `json:"service_id"`                  // 调用该接口提交的服务ID。
	OutTradeNo          string           `json:"out_trade_no"`                // 调用接口提交的商户服务订单号。
	ServiceIntroduction string           `json:"service_introduction"`        // 服务信息,用于介绍本订单所提供的服务。
	State               string           `json:"state"`                       // 表示当前单据状态。枚举值:CREATED:商户已创建服务订单,DOING:服务订单进行中,DONE:服务订单完成,REVOKED:商户取消服务订单,EXPIRED:服务订单已失效
	StateDescription    string           `json:"state_description,omitempty"` // 对服务订单"进行中"状态的附加说明。USER_CONFIRM:用户确认,MCH_COMPLETE:商户完结
	TotalAmount         int              `json:"total_amount,omitempty"`      // 总金额,大于等于0的数字,单位为分,只能为整数
	PostPayments        []*PostPayments  `json:"post_payments,omitempty"`     // 后付费项目列表,最多包含100条付费项目。 如果传入,用户侧则显示此参数。
	PostDiscounts       []*PostDiscounts `json:"post_discounts,omitempty"`    // 后付费商户优惠,最多包含30条付费项目。 如果传入,用户侧则显示此参数。
	RiskFund            *RiskFund        `json:"risk_fund"`                   // 订单风险金信息
	TimeRange           *TimeRange       `json:"time_range"`                  // 服务时间范围
	Location            *Location        `json:"location,omitempty"`          // 服务位置信息
	Attach              string           `json:"attach,omitempty"`            // 商户数据包,可存放本订单所需信息,需要先urlencode后传入,总长度不大于256字符,超出报错处理。
	NotifyUrl           string           `json:"notify_url,omitempty"`        // 商户接收用户确认订单或扣款成功回调通知的地址。
	OrderId             string           `json:"order_id"`                    // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
	NeedCollection      bool             `json:"need_collection,omitempty"`   // 是否需要收款
	Collection          *Collection      `json:"collection,omitempty"`        // 收款信息
}

type ScoreOrderModifyRsp added in v1.5.39

type ScoreOrderModifyRsp struct {
	Code     int               `json:"-"`
	SignInfo *SignInfo         `json:"-"`
	Response *ScoreOrderModify `json:"response,omitempty"`
	Error    string            `json:"-"`
}

修改订单金额 Rsp

type ScoreOrderPay added in v1.5.39

type ScoreOrderPay struct {
	Appid      string `json:"appid"`        // 调用接口提交的公众账号ID。
	Mchid      string `json:"mchid"`        // 调用接口提交的商户号。
	ServiceId  string `json:"service_id"`   // 调用该接口提交的服务ID。
	OutTradeNo string `json:"out_trade_no"` // 调用接口提交的商户服务订单号。
	OrderId    string `json:"order_id"`     // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
}

type ScoreOrderPayRsp added in v1.5.39

type ScoreOrderPayRsp struct {
	Code     int            `json:"-"`
	SignInfo *SignInfo      `json:"-"`
	Response *ScoreOrderPay `json:"response,omitempty"`
	Error    string         `json:"-"`
}

商户发起催收扣款 Rsp

type ScoreOrderQuery added in v1.5.39

type ScoreOrderQuery struct {
	Appid               string           `json:"appid"`                       // 调用接口提交的公众账号ID。
	Mchid               string           `json:"mchid"`                       // 调用接口提交的商户号。
	ServiceId           string           `json:"service_id"`                  // 调用该接口提交的服务ID。
	OutTradeNo          string           `json:"out_trade_no"`                // 调用接口提交的商户服务订单号。
	ServiceIntroduction string           `json:"service_introduction"`        // 服务信息,用于介绍本订单所提供的服务。
	State               string           `json:"state"`                       // 表示当前单据状态。枚举值:CREATED:商户已创建服务订单,DOING:服务订单进行中,DONE:服务订单完成,REVOKED:商户取消服务订单,EXPIRED:服务订单已失效
	StateDescription    string           `json:"state_description,omitempty"` // 对服务订单"进行中"状态的附加说明。USER_CONFIRM:用户确认,MCH_COMPLETE:商户完结
	TotalAmount         int              `json:"total_amount,omitempty"`      // 总金额,大于等于0的数字,单位为分,只能为整数
	PostPayments        []*PostPayments  `json:"post_payments,omitempty"`     // 后付费项目列表,最多包含100条付费项目。 如果传入,用户侧则显示此参数。
	PostDiscounts       []*PostDiscounts `json:"post_discounts,omitempty"`    // 后付费商户优惠,最多包含30条付费项目。 如果传入,用户侧则显示此参数。
	RiskFund            *RiskFund        `json:"risk_fund"`                   // 订单风险金信息
	TimeRange           *TimeRange       `json:"time_range"`                  // 服务时间范围
	Location            *Location        `json:"location,omitempty"`          // 服务位置信息
	Attach              string           `json:"attach,omitempty"`            // 商户数据包,可存放本订单所需信息,需要先urlencode后传入,总长度不大于256字符,超出报错处理。
	NotifyUrl           string           `json:"notify_url"`                  // 商户接收用户确认订单或扣款成功回调通知的地址。
	OrderId             string           `json:"order_id"`                    // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
	NeedCollection      bool             `json:"need_collection,omitempty"`   // 是否需要收款
	Collection          *Collection      `json:"collection,omitempty"`        // 收款信息
	Openid              string           `json:"openid,omitempty"`            // 微信用户在商户对应appid下的唯一标识
}

type ScoreOrderQueryRsp added in v1.5.39

type ScoreOrderQueryRsp struct {
	Code     int              `json:"-"`
	SignInfo *SignInfo        `json:"-"`
	Response *ScoreOrderQuery `json:"response,omitempty"`
	Error    string           `json:"-"`
}

查询支付分订单 Rsp

type ScoreOrderSync added in v1.5.39

type ScoreOrderSync struct {
	Appid               string           `json:"appid"`                       // 调用接口提交的公众账号ID。
	Mchid               string           `json:"mchid"`                       // 调用接口提交的商户号。
	ServiceId           string           `json:"service_id"`                  // 调用该接口提交的服务ID。
	OutTradeNo          string           `json:"out_trade_no"`                // 调用接口提交的商户服务订单号。
	ServiceIntroduction string           `json:"service_introduction"`        // 服务信息,用于介绍本订单所提供的服务。
	State               string           `json:"state"`                       // 表示当前单据状态。枚举值:CREATED:商户已创建服务订单,DOING:服务订单进行中,DONE:服务订单完成,REVOKED:商户取消服务订单,EXPIRED:服务订单已失效
	StateDescription    string           `json:"state_description,omitempty"` // 对服务订单"进行中"状态的附加说明。USER_CONFIRM:用户确认,MCH_COMPLETE:商户完结
	TotalAmount         int              `json:"total_amount"`                // 总金额,大于等于0的数字,单位为分,只能为整数
	PostPayments        []*PostPayments  `json:"post_payments,omitempty"`     // 后付费项目列表,最多包含100条付费项目。 如果传入,用户侧则显示此参数。
	PostDiscounts       []*PostDiscounts `json:"post_discounts,omitempty"`    // 后付费商户优惠,最多包含30条付费项目。 如果传入,用户侧则显示此参数。
	RiskFund            *RiskFund        `json:"risk_fund,omitempty"`         // 订单风险金信息
	TimeRange           *TimeRange       `json:"time_range,omitempty"`        // 服务时间范围
	Location            *Location        `json:"location,omitempty"`          // 服务位置信息
	Attach              string           `json:"attach,omitempty"`            // 商户数据包,可存放本订单所需信息,需要先urlencode后传入,总长度不大于256字符,超出报错处理。
	NotifyUrl           string           `json:"notify_url,omitempty"`        // 商户接收用户确认订单或扣款成功回调通知的地址。
	OrderId             string           `json:"order_id"`                    // 微信支付服务订单号,每个微信支付服务订单号与商户号下对应的商户服务订单号一一对应。
	NeedCollection      bool             `json:"need_collection,omitempty"`   // 是否需要收款
	Collection          *Collection      `json:"collection,omitempty"`        // 收款信息
	Openid              string           `json:"openid"`                      // 微信用户在商户对应appid下的唯一标识
}

type ScoreOrderSyncRsp added in v1.5.39

type ScoreOrderSyncRsp struct {
	Code     int             `json:"-"`
	SignInfo *SignInfo       `json:"-"`
	Response *ScoreOrderSync `json:"response,omitempty"`
	Error    string          `json:"-"`
}

同步服务订单信息 Rsp

type ScorePermission added in v1.5.40

type ScorePermission struct {
	ApplyPermissionsToken string `json:"apply_permissions_token"` // 用于跳转到微信侧小程序授权数据,跳转到微信侧小程序传入,时效性为1小时
}

type ScorePermissionOpenidQuery added in v1.5.40

type ScorePermissionOpenidQuery struct {
	Appid                    string `json:"appid"`                               // 调用接口提交的公众账号ID。
	Mchid                    string `json:"mchid"`                               // 调用接口提交的商户号。
	ServiceId                string `json:"service_id"`                          // 调用该接口提交的服务ID。
	Openid                   string `json:"openid,omitempty"`                    // 微信用户在商户对应appid下的唯一标识
	AuthorizationCode        string `json:"authorization_code"`                  // 预授权成功时的授权协议号。
	AuthorizationState       string `json:"authorization_state"`                 // 标识用户授权服务情况:UNAVAILABLE:用户未授权服务,AVAILABLE:用户已授权服务,UNBINDUSER:未绑定用户(已经预授权但未完成正式授权)
	CancelAuthorizationTime  string `json:"cancel_authorization_time,omitempty"` // 最近一次解除授权时间, 示例值:2015-05-20T13:29:35.120+08:00
	AuthorizationSuccessTime string `json:"authorization_success_time"`          // 最近一次授权成功时间, 示例值:2015-05-20T13:29:35.120+08:00
}

type ScorePermissionOpenidQueryRsp added in v1.5.40

type ScorePermissionOpenidQueryRsp struct {
	Code     int                         `json:"-"`
	SignInfo *SignInfo                   `json:"-"`
	Response *ScorePermissionOpenidQuery `json:"response,omitempty"`
	Error    string                      `json:"-"`
}

查询用户授权记录(openid) Rsp

type ScorePermissionQuery added in v1.5.40

type ScorePermissionQuery struct {
	Appid                    string `json:"appid"`                               // 调用接口提交的公众账号ID。
	Mchid                    string `json:"mchid"`                               // 调用接口提交的商户号。
	ServiceId                string `json:"service_id"`                          // 调用该接口提交的服务ID。
	Openid                   string `json:"openid,omitempty"`                    // 微信用户在商户对应appid下的唯一标识
	AuthorizationCode        string `json:"authorization_code"`                  // 预授权成功时的授权协议号。
	AuthorizationState       string `json:"authorization_state"`                 // 标识用户授权服务情况:UNAVAILABLE:用户未授权服务,AVAILABLE:用户已授权服务,UNBINDUSER:未绑定用户(已经预授权但未完成正式授权)
	NotifyUrl                string `json:"notify_url,omitempty"`                // 商户接收用户确认订单或扣款成功回调通知的地址。
	CancelAuthorizationTime  string `json:"cancel_authorization_time,omitempty"` // 最近一次解除授权时间, 示例值:2015-05-20T13:29:35.120+08:00
	AuthorizationSuccessTime string `json:"authorization_success_time"`          // 最近一次授权成功时间, 示例值:2015-05-20T13:29:35.120+08:00
}

type ScorePermissionQueryRsp added in v1.5.40

type ScorePermissionQueryRsp struct {
	Code     int                   `json:"-"`
	SignInfo *SignInfo             `json:"-"`
	Response *ScorePermissionQuery `json:"response,omitempty"`
	Error    string                `json:"-"`
}

查询用户授权记录(授权协议号) Rsp

type ScorePermissionRsp added in v1.5.40

type ScorePermissionRsp struct {
	Code     int              `json:"-"`
	SignInfo *SignInfo        `json:"-"`
	Response *ScorePermission `json:"response,omitempty"`
	Error    string           `json:"-"`
}

创单结单合并 Rsp

type SignInfo

type SignInfo struct {
	HeaderTimestamp string `json:"Wechatpay-Timestamp"`
	HeaderNonce     string `json:"Wechatpay-Nonce"`
	HeaderSignature string `json:"Wechatpay-Signature"`
	HeaderSerial    string `json:"Wechatpay-Serial"`
	SignBody        string `json:"sign_body"`
}

type SubOrders added in v1.5.26

type SubOrders struct {
	Mchid         string         `json:"mchid"`               // 子单发起方商户号,必须与发起方Appid有绑定关系
	TradeType     string         `json:"trade_type"`          // 交易类型,枚举值:NATIVE:扫码支付,JSAPI:公众号支付,APP:APP支付,MWEB:H5支付
	TradeState    string         `json:"trade_state"`         // 交易状态,枚举值:SUCCESS:支付成功, REFUND:转入退款, NOTPAY:未支付, CLOSED:已关闭, REVOKED:已撤销(付款码支付), USERPAYING:用户支付中(付款码支付), PAYERROR:支付失败(其他原因,如银行返回失败)
	BankType      string         `json:"bank_type,omitempty"` // 银行类型,采用字符串类型的银行标识
	Attach        string         `json:"attach"`              // 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
	SuccessTime   string         `json:"success_time"`        // 支付完成时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒
	TransactionId string         `json:"transaction_id"`      // 微信支付系统生成的订单号
	OutTradeNo    string         `json:"out_trade_no"`        // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
	SubMchid      string         `json:"sub_mchid"`           // 二级商户商户号,由微信支付生成并下发。服务商子商户的商户号,被合单方。直连商户不用传二级商户号
	Amount        *CombineAmount `json:"amount"`              // 订单金额信息,当支付成功时返回该字段

}

type TimeRange added in v1.5.39

type TimeRange struct {
	StartTime       string `json:"start_time"`                  // 服务开始时间,20091225091010
	StartTimeRemark string `json:"start_time_remark,omitempty"` // 服务开始时间备注
	EndTime         string `json:"end_time,omitempty"`          // 预计服务结束时间,20091225121010
	EndTimeRemark   string `json:"end_time_remark,omitempty"`   // 预计服务结束时间备注
}

type TradeBill

type TradeBill struct {
	HashType    string `json:"hash_type"`
	HashValue   string `json:"hash_value"`
	DownloadUrl string `json:"download_url"`
}

type V3DecryptCombineResult added in v1.5.35

type V3DecryptCombineResult struct {
	CombineAppid      string       `json:"combine_appid"`
	CombineMchid      string       `json:"combine_mchid"`
	CombineOutTradeNo string       `json:"combine_out_trade_no"`
	SceneInfo         *SceneInfo   `json:"scene_info"`
	SubOrders         []*SubOrders `json:"sub_orders"`         // 最多支持子单条数:50
	CombinePayerInfo  *Payer       `json:"combine_payer_info"` // 支付者信息
}

func V3DecryptCombineNotifyCipherText added in v1.5.35

func V3DecryptCombineNotifyCipherText(ciphertext, nonce, additional, apiV3Key string) (result *V3DecryptCombineResult, err error)

解密合单支付回调中的加密订单信息

type V3DecryptRefundResult added in v1.5.35

type V3DecryptRefundResult struct {
	Mchid               string        `json:"mchid"`
	OutTradeNo          string        `json:"out_trade_no"`
	TransactionId       string        `json:"transaction_id"`
	OutRefundNo         string        `json:"out_refund_no"`
	RefundId            string        `json:"refund_id"`
	RefundStatus        string        `json:"refund_status"`
	SuccessTime         string        `json:"success_time"`
	UserReceivedAccount string        `json:"user_received_account"`
	Amount              *RefundAmount `json:"amount"`
}

func V3DecryptRefundNotifyCipherText added in v1.5.35

func V3DecryptRefundNotifyCipherText(ciphertext, nonce, additional, apiV3Key string) (result *V3DecryptRefundResult, err error)

解密普通退款回调中的加密订单信息

type V3DecryptResult

type V3DecryptResult struct {
	Appid           string             `json:"appid"`
	Mchid           string             `json:"mchid"`
	OutTradeNo      string             `json:"out_trade_no"`
	TransactionId   string             `json:"transaction_id"`
	TradeType       string             `json:"trade_type"`
	TradeState      string             `json:"trade_state"`
	TradeStateDesc  string             `json:"trade_state_desc"`
	BankType        string             `json:"bank_type"`
	Attach          string             `json:"attach"`
	SuccessTime     string             `json:"success_time"`
	Payer           *Payer             `json:"payer"`
	Amount          *Amount            `json:"amount"`
	SceneInfo       *SceneInfo         `json:"scene_info"`
	PromotionDetail []*PromotionDetail `json:"promotion_detail"`
}

func V3DecryptNotifyCipherText

func V3DecryptNotifyCipherText(ciphertext, nonce, additional, apiV3Key string) (result *V3DecryptResult, err error)

解密普通支付回调中的加密订单信息

type V3NotifyReq

type V3NotifyReq struct {
	Id           string    `json:"id"`
	CreateTime   string    `json:"create_time"`
	ResourceType string    `json:"resource_type"`
	EventType    string    `json:"event_type"`
	Summary      string    `json:"summary"`
	Resource     *Resource `json:"resource"`
	SignInfo     *SignInfo `json:"-"`
}

func V3ParseNotify

func V3ParseNotify(req *http.Request) (notifyReq *V3NotifyReq, err error)

解析微信回调请求的参数到 V3NotifyReq 结构体

func (*V3NotifyReq) DecryptCipherText

func (v *V3NotifyReq) DecryptCipherText(apiV3Key string) (result *V3DecryptResult, err error)

解密普通支付回调中的加密订单信息

func (*V3NotifyReq) DecryptCombineCipherText added in v1.5.35

func (v *V3NotifyReq) DecryptCombineCipherText(apiV3Key string) (result *V3DecryptCombineResult, err error)

解密合单支付回调中的加密订单信息

func (*V3NotifyReq) DecryptRefundCipherText added in v1.5.35

func (v *V3NotifyReq) DecryptRefundCipherText(apiV3Key string) (result *V3DecryptRefundResult, err error)

解密普通退款回调中的加密订单信息

func (*V3NotifyReq) VerifySign

func (v *V3NotifyReq) VerifySign(wxPkContent string) (err error)

异步通知验签

type V3NotifyRsp

type V3NotifyRsp struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL