Checking access…

Skip to main content
Version: v2
Audience: Consumers, CCG Platform Engineers

Look Up a Session

When to use this page

You created a session and need to know how it ended, or whether a payment came out of it. To look up a payment on its own, see Look Up a Payment.

Integration Details​

  • API Endpoint: GET /v2/sessions/{sessionId}
  • API Spec: Get Session
  • Scope: merchant
  • Path parameter: sessionId β€” the sessionId returned when you created the session
  • Headers: Authorization, X-Merchant-Id, and X-Upstream-Env in non-production. See API Headers.

The url field in the create-session response is this same endpoint, so you can poll it directly.

Request​

curl -X GET "https://api-stg.uhg.com/api/financial/commerce/nonprodcheckout/v2/sessions/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer <token>" \
-H "X-Merchant-Id: <merchant-id>" \
-H "X-Upstream-Env: dev"

Read the result​

The HTTP status tells you whether the session is still open:

statusHTTPWhat to do
INITIATED202The customer has not finished. Keep polling.
PENDING202The session is waiting to complete. Keep polling.
COMPLETED200Done. Read the payment object if the session created a payment.
FAILED200Done. The flow failed; create a new session to try again.
CANCELED200Done. The session was canceled before completion.

An expired session returns a SESSION_TIMEOUT error with HTTP 401, not a status value. Create a new session; expired sessions cannot be reused.

Sample Response β€” COMPLETED (200)

Key fields only. See the Get Session API Spec for the complete response.

{
"data": {
"status": "COMPLETED",
"payment": {
"id": "3222ac8a-c8fa-4426-bd99-e96a909569b0",
"merchantTransactionId": "30d279fa-9d7d-48c9-8e61-c3783eecf18c",
"status": "COMPLETED"
}
}
}

Read the payment from a session​

When the session created a payment (for example PAYMENT_WITH_WALLET), the payment object has the same shape as the Payments API response, including paymentAllocations[] for single and split-tender payments. You do not need a second call to read the result.

Errors​

HTTPMeaningAction
400Invalid sessionIdCheck that it is the UUID from the create-session response
401Invalid or expired token, or SESSION_TIMEOUTRefresh the token, or create a new session
403The merchant is not allowed to read this sessionCheck X-Merchant-Id and the merchant scope
404Session not foundCheck the ID and the environment
422The request is valid but could not be processedCheck the sessionId value and the session state against the Get Session API Spec

See Session Error Codes for the full list.