Skip to Content

Expire session

Important

  1. Session lifetime defaults to 30 minutes and expires automatically after that; integrating with this endpoint is optional.
  2. Once a session is closed it cannot be reopened, and it can no longer be used to load the checkout page or submit payment.
  3. 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-session

Proactively 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

NameTypeRequiredDescription
Authorization
stringYes
****** authentication, format: ******
Example: "******"
Content-Type
stringYes
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
stringYes
Request timestamp, Unix milliseconds, 13 digits, within ±10 minutes of server time.
Pattern: ^[0-9]{13}$
Example: "1742198978000"

Body parameters

NameTypeRequiredDescription
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

NameTypeRequiredDescription
code
stringY
Response code, "0" indicates success
Example: "0"
msg
stringN
Response message
Example: "Success"
traceId
stringY
Trace ID for troubleshooting
Example: "TRACE123456789"
data
objectY
Last updated on