VA
Acceptance

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:

ParameterTypeDescription
componentComponentNameOne of: transactions, invoices, payment, pay-by-link, subscriptions, customers, merchant-boarding, fraud-manager, reports, login
containerstring | HTMLElementCSS selector or DOM element reference
configRenderConfigOptional 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:

MethodReturnsDescription
getInstanceId()stringUnique instance identifier
getState()ComponentStateCurrent lifecycle state
destroy()voidTear down iframe, listeners, and transition to DESTROYED
updateTheme(theme)voidPush a partial theme update to this instance
authenticate(config?)Promise<void>Trigger re-authentication. Optional { timeout } in ms
sendToIframe(type, payload?)voidSend 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

MethodReturnsDescription
getConfig()VisaAcceptanceConfig | nullCurrent global config snapshot
getEnvironment()EnvironmentAuto-detected: 'local' | 'dev' | 'cte' | 'prod'
getVersion()stringSDK semver string
getInstances()EmbeddedInstance[]All currently mounted instances
destroyAll()voidDestroy all instances and reset state

Testing Helpers

These methods are available in all environments but intended for development and testing only.

MethodDescription
init({ noAuth: true })Bypass authentication for all components (sandbox mode)
render(component, container, { noAuth: true })Bypass auth for a single component

On this page