antom.createElement()

antom.createElement() is a factory method. After successfully calling  loadAntom()  to load the SDK and obtain the antom instance, you can use this method to dynamically create the corresponding payment or card binding element instance by passing in the specified elementType.

Method signature

When calling this method, please use the following standard method signature format.

copy
antom.createElement(elementType, options)

Parameters

This method accepts two parameters, which specify the type of element to be created and its configuration.

Parameter

Data type

Required

Description

elementType

String

Yes

Element type, valid values are:

  • CVVUsed to create the CVVElement instance to collect the CVV (Card Verification Value) security code entered by the buyer.
  • vaulting: Used to create the VaultingElement instance to collect the buyer’ credit/debit card information to complete the card-binding process.

options

Object

No

A configuration object used to set the appearance theme and multilingual environment of components.

options

Parameter

Data type

Required

Description

appearance

Object

No

Used for custom appearance configuration. For more information, refer to Appearance customization. It contains the following parameters:

  • theme: Theme color.
  • variables: Override underlying CSS custom properties using CSS design tokens (e.g., color-primary) to implement theme customization.
localeString

No

Multilingual configuration.

Note:

  • If the locale parameter is set in the loadAntom() method, the locale value in the antom.createElement() parameters takes precedence.
  • If the parameter is omitted or contains an unsupported value, the system will default to English.

Valid values are:

  • en_US: Default value. English
  • pt_BR: Portuguese (Brazil)
  • pt_PT: Portuguese
  • es_ES: Spanish
  • ko_KR: Korean
  • zh_CN: Simplified Chinese
  • zh_HK: Traditional Chinese
  • ms_MY: Malay
  • in_ID: Indonesian
  • th_TH: Thai
  • vi_VN: Vietnamese
  • tl_PH: Filipino
  • it_IT: Italian
  • de_DE: German
  • fr_FR: French
  • nl_NL: Dutch
  • ja_JP: Japanese
  • ro: Romanian
  • pl_PL: Polish
  • ar_SA: Arabic
  • tr_TR: Turkish
  • hi_IN: Hindi

Return value

This method returns an element instance object that provides methods for mounting, unmounting, destroying, and updating configurations, enabling flexible management of the component lifecycle on the page.

Function

Description

element.on()

Register event listeners for the Element instance.

element.mount()

Used to mount an element to a specified page node, and can be passed in a specific HTMLElement.

element.unmount()

Unmount the current Element (can be remounted).

element.destroy()

Destroy the current Element (cannot be remounted).

element.updateConfig()

Update the configuration.

Error codes

Use the element.on() method to listen for error codes related to the antom.createElement() method. For a detailed list of error codes, please refer to the Error codes.