Getting Started
If you need to embed or configure the Convenient Checkout UI, start with this page.
Get the CCG widget running in your application in minutes. This guide covers prerequisites, installation, and a minimal working integration.
- A CCG merchant account and
merchantId - A session token from the Sessions API
- A container element in your page for the widget to render into
Step 1: Create a Sessionβ
Before launching the widget, your backend must create a session via the Sessions API. The session token controls what the widget displays and what the user can do.
POST /sessions
See the Sessions API for full request/response details, including mode configuration and digital wallet setup.
Step 2: Install the Widgetβ
Choose the installation method that best fits your project:
Option A β CDN (Script Tag)β
Paste this script tag into your HTML page. No build step required.
<!-- Add a container where the widget will render -->
<div id="ccg-widget-container"></div>
<!-- Load the CCG widget -->
<script src="https://cdn.healthsafepay.com/wallet/ccg-widget.min.js"></script>
Option B β NPM (Recommended for React / TypeScript projects)β
npm install @optum-ccg/convenient-checkout-ui
Step 3: Initialize the Widgetβ
Once the script is loaded and you have a session token, initialize the widget:
CDNβ
const options = {
rootElement: document.querySelector("#ccg-widget-container"),
checkoutSessionId: "REPLACE_WITH_CHECKOUT_SESSION_ID",
appEnv: "prod",
onSuccess: function(data) {
console.log("Payment complete", data);
},
onError: function(data) {
console.error("Payment error", data);
},
onEvent: function(data) {
console.log("Widget event", data);
}
};
const widget = window.OptumCCGWidgetInitializer(options);
widget.render();
NPM / TypeScriptβ
import { OptumCCGWidgetInitializer, OptumCCGWidgetOptions } from "@optum-ccg/convenient-checkout-ui/dist/widget/ccg-widget.min";
const options: OptumCCGWidgetOptions = {
rootElement: document.querySelector("#ccg-widget-container") as HTMLElement,
checkoutSessionId: "REPLACE_WITH_CHECKOUT_SESSION_ID",
appEnv: "prod",
onSuccess: (data) => console.log("Payment complete", data),
onError: (data) => console.error("Payment error", data),
onEvent: (data) => console.log("Widget event", data),
};
const widget = OptumCCGWidgetInitializer(options);
widget.render();
For full type definitions and a React example, see TypeScript Support.
Integration Models at a Glanceβ
| Model | How it Renders | When to Use |
|---|---|---|
| Embedded β Inline | Rendered inline inside your page | Full in-page checkout experience |
| Embedded β Modal | Rendered as a modal overlay | Pop-up without leaving your page |
| Embedded β Drawer | Rendered as a slide-in drawer | Sidebar-style checkout |
| Hosted | Browser pop-up managed by CCG | Minimal frontend code required |
For detailed setup per model, see the Integration Overview.
Next Stepsβ
| What to do | Where to go |
|---|---|
| Choose Hosted or Embedded | Integration Options |
| Set up TypeScript types | TypeScript Support |
| Understand widget modes & capabilities | Widget Modes |
| Customize appearance | Theming & Styling |
| Set up language / translation | Localization & Translation |
| Go to full API reference | API Reference |
Authentication & Securityβ
The widget is driven entirely by the backend-issued session token. No direct user credentials are passed through the widget. Token expiry and session lifecycle are handled by the Sessions API. For PCI-related events during widget use, see PCI Engagement Notification.
Versioning & Backward Compatibilityβ
See Versioning for supported package versions, breaking changes, and deprecation timelines.