Documentation ¶
Index ¶
- type CloseReasonType
- type FailReasonType
- type GetTransferBatchByNoRequest
- type GetTransferBatchByOutNoRequest
- type GetTransferDetailByNoRequest
- type GetTransferDetailByOutNoRequest
- type InitiateBatchTransferRequest
- type InitiateBatchTransferResponse
- type TransferBatchApiService
- func (a *TransferBatchApiService) GetTransferBatchByNo(ctx context.Context, req GetTransferBatchByNoRequest) (resp *TransferBatchEntity, result *core.APIResult, err error)
- func (a *TransferBatchApiService) GetTransferBatchByOutNo(ctx context.Context, req GetTransferBatchByOutNoRequest) (resp *TransferBatchEntity, result *core.APIResult, err error)
- func (a *TransferBatchApiService) InitiateBatchTransfer(ctx context.Context, req InitiateBatchTransferRequest) (resp *InitiateBatchTransferResponse, result *core.APIResult, err error)
- type TransferBatchEntity
- type TransferBatchGet
- type TransferDetailApiService
- func (a *TransferDetailApiService) GetTransferDetailByNo(ctx context.Context, req GetTransferDetailByNoRequest) (resp *TransferDetailEntity, result *core.APIResult, err error)
- func (a *TransferDetailApiService) GetTransferDetailByOutNo(ctx context.Context, req GetTransferDetailByOutNoRequest) (resp *TransferDetailEntity, result *core.APIResult, err error)
- type TransferDetailCompact
- type TransferDetailEntity
- type TransferDetailInput
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseReasonType ¶
type CloseReasonType string
CloseReasonType
const ( CLOSEREASONTYPE_OVERDUE_CLOSE CloseReasonType = "OVERDUE_CLOSE" CLOSEREASONTYPE_TRANSFER_SCENE_INVALID CloseReasonType = "TRANSFER_SCENE_INVALID" )
Enums of CloseReasonType
func (CloseReasonType) Ptr ¶
func (e CloseReasonType) Ptr() *CloseReasonType
type FailReasonType ¶
type FailReasonType string
FailReasonType
const ( FAILREASONTYPE_ACCOUNT_FROZEN FailReasonType = "ACCOUNT_FROZEN" FAILREASONTYPE_REAL_NAME_CHECK_FAIL FailReasonType = "REAL_NAME_CHECK_FAIL" FAILREASONTYPE_NAME_NOT_CORRECT FailReasonType = "NAME_NOT_CORRECT" FAILREASONTYPE_OPENID_INVALID FailReasonType = "OPENID_INVALID" FAILREASONTYPE_TRANSFER_QUOTA_EXCEED FailReasonType = "TRANSFER_QUOTA_EXCEED" FAILREASONTYPE_DAY_RECEIVED_QUOTA_EXCEED FailReasonType = "DAY_RECEIVED_QUOTA_EXCEED" FAILREASONTYPE_MONTH_RECEIVED_QUOTA_EXCEED FailReasonType = "MONTH_RECEIVED_QUOTA_EXCEED" FAILREASONTYPE_DAY_RECEIVED_COUNT_EXCEED FailReasonType = "DAY_RECEIVED_COUNT_EXCEED" FAILREASONTYPE_PRODUCT_AUTH_CHECK_FAIL FailReasonType = "PRODUCT_AUTH_CHECK_FAIL" FAILREASONTYPE_OVERDUE_CLOSE FailReasonType = "OVERDUE_CLOSE" FAILREASONTYPE_ID_CARD_NOT_CORRECT FailReasonType = "ID_CARD_NOT_CORRECT" FAILREASONTYPE_ACCOUNT_NOT_EXIST FailReasonType = "ACCOUNT_NOT_EXIST" FAILREASONTYPE_TRANSFER_RISK FailReasonType = "TRANSFER_RISK" FAILREASONTYPE_OTHER_FAIL_REASON_TYPE FailReasonType = "OTHER_FAIL_REASON_TYPE" FAILREASONTYPE_REALNAME_ACCOUNT_RECEIVED_QUOTA_EXCEED FailReasonType = "REALNAME_ACCOUNT_RECEIVED_QUOTA_EXCEED" FAILREASONTYPE_RECEIVE_ACCOUNT_NOT_PERMMIT FailReasonType = "RECEIVE_ACCOUNT_NOT_PERMMIT" FAILREASONTYPE_PAYEE_ACCOUNT_ABNORMAL FailReasonType = "PAYEE_ACCOUNT_ABNORMAL" FAILREASONTYPE_PAYER_ACCOUNT_ABNORMAL FailReasonType = "PAYER_ACCOUNT_ABNORMAL" FAILREASONTYPE_TRANSFER_SCENE_UNAVAILABLE FailReasonType = "TRANSFER_SCENE_UNAVAILABLE" FAILREASONTYPE_TRANSFER_SCENE_INVALID FailReasonType = "TRANSFER_SCENE_INVALID" FAILREASONTYPE_TRANSFER_REMARK_SET_FAIL FailReasonType = "TRANSFER_REMARK_SET_FAIL" FAILREASONTYPE_RECEIVE_ACCOUNT_NOT_CONFIGURE FailReasonType = "RECEIVE_ACCOUNT_NOT_CONFIGURE" FAILREASONTYPE_BLOCK_B2_C_USERLIMITAMOUNT_BSRULE_MONTH FailReasonType = "BLOCK_B2C_USERLIMITAMOUNT_BSRULE_MONTH" FAILREASONTYPE_BLOCK_B2_C_USERLIMITAMOUNT_MONTH FailReasonType = "BLOCK_B2C_USERLIMITAMOUNT_MONTH" FAILREASONTYPE_MERCHANT_REJECT FailReasonType = "MERCHANT_REJECT" FAILREASONTYPE_MERCHANT_NOT_CONFIRM FailReasonType = "MERCHANT_NOT_CONFIRM" )
Enums of FailReasonType
func (FailReasonType) Ptr ¶
func (e FailReasonType) Ptr() *FailReasonType
type GetTransferBatchByNoRequest ¶
type GetTransferBatchByNoRequest struct { // 微信批次单号,微信商家转账系统返回的唯一标识 BatchId *string `json:"batch_id"` // true-是;false-否,默认否。商户可选择是否查询指定状态的转账明细单,当转账批次单状态为“FINISHED”(已完成)时,才会返回满足条件的转账明细单 NeedQueryDetail *bool `json:"need_query_detail"` // 该次请求资源的起始位置。返回的明细是按照设置的明细条数进行分页展示的,一次查询可能无法返回所有明细,我们使用该参数标识查询开始位置,默认值为0 Offset *int64 `json:"offset,omitempty"` // 该次请求可返回的最大明细条数,最小20条,最大100条,不传则默认20条。不足20条按实际条数返回 Limit *int64 `json:"limit,omitempty"` // WAIT_PAY: 待确认。待商户确认, 符合免密条件时, 系统会自动扭转为转账中 ALL:全部。需要同时查询转账成功、失败和待确认的明细单 SUCCESS:转账成功 FAIL:转账失败。需要确认失败原因后,再决定是否重新发起对该笔明细单的转账(并非整个转账批次单) DetailStatus *string `json:"detail_status,omitempty"` }
GetTransferBatchByNoRequest
func (GetTransferBatchByNoRequest) Clone ¶
func (o GetTransferBatchByNoRequest) Clone() *GetTransferBatchByNoRequest
func (GetTransferBatchByNoRequest) MarshalJSON ¶
func (o GetTransferBatchByNoRequest) MarshalJSON() ([]byte, error)
func (GetTransferBatchByNoRequest) String ¶
func (o GetTransferBatchByNoRequest) String() string
type GetTransferBatchByOutNoRequest ¶
type GetTransferBatchByOutNoRequest struct { // 商户系统内部的商家批次单号,在商户系统内部唯一 OutBatchNo *string `json:"out_batch_no"` // true-是;false-否,默认否。商户可选择是否查询指定状态的转账明细单,当转账批次单状态为“FINISHED”(已完成)时,才会返回满足条件的转账明细单 NeedQueryDetail *bool `json:"need_query_detail"` // 该次请求资源(转账明细单)的起始位置,从0开始,默认值为0 Offset *int64 `json:"offset,omitempty"` // 该次请求可返回的最大资源(转账明细单)条数,最小20条,最大100条,不传则默认20条。不足20条按实际条数返回 Limit *int64 `json:"limit,omitempty"` // WAIT_PAY: 待确认。待商户确认, 符合免密条件时, 系统会自动扭转为转账中 ALL:全部。需要同时查询转账成功、失败和待确认的明细单 SUCCESS:转账成功 FAIL:转账失败。需要确认失败原因后,再决定是否重新发起对该笔明细单的转账(并非整个转账批次单) DetailStatus *string `json:"detail_status,omitempty"` }
GetTransferBatchByOutNoRequest
func (GetTransferBatchByOutNoRequest) Clone ¶
func (o GetTransferBatchByOutNoRequest) Clone() *GetTransferBatchByOutNoRequest
func (GetTransferBatchByOutNoRequest) MarshalJSON ¶
func (o GetTransferBatchByOutNoRequest) MarshalJSON() ([]byte, error)
func (GetTransferBatchByOutNoRequest) String ¶
func (o GetTransferBatchByOutNoRequest) String() string
type GetTransferDetailByNoRequest ¶
type GetTransferDetailByNoRequest struct { // 微信批次单号,微信商家转账系统返回的唯一标识 BatchId *string `json:"batch_id"` // 微信支付系统内部区分转账批次单下不同转账明细单的唯一标识 DetailId *string `json:"detail_id"` }
GetTransferDetailByNoRequest
func (GetTransferDetailByNoRequest) Clone ¶
func (o GetTransferDetailByNoRequest) Clone() *GetTransferDetailByNoRequest
func (GetTransferDetailByNoRequest) MarshalJSON ¶
func (o GetTransferDetailByNoRequest) MarshalJSON() ([]byte, error)
func (GetTransferDetailByNoRequest) String ¶
func (o GetTransferDetailByNoRequest) String() string
type GetTransferDetailByOutNoRequest ¶
type GetTransferDetailByOutNoRequest struct { // 商户系统内部区分转账批次单下不同转账明细单的唯一标识 OutDetailNo *string `json:"out_detail_no"` // 商户系统内部的商家批次单号,在商户系统内部唯一 OutBatchNo *string `json:"out_batch_no"` }
GetTransferDetailByOutNoRequest
func (GetTransferDetailByOutNoRequest) Clone ¶
func (o GetTransferDetailByOutNoRequest) Clone() *GetTransferDetailByOutNoRequest
func (GetTransferDetailByOutNoRequest) MarshalJSON ¶
func (o GetTransferDetailByOutNoRequest) MarshalJSON() ([]byte, error)
func (GetTransferDetailByOutNoRequest) String ¶
func (o GetTransferDetailByOutNoRequest) String() string
type InitiateBatchTransferRequest ¶
type InitiateBatchTransferRequest struct { // 申请商户号的appid或商户号绑定的appid(企业号corpid即为此appid) Appid *string `json:"appid"` // 商户系统内部的商家批次单号,要求此参数只能由数字、大小写字母组成,在商户系统内部唯一 OutBatchNo *string `json:"out_batch_no"` // 该笔批量转账的名称 BatchName *string `json:"batch_name"` // 转账说明,UTF8编码,最多允许32个字符 BatchRemark *string `json:"batch_remark"` // 转账金额单位为“分”。转账总金额必须与批次内所有明细转账金额之和保持一致,否则无法发起转账操作 TotalAmount *int64 `json:"total_amount"` // 一个转账批次单最多发起一千笔转账。转账总笔数必须与批次内所有明细之和保持一致,否则无法发起转账操作 TotalNum *int64 `json:"total_num"` // 发起批量转账的明细列表,最多一千笔 TransferDetailList []TransferDetailInput `json:"transfer_detail_list"` // 该批次转账使用的转账场景,如不填写则使用商家的默认场景,如无默认场景可为空,可前往“商家转账到零钱-前往功能”中申请。 如:1001-现金营销 TransferSceneId *string `json:"transfer_scene_id,omitempty"` // 商户接收批次结果通知的URL,必须支持https,且只能是直接可访问的URL,不允许携带查询参数 NotifyUrl *string `json:"notify_url,omitempty"` }
InitiateBatchTransferRequest
func (InitiateBatchTransferRequest) Clone ¶
func (o InitiateBatchTransferRequest) Clone() *InitiateBatchTransferRequest
func (InitiateBatchTransferRequest) MarshalJSON ¶
func (o InitiateBatchTransferRequest) MarshalJSON() ([]byte, error)
func (InitiateBatchTransferRequest) String ¶
func (o InitiateBatchTransferRequest) String() string
type InitiateBatchTransferResponse ¶
type InitiateBatchTransferResponse struct { // 商户系统内部的商家批次单号,在商户系统内部唯一 OutBatchNo *string `json:"out_batch_no"` // 微信批次单号,微信商家转账系统返回的唯一标识 BatchId *string `json:"batch_id"` // 批次受理成功时返回,按照使用rfc3339所定义的格式,格式为YYYY-MM-DDThh:mm:ss+TIMEZONE CreateTime *time.Time `json:"create_time"` // ACCEPTED:已受理。批次已受理成功,若发起批量转账的30分钟后,转账批次单仍处于该状态,可能原因是商户账户余额不足等。商户可查询账户资金流水,若该笔转账批次单的扣款已经发生,则表示批次已经进入转账中,请再次查单确认 PROCESSING:转账中。已开始处理批次内的转账明细单 FINISHED:已完成。批次内的所有转账明细单都已处理完成 CLOSED:已关闭。可查询具体的批次关闭原因确认 BatchStatus *string `json:"batch_status,omitempty"` }
InitiateBatchTransferResponse
func (InitiateBatchTransferResponse) Clone ¶
func (o InitiateBatchTransferResponse) Clone() *InitiateBatchTransferResponse
func (InitiateBatchTransferResponse) MarshalJSON ¶
func (o InitiateBatchTransferResponse) MarshalJSON() ([]byte, error)
func (InitiateBatchTransferResponse) String ¶
func (o InitiateBatchTransferResponse) String() string
type TransferBatchApiService ¶
func (*TransferBatchApiService) GetTransferBatchByNo ¶
func (a *TransferBatchApiService) GetTransferBatchByNo(ctx context.Context, req GetTransferBatchByNoRequest) (resp *TransferBatchEntity, result *core.APIResult, err error)
GetTransferBatchByNo 通过微信批次单号查询批次单
微信批次单号查单接口。商户可以通过该接口查询转账批次单以及指定状态的转账明细单。返回消息中包含微信批次单号、批次状态、批次类型、转账总金额、转账总笔数、成功金额、失败金额等信息。
Example ¶
package main import ( "context" "log" "github.com/wechatpay-apiv3/wechatpay-go/core" "github.com/wechatpay-apiv3/wechatpay-go/core/option" "github.com/wechatpay-apiv3/wechatpay-go/services/transferbatch" "github.com/wechatpay-apiv3/wechatpay-go/utils" ) func main() { var ( mchID string = "190000****" // 商户号 mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 ) // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") if err != nil { log.Printf("load merchant private key error:%s", err) return } ctx := context.Background() // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 opts := []core.ClientOption{ option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), } client, err := core.NewClient(ctx, opts...) if err != nil { log.Printf("new wechat pay client err:%s", err) return } svc := transferbatch.TransferBatchApiService{Client: client} resp, result, err := svc.GetTransferBatchByNo(ctx, transferbatch.GetTransferBatchByNoRequest{ BatchId: core.String("1030000071100999991182020050700019480001"), NeedQueryDetail: core.Bool(true), Offset: core.Int64(0), Limit: core.Int64(20), DetailStatus: core.String("FAIL"), }, ) if err != nil { // 处理错误 log.Printf("call GetTransferBatchByNo err:%s", err) } else { // 处理返回结果 log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) } }
Output:
func (*TransferBatchApiService) GetTransferBatchByOutNo ¶
func (a *TransferBatchApiService) GetTransferBatchByOutNo(ctx context.Context, req GetTransferBatchByOutNoRequest) (resp *TransferBatchEntity, result *core.APIResult, err error)
GetTransferBatchByOutNo 通过商家批次单号查询批次单
商家明细单号查单接口。商户可以通过该接口查询转账批次单以及指定状态的转账明细单。返回消息中包含微信批次单号、批次状态、批次类型、转账总金额、转账总笔数、成功金额、失败金额等信息。
Example ¶
package main import ( "context" "log" "github.com/wechatpay-apiv3/wechatpay-go/core" "github.com/wechatpay-apiv3/wechatpay-go/core/option" "github.com/wechatpay-apiv3/wechatpay-go/services/transferbatch" "github.com/wechatpay-apiv3/wechatpay-go/utils" ) func main() { var ( mchID string = "190000****" // 商户号 mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 ) // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") if err != nil { log.Printf("load merchant private key error:%s", err) return } ctx := context.Background() // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 opts := []core.ClientOption{ option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), } client, err := core.NewClient(ctx, opts...) if err != nil { log.Printf("new wechat pay client err:%s", err) return } svc := transferbatch.TransferBatchApiService{Client: client} resp, result, err := svc.GetTransferBatchByOutNo(ctx, transferbatch.GetTransferBatchByOutNoRequest{ OutBatchNo: core.String("plfk2020042013"), NeedQueryDetail: core.Bool(true), Offset: core.Int64(0), Limit: core.Int64(20), DetailStatus: core.String("FAIL"), }, ) if err != nil { // 处理错误 log.Printf("call GetTransferBatchByOutNo err:%s", err) } else { // 处理返回结果 log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) } }
Output:
func (*TransferBatchApiService) InitiateBatchTransfer ¶
func (a *TransferBatchApiService) InitiateBatchTransfer(ctx context.Context, req InitiateBatchTransferRequest) (resp *InitiateBatchTransferResponse, result *core.APIResult, err error)
InitiateBatchTransfer 发起商家转账
发起商家转账接口。商户可以通过该接口同时向多个用户微信零钱进行转账操作。请求消息中应包含商家批次单号、转账名称、appid、转账总金额、转账总笔数、转账openid、收款用户姓名等信息。注意受理成功将返回批次单号,此时并不代表转账成功,请通过查单接口查询单据的付款状态。
Example ¶
package main import ( "context" "log" "github.com/wechatpay-apiv3/wechatpay-go/core" "github.com/wechatpay-apiv3/wechatpay-go/core/option" "github.com/wechatpay-apiv3/wechatpay-go/services/transferbatch" "github.com/wechatpay-apiv3/wechatpay-go/utils" ) func main() { var ( mchID string = "190000****" // 商户号 mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 ) // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") if err != nil { log.Printf("load merchant private key error:%s", err) return } ctx := context.Background() // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 opts := []core.ClientOption{ option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), } client, err := core.NewClient(ctx, opts...) if err != nil { log.Printf("new wechat pay client err:%s", err) return } svc := transferbatch.TransferBatchApiService{Client: client} resp, result, err := svc.InitiateBatchTransfer(ctx, transferbatch.InitiateBatchTransferRequest{ Appid: core.String("wxf636efh567hg4356"), OutBatchNo: core.String("plfk2020042013"), BatchName: core.String("2019年1月深圳分部报销单"), BatchRemark: core.String("2019年1月深圳分部报销单"), TotalAmount: core.Int64(4000000), TotalNum: core.Int64(200), TransferDetailList: []transferbatch.TransferDetailInput{transferbatch.TransferDetailInput{ OutDetailNo: core.String("x23zy545Bd5436"), TransferAmount: core.Int64(200000), TransferRemark: core.String("2020年4月报销"), Openid: core.String("o-MYE42l80oelYMDE34nYD456Xoy"), UserName: core.String("757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45"), }}, TransferSceneId: core.String("1000"), NotifyUrl: core.String("https://www.weixin.qq.com/wxpay/pay.php"), }, ) if err != nil { // 处理错误 log.Printf("call InitiateBatchTransfer err:%s", err) } else { // 处理返回结果 log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) } }
Output:
type TransferBatchEntity ¶
type TransferBatchEntity struct { // 转账批次单基本信息 TransferBatch *TransferBatchGet `json:"transfer_batch"` // 当批次状态为“FINISHED”(已完成),且成功查询到转账明细单时返回。包括微信明细单号、明细状态信息 TransferDetailList []TransferDetailCompact `json:"transfer_detail_list,omitempty"` }
TransferBatchEntity
func (TransferBatchEntity) Clone ¶
func (o TransferBatchEntity) Clone() *TransferBatchEntity
func (TransferBatchEntity) MarshalJSON ¶
func (o TransferBatchEntity) MarshalJSON() ([]byte, error)
func (TransferBatchEntity) String ¶
func (o TransferBatchEntity) String() string
type TransferBatchGet ¶
type TransferBatchGet struct { // 微信支付分配的商户号 Mchid *string `json:"mchid"` // 商户系统内部的商家批次单号,在商户系统内部唯一 OutBatchNo *string `json:"out_batch_no"` // 微信批次单号,微信商家转账系统返回的唯一标识 BatchId *string `json:"batch_id"` // 申请商户号的appid或商户号绑定的appid(企业号corpid即为此appid) Appid *string `json:"appid"` // WAIT_PAY: 待付款确认。需要付款出资商户在商家助手小程序或服务商助手小程序进行付款确认 ACCEPTED:已受理。批次已受理成功,若发起批量转账的30分钟后,转账批次单仍处于该状态,可能原因是商户账户余额不足等。商户可查询账户资金流水,若该笔转账批次单的扣款已经发生,则表示批次已经进入转账中,请再次查单确认 PROCESSING:转账中。已开始处理批次内的转账明细单 FINISHED:已完成。批次内的所有转账明细单都已处理完成 CLOSED:已关闭。可查询具体的批次关闭原因确认 BatchStatus *string `json:"batch_status"` // API:API方式发起 WEB:页面方式发起 BatchType *string `json:"batch_type"` // 该笔批量转账的名称 BatchName *string `json:"batch_name"` // 转账说明,UTF8编码,最多允许32个字符 BatchRemark *string `json:"batch_remark"` // 如果批次单状态为“CLOSED”(已关闭),则有关闭原因 CloseReason *CloseReasonType `json:"close_reason,omitempty"` // 转账金额单位为“分” TotalAmount *int64 `json:"total_amount"` // 一个转账批次单最多发起三千笔转账 TotalNum *int64 `json:"total_num"` // 批次受理成功时返回,按照使用rfc3339所定义的格式,格式为YYYY-MM-DDThh:mm:ss+TIMEZONE CreateTime *time.Time `json:"create_time,omitempty"` // 批次最近一次状态变更的时间,按照使用rfc3339所定义的格式,格式为YYYY-MM-DDThh:mm:ss+TIMEZONE UpdateTime *time.Time `json:"update_time,omitempty"` // 转账成功的金额,单位为“分”。当批次状态为“PROCESSING”(转账中)时,转账成功金额随时可能变化 SuccessAmount *int64 `json:"success_amount,omitempty"` // 转账成功的笔数。当批次状态为“PROCESSING”(转账中)时,转账成功笔数随时可能变化 SuccessNum *int64 `json:"success_num,omitempty"` // 转账失败的金额,单位为“分” FailAmount *int64 `json:"fail_amount,omitempty"` // 转账失败的笔数 FailNum *int64 `json:"fail_num,omitempty"` // 指定的转账场景ID TransferSceneId *string `json:"transfer_scene_id,omitempty"` }
TransferBatchGet
func (TransferBatchGet) Clone ¶
func (o TransferBatchGet) Clone() *TransferBatchGet
func (TransferBatchGet) MarshalJSON ¶
func (o TransferBatchGet) MarshalJSON() ([]byte, error)
func (TransferBatchGet) String ¶
func (o TransferBatchGet) String() string
type TransferDetailApiService ¶
func (*TransferDetailApiService) GetTransferDetailByNo ¶
func (a *TransferDetailApiService) GetTransferDetailByNo(ctx context.Context, req GetTransferDetailByNoRequest) (resp *TransferDetailEntity, result *core.APIResult, err error)
GetTransferDetailByNo 通过微信明细单号查询明细单
明细单号查单接口。商户可以通过该接口查询单笔转账明细单。返回消息中包含微信明细单号、明细状态、转账金额、失败原因、收款用户姓名、用户OpenID等信息。
Example ¶
package main import ( "context" "log" "github.com/wechatpay-apiv3/wechatpay-go/core" "github.com/wechatpay-apiv3/wechatpay-go/core/option" "github.com/wechatpay-apiv3/wechatpay-go/services/transferbatch" "github.com/wechatpay-apiv3/wechatpay-go/utils" ) func main() { var ( mchID string = "190000****" // 商户号 mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 ) // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") if err != nil { log.Printf("load merchant private key error:%s", err) return } ctx := context.Background() // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 opts := []core.ClientOption{ option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), } client, err := core.NewClient(ctx, opts...) if err != nil { log.Printf("new wechat pay client err:%s", err) return } svc := transferbatch.TransferDetailApiService{Client: client} resp, result, err := svc.GetTransferDetailByNo(ctx, transferbatch.GetTransferDetailByNoRequest{ BatchId: core.String("1030000071100999991182020050700019480001"), DetailId: core.String("1040000071100999991182020050700019500100"), }, ) if err != nil { // 处理错误 log.Printf("call GetTransferDetailByNo err:%s", err) } else { // 处理返回结果 log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) } }
Output:
func (*TransferDetailApiService) GetTransferDetailByOutNo ¶
func (a *TransferDetailApiService) GetTransferDetailByOutNo(ctx context.Context, req GetTransferDetailByOutNoRequest) (resp *TransferDetailEntity, result *core.APIResult, err error)
GetTransferDetailByOutNo 通过商家明细单号查询明细单
商户明细单号查单接口。商户可以通过该接口查询单笔转账明细单。返回消息中包含微信明细单号、明细状态、转账金额、失败原因、收款用户姓名、用户OpenID等信息。
Example ¶
package main import ( "context" "log" "github.com/wechatpay-apiv3/wechatpay-go/core" "github.com/wechatpay-apiv3/wechatpay-go/core/option" "github.com/wechatpay-apiv3/wechatpay-go/services/transferbatch" "github.com/wechatpay-apiv3/wechatpay-go/utils" ) func main() { var ( mchID string = "190000****" // 商户号 mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 ) // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") if err != nil { log.Printf("load merchant private key error:%s", err) return } ctx := context.Background() // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 opts := []core.ClientOption{ option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), } client, err := core.NewClient(ctx, opts...) if err != nil { log.Printf("new wechat pay client err:%s", err) return } svc := transferbatch.TransferDetailApiService{Client: client} resp, result, err := svc.GetTransferDetailByOutNo(ctx, transferbatch.GetTransferDetailByOutNoRequest{ OutDetailNo: core.String("x23zy545Bd5436"), OutBatchNo: core.String("plfk2020042013"), }, ) if err != nil { // 处理错误 log.Printf("call GetTransferDetailByOutNo err:%s", err) } else { // 处理返回结果 log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) } }
Output:
type TransferDetailCompact ¶
type TransferDetailCompact struct { // 微信支付系统内部区分转账批次单下不同转账明细单的唯一标识 DetailId *string `json:"detail_id"` // 商户系统内部区分转账批次单下不同转账明细单的唯一标识 OutDetailNo *string `json:"out_detail_no"` // INIT: 初始态。 系统转账校验中 WAIT_PAY: 待确认。待商户确认, 符合免密条件时, 系统会自动扭转为转账中 PROCESSING:转账中。正在处理中,转账结果尚未明确 SUCCESS:转账成功 FAIL:转账失败。需要确认失败原因后,再决定是否重新发起对该笔明细单的转账(并非整个转账批次单) DetailStatus *string `json:"detail_status"` }
TransferDetailCompact
func (TransferDetailCompact) Clone ¶
func (o TransferDetailCompact) Clone() *TransferDetailCompact
func (TransferDetailCompact) MarshalJSON ¶
func (o TransferDetailCompact) MarshalJSON() ([]byte, error)
func (TransferDetailCompact) String ¶
func (o TransferDetailCompact) String() string
type TransferDetailEntity ¶
type TransferDetailEntity struct { // 微信支付分配的商户号 Mchid *string `json:"mchid"` // 商户系统内部的商家批次单号,在商户系统内部唯一 OutBatchNo *string `json:"out_batch_no"` // 微信批次单号,微信商家转账系统返回的唯一标识 BatchId *string `json:"batch_id"` // 申请商户号的appid或商户号绑定的appid(企业号corpid即为此appid) Appid *string `json:"appid"` // 商户系统内部区分转账批次单下不同转账明细单的唯一标识 OutDetailNo *string `json:"out_detail_no"` // 微信支付系统内部区分转账批次单下不同转账明细单的唯一标识 DetailId *string `json:"detail_id"` // INIT: 初始态。 系统转账校验中 WAIT_PAY: 待确认。待商户确认, 符合免密条件时, 系统会自动扭转为转账中 PROCESSING:转账中。正在处理中,转账结果尚未明确 SUCCESS:转账成功 FAIL:转账失败。需要确认失败原因后,再决定是否重新发起对该笔明细单的转账(并非整个转账批次单) DetailStatus *string `json:"detail_status"` // 转账金额单位为“分” TransferAmount *int64 `json:"transfer_amount"` // 单条转账备注(微信用户会收到该备注),UTF8编码,最多允许32个字符 TransferRemark *string `json:"transfer_remark"` // 如果转账失败则有失败原因 FailReason *FailReasonType `json:"fail_reason,omitempty"` // 商户appid下,某用户的openid Openid *string `json:"openid"` // 收款方姓名。采用标准RSA算法,公钥由微信侧提供 商户转账时传入了收款用户姓名、查询时会返回收款用户姓名 UserName *string `json:"user_name,omitempty" encryption:"EM_APIV3"` // 转账发起的时间,按照使用rfc3339所定义的格式,格式为YYYY-MM-DDThh:mm:ss+TIMEZONE InitiateTime *time.Time `json:"initiate_time"` // 明细最后一次状态变更的时间,按照使用rfc3339所定义的格式,格式为YYYY-MM-DDThh:mm:ss+TIMEZONE UpdateTime *time.Time `json:"update_time"` }
TransferDetailEntity
func (TransferDetailEntity) Clone ¶
func (o TransferDetailEntity) Clone() *TransferDetailEntity
func (TransferDetailEntity) MarshalJSON ¶
func (o TransferDetailEntity) MarshalJSON() ([]byte, error)
func (TransferDetailEntity) String ¶
func (o TransferDetailEntity) String() string
type TransferDetailInput ¶
type TransferDetailInput struct { // 商户系统内部区分转账批次单下不同转账明细单的唯一标识,要求此参数只能由数字、大小写字母组成 OutDetailNo *string `json:"out_detail_no"` // 转账金额单位为“分” TransferAmount *int64 `json:"transfer_amount"` // 单条转账备注(微信用户会收到该备注),UTF8编码,最多允许32个字符 TransferRemark *string `json:"transfer_remark"` // 商户appid下,某用户的openid Openid *string `json:"openid"` // 收款方真实姓名。支持标准RSA算法和国密算法,公钥由微信侧提供 明细转账金额<0.3元时,不允许填写收款用户姓名 明细转账金额 >= 2,000元时,该笔明细必须填写收款用户姓名 同一批次转账明细中的姓名字段传入规则需保持一致,也即全部填写、或全部不填写 若商户传入收款用户姓名,微信支付会校验用户openID与姓名是否一致,并提供电子回单 UserName *string `json:"user_name,omitempty" encryption:"EM_APIV3"` }
TransferDetailInput
func (TransferDetailInput) Clone ¶
func (o TransferDetailInput) Clone() *TransferDetailInput
func (TransferDetailInput) MarshalJSON ¶
func (o TransferDetailInput) MarshalJSON() ([]byte, error)
func (TransferDetailInput) String ¶
func (o TransferDetailInput) String() string