Expire session
Important
- Session lifetime defaults to 30 minutes and expires automatically after that; integrating with this endpoint is optional.
- Once a session is closed it cannot be reopened, and it can no longer be used to load the checkout page or submit payment.
- If the session is currently processing payment or has already completed, it cannot be closed. Use the Transaction Query API to check the payment result instead.
ENDPOINT
POST
https://open.sunbay.us/v1/checkout/expire-sessionProactively closes the specified Checkout Session before it expires naturally, making it invalid immediately. Useful for scenarios such as order cancellation where the payment needs to be terminated early.
Parameters
Header parameters
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | ****** authentication, format: ****** Example: "******" |
Content-Type | string | Yes | Request content type, fixed value: application/json |
X-Client-Request-Id | string(64) | Yes | Unique request identifier for deduplication and tracing. UUID recommended; must be unique per request. Example: "550e8400-e29b-41d4-a716-446655440002" |
X-Timestamp | string | Yes | Request timestamp, Unix milliseconds, 13 digits, within ±10 minutes of server time. Pattern: ^[0-9]{13}$Example: "1742198978000" |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
appId | string(32) | Yes | Application ID assigned by SUNBAY Pattern: ^[A-Za-z0-9_\-]+$Example: "smgq9m496ty14ouw" |
merchantId | string(32) | Yes | Merchant ID assigned by SUNBAY Pattern: ^[A-Za-z0-9_\-]+$Example: "M1260231004" |
sessionId | string(64) | Yes | The ID of the session to close, i.e. the `sessionId` returned in the create-session response Example: "cs_1a2b3c4d5e6f7g8h" |
reason | string(128) | No | Reason for closing the session (optional), for record-keeping purposes Example: "Order cancelled by customer" |
Request Example
{
"appId": "smgq9m496ty14ouw",
"merchantId": "M1260231004",
"sessionId": "cs_1a2b3c4d5e6f7g8h",
"reason": "Order cancelled by customer"
}Code Examples
cURLbash
Response parameters
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Y | Response code, "0" indicates success Example: "0" |
msg | string | N | Response message Example: "Success" |
traceId | string | Y | Trace ID for troubleshooting Example: "TRACE123456789" |
data | object | Y |
Last updated on