Skip to main content

JavaScript Reference


Complete reference for the Unified Checkout v1 JavaScript SDK. This page documents every method and type in the SDK's public surface. For event names and payload shapes, see Events.

VAS.UnifiedCheckout(sessionJWT)

Factory function that initializes the SDK. Returns a frozen, immutable client interface (the returned object is passed through Object.freeze(), so its methods cannot be reassigned or removed after creation).

Parameters:

NameTypeRequiredDescription
sessionJWTstringYesSigned JSON Web Token (JWT) from the server-side session endpoint

Returns: Promise<UnifiedCheckoutInterface>

Throws: UnifiedCheckoutError with reason CAPTURE_CONTEXT_INVALID if the JWT signature is invalid, or UNUSED_TARGET_ORIGINS if the current page origin is not in the JWT's targetOrigins list.

const client = await VAS.UnifiedCheckout(sessionJWT);

UnifiedCheckoutInterface

The client object returned by VAS.UnifiedCheckout(). All methods throw an Error if called after destroy().

client.createCheckout(options?)

Creates a new checkout integration instance.

Parameters:

NameTypeRequiredDescription
optionsCreateCheckoutOptionsNoConfiguration for the checkout

CreateCheckoutOptions:

PropertyTypeDefaultDescription
autoProcessingbooleanInferred from sessiontrue: mount() returns completed payment result. false: mount() returns transient token. Defaults to true when completeMandate is present in the session

Returns: Promise<Checkout>

const checkout = await client.createCheckout({ autoProcessing: false });

client.createTrigger(paymentType, options?)

Creates a trigger for programmatically launching a specific payment method.

Parameters:

NameTypeRequiredDescription
paymentTypeAllowedPaymentTypeYesPayment type to trigger. Currently only "PANENTRY" and "CLICKTOPAY" are supported
optionsCreateTriggerOptionsNoConfiguration for the trigger

CreateTriggerOptions:

PropertyTypeDefaultDescription
autoProcessingbooleanInferred from sessionSame as checkout autoProcessing

Returns: Trigger

Throws: UnifiedCheckoutError with reason TRIGGER_PAYMENT_TYPE_NOT_SUPPORTED if the payment type cannot be used with a trigger.

const trigger = client.createTrigger('PANENTRY');

client.createButton(paymentType, options?) (Experimental)

Creates an individual payment method button.

Parameters:

NameTypeRequiredDescription
paymentTypeAllowedPaymentTypeYesPayment type for the button (for example, "GOOGLEPAY", "APPLEPAY")
optionsCreateButtonOptionsNoConfiguration for the button

CreateButtonOptions:

PropertyTypeDefaultDescription
autoProcessingbooleanInferred from sessionSame as checkout autoProcessing

Returns: PaymentButton

const button = client.createButton('GOOGLEPAY');

client.on(event, callback)

Subscribes to a client-level event. Returns an unsubscribe function.

Parameters:

NameTypeRequiredDescription
eventstringYesEvent name. Valid values: "error", "created", "destroyed", "*" (wildcard)
callbackfunctionYesHandler function that receives event-specific payload

Returns: Unsubscribe — a function that removes the handler when called.

Throws: Error if event is not a valid event name.

const unsubscribe = client.on('error', (err) => {  console.error(err.source, err.code, err.message);});// Laterunsubscribe();

client.off(event, callback?)

Removes an event handler. This method is permissive — calling it with an unknown event or callback does not throw.

Parameters:

NameTypeRequiredDescription
eventstringYesEvent name to unsubscribe from
callbackfunctionNoSpecific handler to remove. If omitted, all handlers for the event are removed

client.updateToken(token) (Future)

Reserved for updating the session token without reinitializing the SDK. Not yet implemented — calling this method throws an Error.


client.destroy()

Permanently destroys the client. Emits a "destroyed" event, clears all event listeners, and marks the instance as destroyed. Subsequent method calls throw.

Idempotent — calling destroy() multiple times is safe.


client.isDestroyed()

Returns: boolean — true if destroy() has been called.


Checkout

Returned by client.createCheckout(). Manages the full checkout UI lifecycle.

checkout.mount(target)

Attaches the payment UI to the page and starts the payment flow.

Parameters:

NameTypeRequiredDescription
targetstring or CheckoutContainersNoCSS selector string for sidebar mode, or an object with paymentSelection and paymentScreen for embedded mode. Omit for full sidebar

CheckoutContainers:

PropertyTypeRequiredDescription
paymentSelectionstringYesCSS selector for the button list container
paymentScreenstringNoCSS selector for the payment form container. If omitted, payment screens appear in sidebar mode

Returns: Promise<string> — a transient token JWT (when autoProcessing: false) or completed payment result JWT (when autoProcessing: true).

Throws: UnifiedCheckoutError — see Error Handling for mount error codes.

// Sidebarconst result = await checkout.mount('#buttons');// Embeddedconst result = await checkout.mount({  paymentSelection: '#buttons',  paymentScreen: '#form'});

checkout.unmount()

Removes the payment UI from the page. The checkout is not destroyed, and mount() can be called again.


checkout.complete(transientToken)

Manually completes the payment flow. Only available when autoProcessing is false.

Parameters:

NameTypeRequiredDescription
transientTokenstringYesTransient token JWT returned by mount()

Returns: Promise<string> — the completed payment result JWT.

Throws: UnifiedCheckoutError — see Error Handling for complete error codes.

const token = await checkout.mount('#buttons');const result = await checkout.complete(token);

checkout.isMounted()

Returns: boolean — true if the checkout UI is currently mounted.


checkout.isDestroyed()

Returns: boolean — true if destroy() has been called.


checkout.on(event, handler)

Subscribes to a checkout-level event. Returns an unsubscribe function.

Valid events: "mounted", "ready", "unready", "unmounted", "destroyed", "paymentMethodSelected", "paymentMethodCancelled", "paymentMethodUpdate", "error", "*".

See the Events page for payload details.


checkout.off(event, handler?)

Removes a checkout event handler.


checkout.destroy()

Permanently destroys the checkout. Removes payment UI, cleans up iframes, and emits a "destroyed" event. Idempotent.


Trigger

Returned by client.createTrigger(). Programmatically launches a specific payment method.

trigger.mount(target?)

Launches the payment method UI.

Parameters:

NameTypeRequiredDescription
targetstringNoCSS selector for embedded mode. Omit for sidebar mode

Returns: Promise<string> — transient token or completed payment result.

const result = await trigger.mount('#payment-screen');

trigger.unmount()

Hides the payment method UI. The trigger is not destroyed.


trigger.complete(transientToken)

Manually completes the payment. Same interface as checkout.complete().


trigger.isMounted()

Returns: boolean


trigger.isDestroyed()

Returns: boolean


trigger.on(event, handler)

Subscribes to trigger events. Same event names and payloads as checkout events.


trigger.off(event, handler?)

Removes a trigger event handler.


trigger.destroy()

Permanently destroys the trigger. Idempotent.


PaymentButton (Experimental)

Returned by client.createButton(). Renders an individual payment method button.

button.mount(container)

Mounts the button into a container.

Parameters:

NameTypeRequiredDescription
containerstring or HTMLElementYesCSS selector string or Document Object Model (DOM) element for the button container

Returns: Promise<string> — transient token or completed payment result.


button.unmount()

Removes the button from the page. The button is not destroyed.


button.complete(transientToken)

Manually completes the payment. Same interface as checkout.complete(). Only available when autoProcessing is false.

Parameters:

NameTypeRequiredDescription
transientTokenstringYesTransient token JWT returned by mount()

Returns: Promise<string> — the completed payment result JWT.


button.isMounted()

Returns: boolean


button.isDestroyed()

Returns: boolean


button.on(event, callback)

Subscribes to button events. Returns void (not an unsubscribe function). Use button.off() to remove handlers.


button.off(event, callback?)

Removes a button event handler.


button.destroy()

Permanently destroys the button. Idempotent.


Types

AllowedPaymentType

A union of "PANENTRY", digital payment types, SRC payment types, and alternative payment method (APM) types.

Core types:

"PANENTRY" | "APPLEPAY" | "GOOGLEPAY" | "PAZE" | "CLICKTOPAY"| "CHECK" | "TMS_TOKEN"

SRC types (used internally for Click to Pay network routing):

"SRCVISA" | "SRCMASTERCARD" | "SRCAMEX"

Alternative payment method types:

"AFFIRM" | "AFTERPAY" | "ALFAMART" | "ALIPAY" | "BANCONTACT"| "BELFIUS" | "BLIK" | "BUYBOX" | "DOKU" | "DRAGONPAY"| "EPS" | "ESTONIABANKS" | "FPXONLINEBANKING" | "GRABPAY" | "IDEAL"| "INDOMARET" | "INDONESIABANKS" | "JENIUSPAY" | "KAKAOPAY" | "KBC"| "KCP" | "KLARNA" | "KREDIVO" | "LATVIABANKS"| "LINEPAY" | "LINKAJA" | "LITHUANIABANKS" | "MULTIBANCO" | "MYBANK"| "NAVERPAY" | "OVO" | "OXXO" | "PAY-EASY" | "PAYCO"| "PAYCONIQ" | "PAYPAL" | "PAYPO" | "PAYU" | "PIX"| "PRZELEWY24" | "RAKUTENPAY" | "SEPADD" | "SOFORT" | "THAILANDBANKS"| "TINKPAYBYBANK" | "TPNTHAILAND" | "TRUSTLY" | "UKBACS" | "VENMO"| "WECHATPAY"

See Alternative Payment Methods and Digital Wallets for descriptions and categories.

AllowedCardNetworks

"AMEX" | "CARNET" | "CARTESBANCAIRES" | "CUP" | "DINERSCLUB"| "DISCOVER" | "EFTPOS" | "ELO" | "JAYWAN" | "JCB"| "JCREW" | "KCP" | "MADA" | "MAESTRO" | "MASTERCARD"| "MEEZA" | "PAYPAK" | "UATP" | "VISA"

See Card Payments for descriptions.

UnifiedCheckoutError

An Error subclass thrown by SDK methods (for example, VAS.UnifiedCheckout(), mount(), complete()) when a call fails.

PropertyTypeDescription
namestringAlways "UnifiedCheckoutError"
reasonstringMachine-readable error reason code (for example, CAPTURE_CONTEXT_INVALID)
messagestringHuman-readable error description
detailsunknownOptional additional error context
correlationIdstringIdentifier for correlating the error with server-side logs
informationLinkstringOptional URL to documentation about the error
try {  const client = await VAS.UnifiedCheckout(sessionJWT);} catch (error) {  if (error.name === 'UnifiedCheckoutError') {    console.error(error.reason, error.message, error.correlationId);  }}

Last published: September 29, 2026