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, take-payment, pay-by-link, subscriptions, customers, merchant-boarding, dynamic-form, fraud-manager, login |
container | string | HTMLElement | CSS selector or DOM element reference |
config | MountConfig | 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() | string | Current lifecycle state (e.g. 'MOUNTED', 'AUTHENTICATED', 'ERROR') |
destroy() | void | Tear down iframe, listeners, and transition to DESTROYED |
updateTheme(theme) | void | Push a partial theme update to this instance |
updateLocale(locale) | void | Push a locale change to this instance |
updatePermissions(permissions) | void | Update the permission set for this instance |
authenticate(timeout?) | 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(10000);
// Cleanup
instance.destroy();Utility Methods
| Method | Returns | Description |
|---|---|---|
getGlobalConfig() | VisaAcceptanceConfig | null | Current global config snapshot |
getEnvironment() | Environment | Auto-detected: 'local' | 'dev' | 'cte' | 'prod' |
hasInstance(instanceId) | boolean | Check if an instance exists by ID |
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 |