Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.caibo.digital/llms.txt

Use this file to discover all available pages before exploring further.

Overview

This page documents every method, option, and event payload exposed by the embedded checkout SDK.

CaiboCheckout.init(options)

Initializes the checkout iframe and binds event listeners.

Options

OptionTypeRequiredDefaultDescription
modestring'inline'Display mode: 'inline' or 'modal'.
paymentUrlstringRequiredFull checkout URL including merchantId, requestId, and apiKey.
containerIdstringInline onlyID of the <div> to mount the iframe into.
widthstring'480px'Modal width (modal) or iframe width (inline).
heightstring'700px'CSS height of the iframe.
onSuccessfunctionCalled when payment completes successfully.
onFailurefunctionCalled when payment fails or is declined.
onCancelfunctionCalled when user cancels or closes the modal.
onPendingfunctionCalled for async payment flows (e.g. waiting for bank confirmation).
onReadyfunctionCalled when the checkout page has loaded inside the iframe.
containerId is required only for mode: 'inline'. In 'modal' mode the SDK creates its own overlay attached to document.body.

CaiboCheckout.destroy()

Removes the iframe (inline) or the overlay (modal), cleans up all event listeners, and restores document.body scroll. Called automatically on success, failure, and cancel. Call it manually only to close programmatically (for example, from a custom abort button).
CaiboCheckout.destroy();

Event Payload

All callbacks receive a single data object. The shape depends on the event:
EventPayloadDescription
payment.success{ url, requestId, paymentId }Redirect URL, request & payment IDs.
payment.failure{ url, requestId, paymentId }Failure URL with identifiers.
payment.pending{ url, requestId }Waiting URL for async flows.
payment.cancel{}User-initiated cancellation.
payment.ready{}Checkout page loaded.

Example Payloads

// payment.success
{ url: 'https://merchant.com/success', requestId: '12345', paymentId: '67890' }

// payment.failure
{ url: 'https://merchant.com/failure', requestId: '12345', paymentId: '67890' }

// payment.pending
{ url: 'https://merchant.com/waiting', requestId: '12345' }

// payment.cancel  (user-initiated)
{}

Lifecycle Summary

1

init

Call CaiboCheckout.init(options) to render the iframe and start listening for postMessage events.
2

onReady

Fired once the checkout page has rendered inside the iframe.
3

Terminal event

Exactly one of onSuccess, onFailure, onPending, or onCancel is fired.
4

destroy (auto)

The SDK removes the iframe/overlay and cleans up listeners. Body scroll is restored.

Next Steps