Guide

Customize checkoutBeta

Payment method layouts, skeletons, container styling and the current browser SDK boundaries.

Keep your page and use CX Pay's actual checkout components. The browser API is CxPay.embed(): pass the Checkout Session ID, not its client secret. Your server owns prices, customer details, payment-method configuration and capture policy.

The supported 0.0.1 Beta contract remains the complete payment form. This guide also identifies the broader composition options in the current development SDK. Confirm the hosted bundle and pay runtime supplied for your environment support the options you choose; this page is not a production-release announcement.

Choose the integration

IntegrationHow to open itWho owns the payment button?
Hosted payment pageNavigate to the session's returned urlCX Pay
Embedded full page (development preview)view: "checkout"CX Pay
Embedded payment form (beta)view: "form"CX Pay
Composed Elements (development preview)view: "payment", optionally a separate view: "express"Your page for payment; express wallets self-confirm

Elements here means payment and express blocks, not individually placeable card fields. Do not construct iframe URLs yourself. Omitting view mounts checkout, so explicitly set view: "form" for the form beta.

Payment method layout

JavaScript
1const form = CxPay.embed({
2 session: sessionId,
3 container: "#payment-form",
4 view: "form",
5 methodLayout: "grouped",
6});
methodLayoutPresentation
"grouped"One compact accordion with shared borders; default for the full checkout page
"spaced"Separate accordion panels; default for form and payment blocks
"tabs"A tab selector above the selected payment method

The selector uses eligible methods returned by the session. It does not add unavailable wallets, change the currency or change gateway configuration. methodLayout is ignored for the express-only block. The layout names are exact; there is no "auto" SDK value—omit the option for the integration default.

A card-only session renders a plain card form, without a method selector. The tabs and accordion choices apply when there are multiple selectable methods.

Show a matching skeleton

Call CxPay.skeleton() before your merchant server returns the session. Pass the same view and layout to embed(); it adopts the placeholder until the iframe paints.

JavaScript
1const presentation = {
2 container: "#payment-form",
3 view: "form",
4 methodLayout: "grouped",
5};
6const loading = CxPay.skeleton(presentation);
7try {
8 // Your route returns this order's existing session or creates it once.
9 const response = await fetch("/api/checkout", { method: "POST" });
10 if (!response.ok) throw new Error("Checkout unavailable");
11 const { sessionId } = await response.json();
12 const form = CxPay.embed({ ...presentation, session: sessionId });
13 // Register ready, error and complete handlers as in the form guide.
14 // Keep form and call form.unmount() when the checkout component is disposed.
15} catch {
16 loading.remove();
17 document.querySelector("#checkout-message").textContent =
18 "Checkout could not load. Try again using the same order.";
19}

The placeholder is not a payment status. Do not infer readiness or success from its disappearance.

Your page styling

You control the container width, surrounding layout, copy and spacing. Let the SDK resize its iframe; do not set a fixed height or clip it.

HTML
1<section class="checkout-column">
2 <h2>Complete your order</h2>
3 <div id="payment-form"></div>
4 <p id="checkout-message" role="status"></p>
5</section>
CSS
1.checkout-column {
2 width: 100%;
3 max-width: 560px;
4 min-width: 0;
5 margin-inline: auto;
6}

Merchant CSS cannot cross the secure iframe. embed() currently has no appearance, theme, font, radius, shadow or animation option. Setting a CSS variable on the parent does not style the secure fields. The form's button stays CX Pay-owned. In Elements, your external button is ordinary HTML that you can style yourself.

Wallet placement and your own button

For the development Elements composition, set wallets: false on payment when mounting express separately. Otherwise wallets appear inside the payment block by default. This option only affects view: "payment"; it is not a wallet-hiding switch for the complete form.

JavaScript
1const express = CxPay.embed({
2 session: sessionId, container: "#express", view: "express",
3});
4const payment = CxPay.embed({
5 session: sessionId, container: "#payment", view: "payment",
6 methodLayout: "tabs", wallets: false,
7});
8
9const button = document.querySelector("#pay-button");
10button.disabled = true;
11payment.on("change", ({ canConfirm, action }) => {
12 button.disabled = !canConfirm;
13 button.textContent = action === "next" ? "Continue to billing" : "Pay";
14});
15button.onclick = () => {
16 if (!button.disabled) payment.confirm();
17};
18// Attach complete/error handlers to BOTH blocks.
19// On disposal: payment.unmount(); express.unmount();

Do not independently disable the button forever after confirm(). A validation-only submission may not emit another change event. The frame's canConfirm state controls availability. A browser complete event is not fulfillment authorization: verify the payment on your server, and distinguish requires_capture (authorized) from succeeded (captured).

Changing settings

Settings are read at mount time. There is no form.update() method. Keep the session ID, call unmount(), then mount with the new options. This clears unfinished field entry; never remount during a payment, redirect, bank challenge or uncertain outcome. An explicit Apply button is appropriate for a developer demo, not automatic remounting on every colour-picker input.

The demo's inline/overlay 3DS switch is a demonstration helper, not a public embed() option. The bank owns the challenge contents; CX Pay owns its lifecycle. Do not recreate the issuer challenge UI in merchant code. Refreshing or remounting during OTP can leave Continue verification unable to resume the challenge; see the known interruption limitation.

URLs and environments

PurposeProduction URL
Merchant machine APIhttps://api.cxpay.net (resource paths start with /v1/)
Hosted browser scripthttps://js.cxpay.net/v1/cxpay.js
Pay originhttps://pay.cxpay.net
Merchant portalhttps://station.cxpay.global

Test and live keys use the same production API host; test/live is a data partition, not a choice of deployment stage. For a development rehearsal, use the API, script and payUrl supplied together by CX Pay. Do not mix a development session with the production pay origin.

Follow the session's returned url for hosted checkout (currently /cs/{sessionId}). Payment links use their returned /l/{paymentLinkId} URL. Use returned URLs rather than manufacturing a route from an ID or adding .png for a QR code.

Powered by CX Pay