SDK Methods
Complete reference of all VisaAcceptance SDK methods and instance lifecycle controls.
Initialization
init(config)
Initialize the SDK with global configuration. Must be called before render(). Calling it a second time is a no-op and logs a console warning.
VisaAcceptance.init({
locale: 'en-US',
theme: { preset: 'anet', mode: 'light' },
onEvent: (type, payload) => analytics.track(type, payload),
onError: (error) => errorReporter.capture(error),
});Prop
Type
Rendering
render(component, container, config?)
Mount an embedded component into a DOM element. Returns an EmbeddedInstance for lifecycle control.
const instance = VisaAcceptance.render('transactions', '#my-container', {
onReady: () => console.log('Component loaded'),
onAuthRequired: () => refreshToken(),
});Parameters:
| Parameter | Type | Description |
|---|---|---|
component | ComponentName | One of: transactions, invoices, payment, pay-by-link, subscriptions, customers, merchant-boarding, fraud-manager, reports, login |
container | string | HTMLElement | CSS selector or DOM element reference |
config | RenderConfig | Optional mount configuration |
Prop
Type
Runtime Updates
updateConfig(config)
Merge partial configuration at runtime. Propagates theme, locale, and permission changes to all live instances.
VisaAcceptance.updateConfig({
locale: 'fr-FR',
theme: { mode: 'dark' },
});Instance Methods
Each render() call returns an EmbeddedInstance:
| Method | Returns | Description |
|---|---|---|
getInstanceId() | string | Unique instance identifier |
getState() | ComponentState | Current lifecycle state |
destroy() | void | Tear down iframe, listeners, and transition to DESTROYED |
updateTheme(theme) | void | Push a partial theme update to this instance |
authenticate(config?) | Promise<void> | Trigger re-authentication. Optional { timeout } in ms |
sendToIframe(type, payload?) | void | Send a custom message to the component iframe |
const instance = VisaAcceptance.render('invoices', '#container');
// Update appearance
instance.updateTheme({ mode: 'dark' });
// Re-authenticate after token refresh
await instance.authenticate({ timeout: 10000 });
// Cleanup
instance.destroy();Utility Methods
| Method | Returns | Description |
|---|---|---|
getConfig() | VisaAcceptanceConfig | null | Current global config snapshot |
getEnvironment() | Environment | Auto-detected: 'local' | 'dev' | 'cte' | 'prod' |
getVersion() | string | SDK semver string |
getInstances() | EmbeddedInstance[] | All currently mounted instances |
destroyAll() | void | Destroy all instances and reset state |
Testing Helpers
These methods are available in all environments but intended for development and testing only.
| Method | Description |
|---|---|
init({ noAuth: true }) | Bypass authentication for all components (sandbox mode) |
render(component, container, { noAuth: true }) | Bypass auth for a single component |