High-Level Design: Session Termination and Merchant Notification
| Field | Detail |
|---|---|
| Author(s) | Convenient Checkout documentation |
| Reviewers | To be confirmed |
| Status | Draft β implementation and SDK contract verification required |
| Last Updated | 2026-11-26 |
| Version | 1.0 |
This draft records the intended web-popup behavior and the currently observed SDK contract. Confirm implementation behavior and obtain engineering review before treating it as an approved implementation contract.
1. Overviewβ
This design describes how a web checkout session ends when the customer does not complete checkout, what the wallet displays, and what the merchant can learn through the Branded Button SDK. It distinguishes CCG checkout-session termination from HSID authentication-session ownership. Browser communication is best-effort; when the merchant context is gone, the wallet cannot return a result to it.
2. Problem Statementβ
A popup can remain open after its merchant page is gone, or a customer can leave checkout through popup closure, logout, or session expiry. Without consistent termination and result handling, the wallet can show a stale checkout and merchants cannot reliably reconcile incomplete outcomes.
3. Goals & Non-Goalsβ
Goalsβ
- Document which web-popup scenarios attempt to terminate the CCG session and where cancellation is best effort.
- Record the terminal experience without interrupting an active HSID authentication screen.
- Describe the browser SDK result contract and its limits.
- Direct merchants to the Sessions API for session status and recovery.
Non-Goalsβ
- Mobile-specific termination or SDK behavior.
- New notifications for completed or failed checkout outcomes.
- Final UX copy for placeholder terminal screens.
- HSID settings-initiated logout behavior.
- Merchant webhooks for popup outcomes.
4. Target Audience & Stakeholdersβ
| Stakeholder | Interest / Concern |
|---|---|
| Product and support | Consistent incomplete-checkout outcomes and customer guidance |
| Wallet and SDK engineering | Session termination, browser messaging, and callback contract |
| QA | Scenario coverage across popup, merchant, and HSID navigation |
| Merchant integrators | Result handling and session-status reconciliation |
5. Current State (Before)β
- The Branded Button SDK receives wallet success, error, and close messages and
exposes generic
success,error, andcloseresults. - A
closeresult has no reason field. The SDK's public error enum identifies SDK or wallet errors, not standardized non-completion reasons. - The wallet detects merchant-context loss through popup messages and opener
checks, attempts to cancel the CCG session, and can render the
Checkout Is No Longer Availablescreen. - On wallet-page unload, the wallet attempts to cancel the CCG session except during HSID settings navigation or a language-change reload.
GET /v2/sessions/{sessionId}returnsINITIATEDorPENDINGwith HTTP 202, andCOMPLETED,FAILED, orCANCELEDwith HTTP 200.- An expired session returns
SESSION_TIMEOUTwith HTTP 401 and cannot be reused. This is an error response, not anEXPIREDstatus. - The separate
checkoutSessionStatusschema includesACCEPTEDandCREATED; those values do not belong to thestatusfield returned byGET /v2/sessions/{sessionId}.
Cancellation requests made during popup closure or merchant-context loss are best effort. Confirm the final session status rather than inferring successful cancellation from a browser event.
6. Proposed Design (After)β
The wallet owns its CCG checkout session and terminal wallet experience. HSID owns its authentication session and any HSID-owned expiry screen. The Branded Button SDK reports browser outcomes only while communication with the merchant page is available; the Sessions API remains authoritative for the final checkout status.
Session termination scenariosβ
| Trigger | CCG session outcome | Wallet experience | Merchant outcome | Ownership / verification |
|---|---|---|---|---|
| Customer closes the wallet popup before completion | The wallet attempts session cancellation during page unload; the request is best effort | Popup is closed | The SDK reports generic close when it detects closure; no reason is included. Reconcile through GET /v2/sessions/{sessionId}. | Verify the final session status; popup closure alone does not prove cancellation |
| Merchant tab or window is closed | The wallet detects the missing opener and attempts cancellation | Show Checkout Is No Longer Available if the wallet popup remains open | No callback is possible after the merchant context is gone; reconcile the session when the merchant flow resumes | Wallet context-loss handling |
| Merchant page reloads or navigates away while wallet is at HSID | The SDK sends MERCHANT_CONTEXT_LOST on pagehide. If the wallet cannot receive it during the HSID round trip, the wallet checks the opener after return and attempts cancellation when it is no longer the original page. | Do not interrupt the HSID screen; show the context-lost screen after detection | No result is guaranteed after the merchant page is gone; reconcile the session when the merchant flow resumes | Wallet and SDK implementations; verify the HSID return path |
| Customer selects Log out in Wallet | The wallet posts to the authentication provider's logout URL and follows its redirect. Confirm the resulting CCG session status with the Sessions API. | Provider redirect; do not promise a separate logged-out terminal screen | The SDK defines no logout-specific result or reason. Reconcile the session status. | Authentication provider owns the effect on the HSID session |
| CCG checkout session expires during inactivity | GET /v2/sessions/{sessionId} returns SESSION_TIMEOUT with HTTP 401; the expired session cannot be reused. | Show the timeout failure experience returned by the wallet; final copy remains subject to UX approval | No expiry-specific SDK reason is defined. Create a new session after confirming the prior session's status. | Session Error Codes and wallet implementation |
| HSID authentication session expires | The CCG status and HSID authentication session have separate owners. | HSID owns its authentication screen; do not infer CCG status from it. | No HSID-specific CCG result or reason is defined; reconcile the CCG session separately. | HSID owns its authentication session |
| Customer logs out through HSID | The authentication provider owns the HSID logout. Confirm the separate CCG status. | HSID owns the logout experience | No HSID-logout-specific SDK result or reason is defined | Confirm provider and API behavior before documenting additional effects |
| Customer opens HSID settings | Settings navigation alone does not trigger CCG cancellation. | Preserve the settings round trip | No logout result is implied; reconcile the session if the merchant context changed. | Wallet settings navigation handling; see Aha reference |
Terminal-screen text is placeholder copy. Exact approved text is not part of this design.
V2 session status and expiry contractβ
For GET /v2/sessions/{sessionId}, the status field uses these values:
| HTTP response | Status values |
|---|---|
| 202 | INITIATED, PENDING |
| 200 | COMPLETED, FAILED, CANCELED |
The separate checkoutSessionStatus schema includes ACCEPTED, CREATED,
INITIATED, PENDING, COMPLETED, FAILED, and CANCELED. Do not conflate
that field with the status returned by GET /v2/sessions/{sessionId}.
An expired session returns the SESSION_TIMEOUT error with HTTP 401; EXPIRED
is not a value in either status enum. The documented recovery is to create a
new session because an expired session cannot be reused. A browser close
result is not a session-status transition and does not prove that a
cancellation request reached the backend.
SDK result contractβ
| Wallet or browser event | Public SDK result |
|---|---|
WALLET_SUCCESS | { type: 'success', code, data } |
WALLET_ERROR | { type: 'error', code: 'WALLET_ERROR', message, title?, detail?, status?, errorDetails? } |
WALLET_CLOSE | { type: 'close' } |
| SDK detects the popup was closed | { type: 'close' } |
The SDK error enum currently includes POPUP_BLOCKED, POPUP_ACTIVE,
CREATE_SESSION_FAILED, CREATE_SESSION_TIMEOUT, INVALID_CONFIG,
WALLET_ERROR, and UNKNOWN. These are SDK or wallet error codes. The current
SDK contract defines no separate non-completion reason code for customer
closure, Wallet logout, or session expiry. Do not invent reason values or
derive a stable reason from free-form error text.
7. Data Flowβ
- The merchant creates a CCG session on its backend and launches the wallet popup through the Branded Button SDK.
- The wallet loads and tracks the CCG session. It displays the terminal experience appropriate to the final status or termination scenario.
- If browser communication is available, the wallet posts a success, error, or close message to the merchant origin.
- The SDK validates the message origin and popup source, then calls
onResult. - The merchant checks the Sessions API for the authoritative final status,
especially when the SDK result is
closeor no callback could be delivered.
MERCHANT_CONTEXT_LOST travels from the merchant SDK to the wallet popup; it
is not a merchant-facing result. The wallet validates the origin, attempts to
cancel the CCG session, and shows the context-lost terminal screen.
8. Key Decisionsβ
| # | Decision | Reasoning |
|---|---|---|
| 1 | Use browser SDK communication for popup outcomes; do not introduce a webhook for this feature | The outcome is tied to an active browser integration |
| 2 | Treat the Sessions API as authoritative for final checkout status | A popup result may be unavailable or generic |
| 3 | Keep CCG checkout-session ownership separate from HSID authentication-session ownership | CCG must not replace HSID-owned authentication or expiry behavior |
| 4 | Do not claim scenario-specific reasons until the SDK contract exposes them | Current close results carry no reason field |
9. Dependenciesβ
| Dependency | Type | Owner | Risk Level |
|---|---|---|---|
| Branded Button SDK communication and reason-code contract | SDK implementation | Wallet SDK | High |
| Wallet termination and terminal-screen behavior | Wallet web implementation | Checkout UI | High |
| Merchant-facing integration content | Documentation | Convenient Checkout docs | Medium |
10. Success Metricsβ
| Metric | Target |
|---|---|
| Supported termination scenarios have a documented session outcome, screen, and merchant result | All in-scope web-popup scenarios |
| Merchant result claims match the public SDK contract | No undocumented or invented reason codes |
| Merchants can reconcile incomplete outcomes | Sessions API and popup integration guidance are cross-linked |
11. Risks & Mitigationsβ
| Risk | Impact | Mitigation |
|---|---|---|
| Popup closure is reported to the merchant but does not terminate the server session | Session can remain reusable or stale | Verify and test server-side cancellation before marking the behavior supported |
| SDK does not expose a reason for incomplete checkout | Merchants cannot distinguish logout, expiry, and popup closure from close alone | Document generic results and add reason codes only through an approved SDK contract |
| Merchant page is gone | Browser result cannot be delivered | Attempt wallet-side cancellation and document that no callback is guaranteed |
| HSID settings or authentication flow is interrupted by CCG behavior | Customer cannot complete the identity flow | Keep HSID-owned screens and settings navigation separate from CCG terminal handling |
12. Related Documentationβ
- Sessions API lifecycle and errors
- Session Error Codes
- Hosted Experience and merchant result handling
- HSID integration guide
- CCG Service Overview
- UI architecture overview
- Branded Button SDK public types
- Branded Button SDK README
- Aha: Settings Navigation + Return State
- CC-25938: Documentation Updates for Session Termination and Merchant Notification Capabilities
- CC-25936: OW Logout and Session Termination Behavior
- CC-27687: Optum Wallet Merchant Launch SDK
Release verificationβ
- Verify popup closure both while session creation is pending and after the
wallet loads; distinguish the SDK
closecallback from backend cancellation. - Verify merchant tab closure, reload, and navigation while the wallet is active and during the HSID round trip. Confirm terminal behavior without assuming a callback can reach a page that no longer exists.
- Verify the logout URL flow with the authentication provider, including the
resulting CCG status and HSID-session effect. Do not infer either from the
Wallet button label or a generic SDK
close. - Verify that
GET /v2/sessions/{sessionId}returnsSESSION_TIMEOUTwith HTTP 401 for an expired session, and that recovery uses a new session. - Verify CCG timeout behavior during HSID authentication and verify HSID's separate authentication-expiry behavior.
- Confirm deployed SDK result payloads against the public types. Document non-completion reasons only after an approved contract exposes them.
- Confirm terminal-screen copy, deployed feature availability, and support guidance with the responsible owners before publishing guarantees.
No feature-specific LLD or ADR was found in the documentation repositories reviewed. Add links if an approved design artifact exists; do not treat this draft HLD as a substitute for an unlocated LLD or ADR.