curl --get "${BASE_URL}/api/v2/trans/bulk-upload/result" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "Accept: application/json" \
--data-urlencode merchant_id=48290713 \
--data-urlencode file_identifier=PAY2030001{
"code": 0,
"message": "ok",
"data": {
"request_id": "09ef4182-bcd8-4bb1-a326-498a05f0e4bb",
"batch": {
"batch_id": 2048,
"upload_request_id": "19eb4182-bcd8-4bb1-a326-498a05f0e4aa",
"merchant_id": "7294815",
"business_id": "48290713",
"file_identifier": "PAY2030001",
"status": "completed",
"declared_detail_count": 2,
"declared_total_amount_cents": 7350
},
"summary": {
"validation_failed": 0,
"queued": 0,
"processing": 0,
"created_pending": 1,
"payment_succeeded": 1,
"payment_failed": 0,
"system_failed": 0
},
"details": [
{
"line_number": 1,
"record_line_no": 2,
"reference_number": "INV-2030-001",
"account_type": "BC",
"amount_cents": 2550,
"status": "created_pending",
"failure_reason": "",
"trans_no": "b1893452400000826",
"transaction_status": 3,
"transaction_status_text": "Pending",
"transaction_result": ""
},
{
"line_number": 2,
"record_line_no": 3,
"reference_number": "INV-2030-002",
"account_type": "CT",
"amount_cents": 4800,
"status": "payment_succeeded",
"failure_reason": "",
"trans_no": "b1893452400000972",
"transaction_status": 1,
"transaction_status_text": "Successful",
"transaction_result": ""
}
],
"pagination": {
"page": 1,
"page_size": 50,
"total": 2,
"last_page": 1
}
}
}查询 TXT 批次及逐行结果
查询当前认证商户的批次及逐行处理结果,可按业务筛选。使用 OAuth2 Bearer Token,无需请求签名。batch_id 与 file_identifier 至少提供一个,同时提供时必须匹配同一批次。
line_number 是 D 记录中的逻辑行号,record_line_no 是包含文件头的物理行号。按 line_number 升序分页;line_number 和 status 同时提供时同时筛选,details 始终为数组。单行查询建议使用第 1 页。pagination.total 是筛选后的记录数,summary 始终统计整个批次的当前明细状态。
code=0 只表示查询成功,即使批次或明细失败也仍为 0。批次 completed 表示交易创建处理完成,并不保证所有支付成功;请结合明细 status 和 transaction_status 判断。created_pending 也可能对应已过期交易。尚未产生可见明细或筛选无匹配时 details=[],不能视为所有支付成功。交易信息暂不可用时交易号及状态可能为 null,不要因此重新扣款。
查询须使用同一商户的 OAuth 凭据。merchant_id 可省略或为空,此时按批次标识在该商户全部业务范围内定位批次;如传入,须与原上传请求中的业务标识一致。该查询仅返回处理状态,不会再次执行支付。
curl --get "${BASE_URL}/api/v2/trans/bulk-upload/result" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "Accept: application/json" \
--data-urlencode merchant_id=48290713 \
--data-urlencode file_identifier=PAY2030001{
"code": 0,
"message": "ok",
"data": {
"request_id": "09ef4182-bcd8-4bb1-a326-498a05f0e4bb",
"batch": {
"batch_id": 2048,
"upload_request_id": "19eb4182-bcd8-4bb1-a326-498a05f0e4aa",
"merchant_id": "7294815",
"business_id": "48290713",
"file_identifier": "PAY2030001",
"status": "completed",
"declared_detail_count": 2,
"declared_total_amount_cents": 7350
},
"summary": {
"validation_failed": 0,
"queued": 0,
"processing": 0,
"created_pending": 1,
"payment_succeeded": 1,
"payment_failed": 0,
"system_failed": 0
},
"details": [
{
"line_number": 1,
"record_line_no": 2,
"reference_number": "INV-2030-001",
"account_type": "BC",
"amount_cents": 2550,
"status": "created_pending",
"failure_reason": "",
"trans_no": "b1893452400000826",
"transaction_status": 3,
"transaction_status_text": "Pending",
"transaction_result": ""
},
{
"line_number": 2,
"record_line_no": 3,
"reference_number": "INV-2030-002",
"account_type": "CT",
"amount_cents": 4800,
"status": "payment_succeeded",
"failure_reason": "",
"trans_no": "b1893452400000972",
"transaction_status": 1,
"transaction_status_text": "Successful",
"transaction_result": ""
}
],
"pagination": {
"page": 1,
"page_size": 50,
"total": 2,
"last_page": 1
}
}
}授权
OAuth2 client_credentials 授权。access_token 到期后重新获取。
查询参数
可选业务标识,最长20个字符;传入时必须属于当前认证商户,并与目标批次的业务一致。省略或为空时在该商户全部业务范围内定位批次。
20与 file_identifier 至少提供一个;同时提供时须匹配同一批次。
x >= 1与 batch_id 至少提供一个;同时提供时须匹配同一批次。
10^[A-Za-z0-9_]{10}$按逻辑行号精确筛选,最小为 1;与 status 同时提供时同时生效,details 仍为数组。
x >= 1页码,从 1 开始;省略或为空时使用 1。
x >= 1每页记录数,范围 1–200;省略或为空时使用 50。
1 <= x <= 200按单个明细状态筛选。 validation_failed:明细校验失败,未进入支付处理;queued:等待处理;processing:正在处理;created_pending:已创建交易,尚未确认支付成功或失败;交易也可能已过期;payment_succeeded:支付成功;payment_failed:支付失败;system_failed:处理异常,支付结果需核实。
validation_failed, queued, processing, created_pending, payment_succeeded, payment_failed, system_failed, null