Documentation
¶
Overview ¶
定义微信支付相关数据结构和 helper 函数, 微信支付接口 v2.7
Index ¶
- Constants
- func MakePayPackage(para PayPackageParameters, partnerKey string) []byte
- func NativeURL(AppId, AppKey, NonceStr, Timestamp, ProductId string) string
- type AlarmNotifyPostData
- func (data AlarmNotifyPostData) AppId() string
- func (data AlarmNotifyPostData) CheckSignature(appKey string) (err error)
- func (data AlarmNotifyPostData) Content() string
- func (data AlarmNotifyPostData) Description() string
- func (data AlarmNotifyPostData) ErrorType() string
- func (data AlarmNotifyPostData) SignMethod() string
- func (data AlarmNotifyPostData) Signature() string
- func (data AlarmNotifyPostData) TimeStamp() string
- type DeliverNotifyData
- func (data DeliverNotifyData) SetAppId(str string)
- func (data DeliverNotifyData) SetDeliverMsg(str string)
- func (data DeliverNotifyData) SetDeliverStatus(status int)
- func (data DeliverNotifyData) SetDeliverTimeStamp(t time.Time)
- func (data DeliverNotifyData) SetOpenId(str string)
- func (data DeliverNotifyData) SetOutTradeNo(str string)
- func (data DeliverNotifyData) SetSignMethod(str string)
- func (data DeliverNotifyData) SetSignature(appKey string) (err error)
- func (data DeliverNotifyData) SetTransactionId(str string)
- type DownloadBillRequest
- func (req DownloadBillRequest) SetCftSignMethod(n int)
- func (req DownloadBillRequest) SetMchId(str string)
- func (req DownloadBillRequest) SetMchType(n int)
- func (req DownloadBillRequest) SetSignature(Key string) (err error)
- func (req DownloadBillRequest) SetTimestamp(t time.Time)
- func (req DownloadBillRequest) SetTransactionTime(t time.Time)
- type JSAPIPayRequestParameters
- type NormalRefundQueryRequest
- func (req NormalRefundQueryRequest) SetCharset(str string)
- func (req NormalRefundQueryRequest) SetOutRefundNo(str string)
- func (req NormalRefundQueryRequest) SetOutTradeNo(str string)
- func (req NormalRefundQueryRequest) SetPartnerId(str string)
- func (req NormalRefundQueryRequest) SetRefundId(str string)
- func (req NormalRefundQueryRequest) SetSignKeyIndex(n int)
- func (req NormalRefundQueryRequest) SetSignMethod(str string)
- func (req NormalRefundQueryRequest) SetSignature(Key string) (err error)
- func (req NormalRefundQueryRequest) SetTransactionId(str string)
- func (req NormalRefundQueryRequest) SetUseSPBillNoFlag(n int)
- type NormalRefundQueryResponse
- func (resp NormalRefundQueryResponse) Charset() string
- func (resp NormalRefundQueryResponse) CheckSignature(Key string) (err error)
- func (resp NormalRefundQueryResponse) OutRefundNo(n int) string
- func (resp NormalRefundQueryResponse) OutTradeNo() string
- func (resp NormalRefundQueryResponse) PartnerId() string
- func (resp NormalRefundQueryResponse) RecvUserId(n int) string
- func (resp NormalRefundQueryResponse) RecvUserName(n int) string
- func (resp NormalRefundQueryResponse) RefundChannel(n int) string
- func (resp NormalRefundQueryResponse) RefundCount() string
- func (resp NormalRefundQueryResponse) RefundFee(n int) string
- func (resp NormalRefundQueryResponse) RefundId(n int) string
- func (resp NormalRefundQueryResponse) RefundState(n int) string
- func (resp NormalRefundQueryResponse) RetCode() string
- func (resp NormalRefundQueryResponse) RetMsg() string
- func (resp NormalRefundQueryResponse) SignMethod() string
- func (resp NormalRefundQueryResponse) Signature() string
- func (resp NormalRefundQueryResponse) TransactionId() string
- type OrderNotifyPostData
- func (data OrderNotifyPostData) AppId() string
- func (data OrderNotifyPostData) CheckSignature(appKey string) (err error)
- func (data OrderNotifyPostData) IsSubscribe() string
- func (data OrderNotifyPostData) NonceStr() string
- func (data OrderNotifyPostData) OpenId() string
- func (data OrderNotifyPostData) SignMethod() string
- func (data OrderNotifyPostData) Signature() string
- func (data OrderNotifyPostData) TimeStamp() string
- type OrderNotifyURLData
- func (data OrderNotifyURLData) Attach() string
- func (data OrderNotifyURLData) BankBillNo() string
- func (data OrderNotifyURLData) BankType() string
- func (data OrderNotifyURLData) Charset() string
- func (data OrderNotifyURLData) CheckSignature(partnerKey string) (err error)
- func (data OrderNotifyURLData) Discount() string
- func (data OrderNotifyURLData) FeeType() string
- func (data OrderNotifyURLData) NotifyId() string
- func (data OrderNotifyURLData) OutTradeNo() string
- func (data OrderNotifyURLData) PartnerId() string
- func (data OrderNotifyURLData) ProductFee() string
- func (data OrderNotifyURLData) SignMethod() string
- func (data OrderNotifyURLData) Signature() string
- func (data OrderNotifyURLData) TimeEnd() string
- func (data OrderNotifyURLData) TotalFee() string
- func (data OrderNotifyURLData) TradeMode() string
- func (data OrderNotifyURLData) TradeState() string
- func (data OrderNotifyURLData) TransactionId() string
- func (data OrderNotifyURLData) TransportFee() string
- type OrderQueryRequest
- func (req OrderQueryRequest) SetAppId(AppId string)
- func (req OrderQueryRequest) SetPackage(OutTradeNo, PartnerId, PartnerKey string)
- func (req OrderQueryRequest) SetSignMethod(SignMethod string)
- func (req OrderQueryRequest) SetSignature(appKey string) (err error)
- func (req OrderQueryRequest) SetTimeStamp(t time.Time)
- type OrderQueryResponse
- type PayPackageParameters
- func (para PayPackageParameters) SetAttach(Attach string)
- func (para PayPackageParameters) SetBankType(BankType string)
- func (para PayPackageParameters) SetBillCreateIP(BillCreateIP string)
- func (para PayPackageParameters) SetBody(Body string)
- func (para PayPackageParameters) SetCharset(Charset string)
- func (para PayPackageParameters) SetFeeType(n int)
- func (para PayPackageParameters) SetGoodsTag(GoodsTag string)
- func (para PayPackageParameters) SetNotifyURL(NotifyURL string)
- func (para PayPackageParameters) SetOutTradeNo(OutTradeNo string)
- func (para PayPackageParameters) SetPartnerId(PartnerId string)
- func (para PayPackageParameters) SetProductFee(n int)
- func (para PayPackageParameters) SetTimeExpire(t time.Time)
- func (para PayPackageParameters) SetTimeStart(t time.Time)
- func (para PayPackageParameters) SetTotalFee(n int)
- func (para PayPackageParameters) SetTransportFee(n int)
- type PayPackageRequest
- func (req PayPackageRequest) AppId() string
- func (req PayPackageRequest) CheckSignature(appKey string) (err error)
- func (req PayPackageRequest) IsSubscribe() string
- func (req PayPackageRequest) NonceStr() string
- func (req PayPackageRequest) OpenId() string
- func (req PayPackageRequest) ProductId() string
- func (req PayPackageRequest) SignMethod() string
- func (req PayPackageRequest) Signature() string
- func (req PayPackageRequest) TimeStamp() string
- type PayPackageResponse
- func (resp PayPackageResponse) SetAppId(AppId string)
- func (resp PayPackageResponse) SetNonceStr(NonceStr string)
- func (resp PayPackageResponse) SetPackage(Package string)
- func (resp PayPackageResponse) SetRetCode(RetCode int)
- func (resp PayPackageResponse) SetRetMsg(RetMsg string)
- func (resp PayPackageResponse) SetSignMethod(SignMethod string)
- func (resp PayPackageResponse) SetSignature(appKey string) (err error)
- func (resp PayPackageResponse) SetTimeStamp(t time.Time)
- type RefundRequest
- func (req RefundRequest) SetCharset(str string)
- func (req RefundRequest) SetOperUserId(id int)
- func (req RefundRequest) SetOperUserPwd(str string)
- func (req RefundRequest) SetOutRefundNo(str string)
- func (req RefundRequest) SetOutTradeNo(str string)
- func (req RefundRequest) SetPartnerId(str string)
- func (req RefundRequest) SetRecvUserId(str string)
- func (req RefundRequest) SetRecvUserName(str string)
- func (req RefundRequest) SetRefundFee(n int)
- func (req RefundRequest) SetRefundType(n int)
- func (req RefundRequest) SetServiceVersion(str string)
- func (req RefundRequest) SetSignKeyIndex(n int)
- func (req RefundRequest) SetSignMethod(str string)
- func (req RefundRequest) SetSignature(Key string) (err error)
- func (req RefundRequest) SetTotalFee(n int)
- func (req RefundRequest) SetTransactionId(str string)
- func (req RefundRequest) SetUseSPBillNoFlag(n int)
- type RefundResponse
- func (resp RefundResponse) Charset() string
- func (resp RefundResponse) CheckSignature(Key string) (err error)
- func (resp RefundResponse) OutRefundNo() string
- func (resp RefundResponse) OutTradeNo() string
- func (resp RefundResponse) PartnerId() string
- func (resp RefundResponse) RecvUserId() string
- func (resp RefundResponse) RecvUserName() string
- func (resp RefundResponse) RefundChannel() string
- func (resp RefundResponse) RefundFee() string
- func (resp RefundResponse) RefundId() string
- func (resp RefundResponse) RefundStatus() string
- func (resp RefundResponse) RetCode() string
- func (resp RefundResponse) RetMsg() string
- func (resp RefundResponse) SignMethod() string
- func (resp RefundResponse) Signature() string
- func (resp RefundResponse) TransactionId() string
Constants ¶
const ( BANK_TYPE_WX = "WX" FEE_TYPE_RMB = 1 IS_SUBSCRIBE_TRUE = 1 IS_SUBSCRIBE_FALSE = 0 CHARSET_GBK = "GBK" CHARSET_UTF8 = "UTF-8" )
const ( // 用户支付成功后, 通知商户后台消息中的字段常量 ORDER_NOTIFY_TRADE_MODE_IMMEDIATE = 1 // TradeMode 即时到账 ORDER_NOTIFY_TRADE_STATE_SUCCESS = 0 // TradeState 成功 )
const ( // 微信后台通过 notify_url 通知商户, 商户做业务处理后, 需要以字符串的形式反馈处理结果 // success: 处理成功, 微信系统收到此结果后不再进行后续通知 // fail 或其它字符: 处理不成功, 微信收到此结果或者没有收到任何结果, 系统通过补单机制再次通知 ORDER_NOTIFY_RESPONSE_SUCCESS = "success" // 商户收到告警通知后, 需要成功返回success. 在通过功能发布检测时, 请保证已调通. ALARM_NOTIFY_RESPONSE_SUCCESS = "success" )
const ( // 发货通知 DELIVER_NOTIFY_STATUS_SUCCESS = 1 DELIVER_NOTIFY_STATUS_FAIL = 0 )
Variables ¶
This section is empty.
Functions ¶
func MakePayPackage ¶
func MakePayPackage(para PayPackageParameters, partnerKey string) []byte
生成订单详情字符串(package)
PayPackageParameters: 订单详情参数 partnerKey: 财付通商户权限密钥 Key
Types ¶
type AlarmNotifyPostData ¶
为了及时通知商户异常,提高商户在微信平台的服务质量。微信后台会向商户推送告警 通知,包括发货延迟、调用失败、通知失败等情况,通知的地址是商户在申请支付时填写的 告警通知URL,在“公众平台-服务-服务中心-商户功能-商户基本资料-告警通知URL”可 以查看。商户接收到告警通知后请尽快修复其中提到的问题,以免影响线上经营。(发货时 间要求请参考5.3.1) 商户收到告警通知后,需要成功返回success。在通过功能发布检测时,请保证已调通。
这是告警通知URL 接收的postData 中的 xml 数据
func (AlarmNotifyPostData) AppId ¶
func (data AlarmNotifyPostData) AppId() string
func (AlarmNotifyPostData) CheckSignature ¶
func (data AlarmNotifyPostData) CheckSignature(appKey string) (err error)
检查 AlarmNotifyPostData 的签名是否合法, 合法返回 nil, 否则返回错误信息.
appKey: 即 paySignKey, 公众号支付请求中用于加密的密钥 Key
func (AlarmNotifyPostData) Content ¶
func (data AlarmNotifyPostData) Content() string
func (AlarmNotifyPostData) Description ¶
func (data AlarmNotifyPostData) Description() string
func (AlarmNotifyPostData) ErrorType ¶
func (data AlarmNotifyPostData) ErrorType() string
func (AlarmNotifyPostData) SignMethod ¶
func (data AlarmNotifyPostData) SignMethod() string
func (AlarmNotifyPostData) Signature ¶
func (data AlarmNotifyPostData) Signature() string
func (AlarmNotifyPostData) TimeStamp ¶
func (data AlarmNotifyPostData) TimeStamp() string
type DeliverNotifyData ¶
为了更好地跟踪订单的情况,需要第三方在收到最终支付通知之后,调用发货通知API 告知微信后台该订单的发货状态。 发货时间限制:虚拟、服务类24小时内,实物类72小时内。 请在收到支付通知后,按时发货,并使用发货通知接口将相关信息同步到微信后台。若 平台在规定时间内没有收到,将视作发货超时处理。
发货通知的真正的数据是放在PostData 中的,格式为json
func (DeliverNotifyData) SetAppId ¶
func (data DeliverNotifyData) SetAppId(str string)
func (DeliverNotifyData) SetDeliverMsg ¶
func (data DeliverNotifyData) SetDeliverMsg(str string)
func (DeliverNotifyData) SetDeliverStatus ¶
func (data DeliverNotifyData) SetDeliverStatus(status int)
func (DeliverNotifyData) SetDeliverTimeStamp ¶
func (data DeliverNotifyData) SetDeliverTimeStamp(t time.Time)
func (DeliverNotifyData) SetOpenId ¶
func (data DeliverNotifyData) SetOpenId(str string)
func (DeliverNotifyData) SetOutTradeNo ¶
func (data DeliverNotifyData) SetOutTradeNo(str string)
func (DeliverNotifyData) SetSignMethod ¶
func (data DeliverNotifyData) SetSignMethod(str string)
func (DeliverNotifyData) SetSignature ¶
func (data DeliverNotifyData) SetSignature(appKey string) (err error)
设置签名字段.
appKey: 即 paySignKey, 公众号支付请求中用于加密的密钥 Key NOTE: 要求在 DeliverNotifyData 其他字段设置完毕后才能调用这个函数, 否则签名就不正确.
func (DeliverNotifyData) SetTransactionId ¶
func (data DeliverNotifyData) SetTransactionId(str string)
type DownloadBillRequest ¶
对账单下载接口 请求参数
func (DownloadBillRequest) SetCftSignMethod ¶
func (req DownloadBillRequest) SetCftSignMethod(n int)
func (DownloadBillRequest) SetMchId ¶
func (req DownloadBillRequest) SetMchId(str string)
func (DownloadBillRequest) SetMchType ¶
func (req DownloadBillRequest) SetMchType(n int)
func (DownloadBillRequest) SetSignature ¶
func (req DownloadBillRequest) SetSignature(Key string) (err error)
设置签名字段.
Key: 商户支付密钥Key NOTE: 要求在 DownloadBillRequest 其他字段设置完毕后才能调用这个函数, 否则签名就不正确.
func (DownloadBillRequest) SetTimestamp ¶
func (req DownloadBillRequest) SetTimestamp(t time.Time)
func (DownloadBillRequest) SetTransactionTime ¶
func (req DownloadBillRequest) SetTransactionTime(t time.Time)
type JSAPIPayRequestParameters ¶
type JSAPIPayRequestParameters struct {
AppId string `json:"appId"` // 必须, 公众号身份的唯一标识
NonceStr string `json:"nonceStr"` // 必须, 商户生成的随机字符串, 32个字符以内
TimeStamp string `json:"timeStamp"` // 必须, unixtime, 商户生成
Package string `json:"package"` // 必须, 订单详情组合成的字符串, 4096个字符以内, MakePayPackage
Signature string `json:"paySign"` // 必须, 该 PayRequestParameters 自身的签名. see PayRequestParameters.SetSignature
SignMethod string `json:"signType"` // 必须, 签名方式, 目前仅支持 SHA1
}
func (*JSAPIPayRequestParameters) SetSignature ¶
func (para *JSAPIPayRequestParameters) SetSignature(appKey string) (err error)
设置签名字段.
appKey: 即 paySignKey, 公众号支付请求中用于加密的密钥 Key NOTE: 要求在 PayRequestParameters 其他字段设置完毕后才能调用这个函数, 否则签名就不正确.
func (*JSAPIPayRequestParameters) SetTimeStamp ¶
func (para *JSAPIPayRequestParameters) SetTimeStamp(t time.Time)
type NormalRefundQueryRequest ¶
退款明细查询 请求参数
func (NormalRefundQueryRequest) SetCharset ¶
func (req NormalRefundQueryRequest) SetCharset(str string)
func (NormalRefundQueryRequest) SetOutRefundNo ¶
func (req NormalRefundQueryRequest) SetOutRefundNo(str string)
func (NormalRefundQueryRequest) SetOutTradeNo ¶
func (req NormalRefundQueryRequest) SetOutTradeNo(str string)
func (NormalRefundQueryRequest) SetPartnerId ¶
func (req NormalRefundQueryRequest) SetPartnerId(str string)
func (NormalRefundQueryRequest) SetRefundId ¶
func (req NormalRefundQueryRequest) SetRefundId(str string)
func (NormalRefundQueryRequest) SetSignKeyIndex ¶
func (req NormalRefundQueryRequest) SetSignKeyIndex(n int)
func (NormalRefundQueryRequest) SetSignMethod ¶
func (req NormalRefundQueryRequest) SetSignMethod(str string)
func (NormalRefundQueryRequest) SetSignature ¶
func (req NormalRefundQueryRequest) SetSignature(Key string) (err error)
设置签名字段.
Key: 商户支付密钥Key NOTE: 要求在 NormalRefundQueryRequest 其他字段设置完毕后才能调用这个函数, 否则签名就不正确.
func (NormalRefundQueryRequest) SetTransactionId ¶
func (req NormalRefundQueryRequest) SetTransactionId(str string)
func (NormalRefundQueryRequest) SetUseSPBillNoFlag ¶
func (req NormalRefundQueryRequest) SetUseSPBillNoFlag(n int)
type NormalRefundQueryResponse ¶
退款明细查询 回复参数
func (NormalRefundQueryResponse) Charset ¶
func (resp NormalRefundQueryResponse) Charset() string
func (NormalRefundQueryResponse) CheckSignature ¶
func (resp NormalRefundQueryResponse) CheckSignature(Key string) (err error)
检查 NormalRefundQueryResponse 的签名是否合法, 合法返回 nil, 否则返回错误信息.
Key: 商户支付密钥Key
func (NormalRefundQueryResponse) OutRefundNo ¶
func (resp NormalRefundQueryResponse) OutRefundNo(n int) string
func (NormalRefundQueryResponse) OutTradeNo ¶
func (resp NormalRefundQueryResponse) OutTradeNo() string
func (NormalRefundQueryResponse) PartnerId ¶
func (resp NormalRefundQueryResponse) PartnerId() string
func (NormalRefundQueryResponse) RecvUserId ¶
func (resp NormalRefundQueryResponse) RecvUserId(n int) string
func (NormalRefundQueryResponse) RecvUserName ¶
func (resp NormalRefundQueryResponse) RecvUserName(n int) string
func (NormalRefundQueryResponse) RefundChannel ¶
func (resp NormalRefundQueryResponse) RefundChannel(n int) string
func (NormalRefundQueryResponse) RefundCount ¶
func (resp NormalRefundQueryResponse) RefundCount() string
func (NormalRefundQueryResponse) RefundFee ¶
func (resp NormalRefundQueryResponse) RefundFee(n int) string
func (NormalRefundQueryResponse) RefundId ¶
func (resp NormalRefundQueryResponse) RefundId(n int) string
func (NormalRefundQueryResponse) RefundState ¶
func (resp NormalRefundQueryResponse) RefundState(n int) string
func (NormalRefundQueryResponse) RetCode ¶
func (resp NormalRefundQueryResponse) RetCode() string
func (NormalRefundQueryResponse) RetMsg ¶
func (resp NormalRefundQueryResponse) RetMsg() string
func (NormalRefundQueryResponse) SignMethod ¶
func (resp NormalRefundQueryResponse) SignMethod() string
func (NormalRefundQueryResponse) Signature ¶
func (resp NormalRefundQueryResponse) Signature() string
func (NormalRefundQueryResponse) TransactionId ¶
func (resp NormalRefundQueryResponse) TransactionId() string
type OrderNotifyPostData ¶
用户在成功完成支付后,微信后台通知商户服务器(notify_url)支付结果。 商户可以使用notify_url 的通知结果进行个性化页面的展示。
对后台通知交互时,如果微信收到商户的应答不是success 或超时,微信认为通知失败, 微信会通过一定的策略(如30 分钟共8 次)定期重新发起通知,尽可能提高通知的成功率, 但微信不保证通知最终能成功。 由于存在重新发送后台通知的情况,因此同样的通知可能会多次发送给商户系统。商户 系统必须能够正确处理重复的通知。
微信后台通过 notify_url 通知商户,商户做业务处理后,需要以字符串的形式反馈处理 结果,内容如下: success 处理成功,微信系统收到此结果后不再进行后续通知 fail 或其它字符处理不成功,微信收到此结果或者没有收到任何结果,系统通过补单机制再次通知
这是支付成功后通知消息 post 部分的数据结构.
func (OrderNotifyPostData) AppId ¶
func (data OrderNotifyPostData) AppId() string
func (OrderNotifyPostData) CheckSignature ¶
func (data OrderNotifyPostData) CheckSignature(appKey string) (err error)
检查 OrderNotifyPostData 的签名是否合法, 合法返回 nil, 否则返回错误信息.
appKey: 即 paySignKey, 公众号支付请求中用于加密的密钥 Key
func (OrderNotifyPostData) IsSubscribe ¶
func (data OrderNotifyPostData) IsSubscribe() string
func (OrderNotifyPostData) NonceStr ¶
func (data OrderNotifyPostData) NonceStr() string
func (OrderNotifyPostData) OpenId ¶
func (data OrderNotifyPostData) OpenId() string
func (OrderNotifyPostData) SignMethod ¶
func (data OrderNotifyPostData) SignMethod() string
func (OrderNotifyPostData) Signature ¶
func (data OrderNotifyPostData) Signature() string
func (OrderNotifyPostData) TimeStamp ¶
func (data OrderNotifyPostData) TimeStamp() string
type OrderNotifyURLData ¶
用户在成功完成支付后,微信后台通知商户服务器(notify_url)支付结果。 商户可以使用notify_url 的通知结果进行个性化页面的展示。
对后台通知交互时,如果微信收到商户的应答不是success 或超时,微信认为通知失败, 微信会通过一定的策略(如30 分钟共8 次)定期重新发起通知,尽可能提高通知的成功率, 但微信不保证通知最终能成功。 由于存在重新发送后台通知的情况,因此同样的通知可能会多次发送给商户系统。商户 系统必须能够正确处理重复的通知。
微信后台通过 notify_url 通知商户,商户做业务处理后,需要以字符串的形式反馈处理 结果,内容如下: success 处理成功,微信系统收到此结果后不再进行后续通知 fail 或其它字符处理不成功,微信收到此结果或者没有收到任何结果,系统通过补单机制再次通知
这是支付成功后通知消息 url query 部分的数据结构
func (OrderNotifyURLData) Attach ¶
func (data OrderNotifyURLData) Attach() string
func (OrderNotifyURLData) BankBillNo ¶
func (data OrderNotifyURLData) BankBillNo() string
func (OrderNotifyURLData) BankType ¶
func (data OrderNotifyURLData) BankType() string
func (OrderNotifyURLData) Charset ¶
func (data OrderNotifyURLData) Charset() string
func (OrderNotifyURLData) CheckSignature ¶
func (data OrderNotifyURLData) CheckSignature(partnerKey string) (err error)
检查 OrderNotifyURLData 的签名是否合法, 合法返回 nil, 否则返回错误信息.
partnerKey: 财付通商户权限密钥Key
func (OrderNotifyURLData) Discount ¶
func (data OrderNotifyURLData) Discount() string
func (OrderNotifyURLData) FeeType ¶
func (data OrderNotifyURLData) FeeType() string
func (OrderNotifyURLData) NotifyId ¶
func (data OrderNotifyURLData) NotifyId() string
func (OrderNotifyURLData) OutTradeNo ¶
func (data OrderNotifyURLData) OutTradeNo() string
func (OrderNotifyURLData) PartnerId ¶
func (data OrderNotifyURLData) PartnerId() string
func (OrderNotifyURLData) ProductFee ¶
func (data OrderNotifyURLData) ProductFee() string
func (OrderNotifyURLData) SignMethod ¶
func (data OrderNotifyURLData) SignMethod() string
func (OrderNotifyURLData) Signature ¶
func (data OrderNotifyURLData) Signature() string
func (OrderNotifyURLData) TimeEnd ¶
func (data OrderNotifyURLData) TimeEnd() string
func (OrderNotifyURLData) TotalFee ¶
func (data OrderNotifyURLData) TotalFee() string
func (OrderNotifyURLData) TradeMode ¶
func (data OrderNotifyURLData) TradeMode() string
func (OrderNotifyURLData) TradeState ¶
func (data OrderNotifyURLData) TradeState() string
func (OrderNotifyURLData) TransactionId ¶
func (data OrderNotifyURLData) TransactionId() string
func (OrderNotifyURLData) TransportFee ¶
func (data OrderNotifyURLData) TransportFee() string
type OrderQueryRequest ¶
因为某一方技术的原因,可能导致商户在预期时间内都收不到最终支付通知,此时商户 可以通过该API 来查询订单的详细支付状态。
订单查询的真正数据是放在PostData 中的,格式为json
func (OrderQueryRequest) SetAppId ¶
func (req OrderQueryRequest) SetAppId(AppId string)
func (OrderQueryRequest) SetPackage ¶
func (req OrderQueryRequest) SetPackage(OutTradeNo, PartnerId, PartnerKey string)
func (OrderQueryRequest) SetSignMethod ¶
func (req OrderQueryRequest) SetSignMethod(SignMethod string)
func (OrderQueryRequest) SetSignature ¶
func (req OrderQueryRequest) SetSignature(appKey string) (err error)
设置签名字段.
appKey: 即 paySignKey, 公众号支付请求中用于加密的密钥 Key NOTE: 要求在 OrderQueryRequest 其他字段设置完毕后才能调用这个函数, 否则签名就不正确.
func (OrderQueryRequest) SetTimeStamp ¶
func (req OrderQueryRequest) SetTimeStamp(t time.Time)
type OrderQueryResponse ¶
type OrderQueryResponse struct {
RetCode json.Number `json:"ret_code"` // 查询结果状态码, 0表明成功, 其他表明错误
RetMsg string `json:"ret_msg"` // 查询结果出错信息
Charset string `json:"input_charset"` // 返回信息中的编码方式
TradeMode json.Number `json:"trade_mode"` // 订单状态, 0为成功, 其他为失败
TradeState json.Number `json:"trade_state"` // 交易模式, 1为即时到帐, 其他保留
PartnerId string `json:"partner"` // 财付通商户号
BankType string `json:"bank_type"` // 银行类型
BankBillNo string `json:"bank_billno"` // 银行订单号
TotalFee json.Number `json:"total_fee"` // 总金额, 单位为分
FeeType json.Number `json:"fee_type"` // 币种, 1为人民币
TransactionId string `json:"transaction_id"` // 财付通订单号
OutTradeNo string `json:"out_trade_no"` // 第三方订单号
IsSplitBytes json.RawMessage `json:"is_split"` // boolean, 表明是否分账, false为无分账, true为有分账
IsRefundBytes json.RawMessage `json:"is_refund"` // boolean, 表明是否退款, false为无退款, ture为退款
Attach string `json:"attach"` // 商户数据包, 即生成订单package时商户填入的attach
TimeEnd string `json:"time_end"` // 支付完成时间
TransportFee json.Number `json:"transport_fee"` // 物流费用, 单位为分
ProductFee json.Number `json:"product_fee"` // 物品费用, 单位为分
Discount json.Number `json:"discount"` // 折扣价格, 单位为分
RMBTotalFee json.Number `json:"rmb_total_fee"` // 换算成人民币之后的总金额, 单位为分, 一般看total_fee即可
}
因为某一方技术的原因,可能导致商户在预期时间内都收不到最终支付通知,此时商户 可以通过该API 来查询订单的详细支付状态。
这是订单查询成功时返回的数据结构(注意 json 格式化的时候要用 *OrderQueryResponse)
func (*OrderQueryResponse) GetTimeEnd ¶
func (this *OrderQueryResponse) GetTimeEnd() (t time.Time, err error)
func (*OrderQueryResponse) IsRefund ¶
func (this *OrderQueryResponse) IsRefund() (b bool, err error)
func (*OrderQueryResponse) IsSplit ¶
func (this *OrderQueryResponse) IsSplit() (b bool, err error)
type PayPackageParameters ¶
订单详情的参数
func (PayPackageParameters) SetAttach ¶
func (para PayPackageParameters) SetAttach(Attach string)
func (PayPackageParameters) SetBankType ¶
func (para PayPackageParameters) SetBankType(BankType string)
func (PayPackageParameters) SetBillCreateIP ¶
func (para PayPackageParameters) SetBillCreateIP(BillCreateIP string)
func (PayPackageParameters) SetBody ¶
func (para PayPackageParameters) SetBody(Body string)
func (PayPackageParameters) SetCharset ¶
func (para PayPackageParameters) SetCharset(Charset string)
func (PayPackageParameters) SetFeeType ¶
func (para PayPackageParameters) SetFeeType(n int)
func (PayPackageParameters) SetGoodsTag ¶
func (para PayPackageParameters) SetGoodsTag(GoodsTag string)
func (PayPackageParameters) SetNotifyURL ¶
func (para PayPackageParameters) SetNotifyURL(NotifyURL string)
func (PayPackageParameters) SetOutTradeNo ¶
func (para PayPackageParameters) SetOutTradeNo(OutTradeNo string)
func (PayPackageParameters) SetPartnerId ¶
func (para PayPackageParameters) SetPartnerId(PartnerId string)
func (PayPackageParameters) SetProductFee ¶
func (para PayPackageParameters) SetProductFee(n int)
func (PayPackageParameters) SetTimeExpire ¶
func (para PayPackageParameters) SetTimeExpire(t time.Time)
func (PayPackageParameters) SetTimeStart ¶
func (para PayPackageParameters) SetTimeStart(t time.Time)
func (PayPackageParameters) SetTotalFee ¶
func (para PayPackageParameters) SetTotalFee(n int)
func (PayPackageParameters) SetTransportFee ¶
func (para PayPackageParameters) SetTransportFee(n int)
type PayPackageRequest ¶
公众平台接到用户点击 Native 支付 URL 之后, 会调用注册时填写的商户获取订单 Package 的回调 URL. 微信公众平台调用时会使用POST方式, 这是推送的 xml 格式的数据结构.
func (PayPackageRequest) AppId ¶
func (req PayPackageRequest) AppId() string
func (PayPackageRequest) CheckSignature ¶
func (req PayPackageRequest) CheckSignature(appKey string) (err error)
检查 PayPackageRequest 的签名是否合法, 合法返回 nil, 否则返回错误信息.
appKey: 即 paySignKey, 公众号支付请求中用于加密的密钥 Key
func (PayPackageRequest) IsSubscribe ¶
func (req PayPackageRequest) IsSubscribe() string
func (PayPackageRequest) NonceStr ¶
func (req PayPackageRequest) NonceStr() string
func (PayPackageRequest) OpenId ¶
func (req PayPackageRequest) OpenId() string
func (PayPackageRequest) ProductId ¶
func (req PayPackageRequest) ProductId() string
func (PayPackageRequest) SignMethod ¶
func (req PayPackageRequest) SignMethod() string
func (PayPackageRequest) Signature ¶
func (req PayPackageRequest) Signature() string
func (PayPackageRequest) TimeStamp ¶
func (req PayPackageRequest) TimeStamp() string
type PayPackageResponse ¶
公众平台接到用户点击 Native 支付 URL 之后, 会调用注册时填写的商户获取订单 Package 的回调 URL. 这是获取订单详情 package 的回复消息数据结构, xml 格式.
func (PayPackageResponse) SetAppId ¶
func (resp PayPackageResponse) SetAppId(AppId string)
func (PayPackageResponse) SetNonceStr ¶
func (resp PayPackageResponse) SetNonceStr(NonceStr string)
func (PayPackageResponse) SetPackage ¶
func (resp PayPackageResponse) SetPackage(Package string)
func (PayPackageResponse) SetRetCode ¶
func (resp PayPackageResponse) SetRetCode(RetCode int)
func (PayPackageResponse) SetRetMsg ¶
func (resp PayPackageResponse) SetRetMsg(RetMsg string)
func (PayPackageResponse) SetSignMethod ¶
func (resp PayPackageResponse) SetSignMethod(SignMethod string)
func (PayPackageResponse) SetSignature ¶
func (resp PayPackageResponse) SetSignature(appKey string) (err error)
设置签名字段.
appKey: 即 paySignKey, 公众号支付请求中用于加密的密钥 Key NOTE: 要求在 PayPackageResponse 其他字段设置完毕后才能调用这个函数, 否则签名就不正确.
func (PayPackageResponse) SetTimeStamp ¶
func (resp PayPackageResponse) SetTimeStamp(t time.Time)
type RefundRequest ¶
退款请求 请求参数
func (RefundRequest) SetCharset ¶
func (req RefundRequest) SetCharset(str string)
func (RefundRequest) SetOperUserId ¶
func (req RefundRequest) SetOperUserId(id int)
func (RefundRequest) SetOperUserPwd ¶
func (req RefundRequest) SetOperUserPwd(str string)
func (RefundRequest) SetOutRefundNo ¶
func (req RefundRequest) SetOutRefundNo(str string)
func (RefundRequest) SetOutTradeNo ¶
func (req RefundRequest) SetOutTradeNo(str string)
func (RefundRequest) SetPartnerId ¶
func (req RefundRequest) SetPartnerId(str string)
func (RefundRequest) SetRecvUserId ¶
func (req RefundRequest) SetRecvUserId(str string)
func (RefundRequest) SetRecvUserName ¶
func (req RefundRequest) SetRecvUserName(str string)
func (RefundRequest) SetRefundFee ¶
func (req RefundRequest) SetRefundFee(n int)
func (RefundRequest) SetRefundType ¶
func (req RefundRequest) SetRefundType(n int)
func (RefundRequest) SetServiceVersion ¶
func (req RefundRequest) SetServiceVersion(str string)
func (RefundRequest) SetSignKeyIndex ¶
func (req RefundRequest) SetSignKeyIndex(n int)
func (RefundRequest) SetSignMethod ¶
func (req RefundRequest) SetSignMethod(str string)
func (RefundRequest) SetSignature ¶
func (req RefundRequest) SetSignature(Key string) (err error)
设置签名字段.
Key: 商户支付密钥Key NOTE: 要求在 RefundRequest 其他字段设置完毕后才能调用这个函数, 否则签名就不正确.
func (RefundRequest) SetTotalFee ¶
func (req RefundRequest) SetTotalFee(n int)
func (RefundRequest) SetTransactionId ¶
func (req RefundRequest) SetTransactionId(str string)
func (RefundRequest) SetUseSPBillNoFlag ¶
func (req RefundRequest) SetUseSPBillNoFlag(n int)
type RefundResponse ¶
退款请求的回复
func (RefundResponse) Charset ¶
func (resp RefundResponse) Charset() string
func (RefundResponse) CheckSignature ¶
func (resp RefundResponse) CheckSignature(Key string) (err error)
检查 RefundResponse 的签名是否合法, 合法返回 nil, 否则返回错误信息.
Key: 商户支付密钥Key
func (RefundResponse) OutRefundNo ¶
func (resp RefundResponse) OutRefundNo() string
func (RefundResponse) OutTradeNo ¶
func (resp RefundResponse) OutTradeNo() string
func (RefundResponse) PartnerId ¶
func (resp RefundResponse) PartnerId() string
func (RefundResponse) RecvUserId ¶
func (resp RefundResponse) RecvUserId() string
func (RefundResponse) RecvUserName ¶
func (resp RefundResponse) RecvUserName() string
func (RefundResponse) RefundChannel ¶
func (resp RefundResponse) RefundChannel() string
func (RefundResponse) RefundFee ¶
func (resp RefundResponse) RefundFee() string
func (RefundResponse) RefundId ¶
func (resp RefundResponse) RefundId() string
func (RefundResponse) RefundStatus ¶
func (resp RefundResponse) RefundStatus() string
func (RefundResponse) RetCode ¶
func (resp RefundResponse) RetCode() string
func (RefundResponse) RetMsg ¶
func (resp RefundResponse) RetMsg() string
func (RefundResponse) SignMethod ¶
func (resp RefundResponse) SignMethod() string
func (RefundResponse) Signature ¶
func (resp RefundResponse) Signature() string
func (RefundResponse) TransactionId ¶
func (resp RefundResponse) TransactionId() string
Source Files
¶
- alarm_notify_post_data.go
- const.go
- deliver_notify.go
- doc.go
- download_bill_request.go
- jsapi.go
- native_static_url.go
- order_notify_post_data.go
- order_notify_url_data.go
- order_query_request.go
- order_query_response.go
- pay_package.go
- pay_package_request.go
- pay_package_response.go
- refund_query_request.go
- refund_query_response.go
- refund_request.go
- refund_response.go