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:
| Name | Type | Required | Description |
|---|---|---|---|
sessionJWT | string | Yes | Signed 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:
| Name | Type | Required | Description |
|---|---|---|---|
options | CreateCheckoutOptions | No | Configuration for the checkout |
CreateCheckoutOptions:
| Property | Type | Default | Description |
|---|---|---|---|
autoProcessing | boolean | Inferred from session | true: 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:
| Name | Type | Required | Description |
|---|---|---|---|
paymentType | AllowedPaymentType | Yes | Payment type to trigger. Currently only "PANENTRY" and "CLICKTOPAY" are supported |
options | CreateTriggerOptions | No | Configuration for the trigger |
CreateTriggerOptions:
| Property | Type | Default | Description |
|---|---|---|---|
autoProcessing | boolean | Inferred from session | Same 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:
| Name | Type | Required | Description |
|---|---|---|---|
paymentType | AllowedPaymentType | Yes | Payment type for the button (for example, "GOOGLEPAY", "APPLEPAY") |
options | CreateButtonOptions | No | Configuration for the button |
CreateButtonOptions:
| Property | Type | Default | Description |
|---|---|---|---|
autoProcessing | boolean | Inferred from session | Same 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:
| Name | Type | Required | Description |
|---|---|---|---|
event | string | Yes | Event name. Valid values: "error", "created", "destroyed", "*" (wildcard) |
callback | function | Yes | Handler 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:
| Name | Type | Required | Description |
|---|---|---|---|
event | string | Yes | Event name to unsubscribe from |
callback | function | No | Specific 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:
| Name | Type | Required | Description |
|---|---|---|---|
target | string or CheckoutContainers | No | CSS selector string for sidebar mode, or an object with paymentSelection and paymentScreen for embedded mode. Omit for full sidebar |
CheckoutContainers:
| Property | Type | Required | Description |
|---|---|---|---|
paymentSelection | string | Yes | CSS selector for the button list container |
paymentScreen | string | No | CSS 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:
| Name | Type | Required | Description |
|---|---|---|---|
transientToken | string | Yes | Transient 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:
| Name | Type | Required | Description |
|---|---|---|---|
target | string | No | CSS 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:
| Name | Type | Required | Description |
|---|---|---|---|
container | string or HTMLElement | Yes | CSS 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:
| Name | Type | Required | Description |
|---|---|---|---|
transientToken | string | Yes | Transient 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.
| Property | Type | Description |
|---|---|---|
name | string | Always "UnifiedCheckoutError" |
reason | string | Machine-readable error reason code (for example, CAPTURE_CONTEXT_INVALID) |
message | string | Human-readable error description |
details | unknown | Optional additional error context |
correlationId | string | Identifier for correlating the error with server-side logs |
informationLink | string | Optional 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); }}Thanks for your feedback!
Last published: September 29, 2026