Batch Close
ENDPOINT
POST
https://open.sunbay.us/v1/settlement/batch-closeThe Batch Close API is used to close the current transaction batch and trigger the settlement process. After calling this API, the backend immediately initiates a batch close settlement request, and the API returns the batch close result. Once the batch is closed, it cannot be reversed, and transactions within the batch will enter the settlement process.
Parameters
Header parameters
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | Y | Bearer Token authentication, format: Bearer {your_api_key} Example: "Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" |
Content-Type | string | Y | Request content type, fixed value: application/json |
X-Client-Request-Id | string(64) | Y | Request unique identifier, used to prevent duplicate requests and issue tracking. UUID format is recommended, each request must use a unique Request ID Example: "550e8400-e29b-41d4-a716-446655440000" |
X-Timestamp | string | Y | Request timestamp, Unix timestamp (milliseconds), 13 digits. The deviation between the request timestamp and server time cannot exceed ±10 minutes Pattern: ^[0-9]{13}$Example: "1701234567890" |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
appId | string(32) | Y | Application ID Example: "app_123456" |
merchantId | string(32) | Y | Merchant ID Example: "mch_789012" |
transactionRequestId | string(32) | Y | Batch close request unique identifier. Used to identify the unique ID of this batch close, serves as an API idempotency control field, and can be used to query batch close results later. Can only contain letters, numbers, underscores and hyphens, maximum length 32 characters. Must not be repeated for each request Pattern: ^[A-Za-z0-9_\-]+$Example: "BATCH_CLOSE_20231119001" |
terminalSn | string(32) | Y | Payment terminal serial number. The payment terminal device serial number provided by SUNBAY, which is used for reading bank cards, processing PINs and other security operations Example: "T1234567890" |
channelCode | string(32) | Y | Payment channel code Example: "TSYS" |
description | string(128) | N | Batch close description Example: "End of business day, close batch" |
attach | string(128) | N | Additional data, returned as is, JSON format recommended Example: "{\"closeTime\":\"2023-11-19T22:00:00+08:00\"}" |
Request Example
{
"appId": "app_123456",
"merchantId": "mch_789012",
"transactionRequestId": "BATCH_CLOSE_20231119001",
"terminalSn": "T1234567890",
"channelCode": "TSYS",
"description": "End of business day, close batch"
}Code Examples
cURLbash
Response parameters
| Name | Type | Required | Description |
|---|---|---|---|
code | string(16) | Y | Response code, 0 indicates success Example: "0" |
msg | string(128) | N | Response description Example: "Batch close successful" |
traceId | string(64) | Y | Trace ID, used for troubleshooting Example: "TRACE123456789" |
data | object | Y |
Last updated on