Antom, leading provider of tailored payment solutions

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.
JavaScript
javascript
antom.createElement(elementType, options);
TypeScript
typescript
antom.createElement(elementType: ElementType, options?: AppConfig): Element

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:
  • CVV: Used 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.
  • express: Used to create the ExpressElement instance to render the express checkout button on the merchant page.
Object
Yes
A configuration object used to set the appearance theme and multilingual environment of components.

options

Please pass in the corresponding options parameter based on the Element type used and the specific business scenario.
CVV Element or Vaulting Element
When elementType is CVV or vaulting, pass in the following options configuration object.
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.
locale
String
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​
Express
When elementType is express, pass in the following options configuration object.
Parameter
Type
Required
Description
sessionData
String
No
Payment session data.
Note: Required when the payment method is Apple Pay, Google Pay, or Alipay. For PayPal, it is returned by createOrder() on the server side.

Object
No
Payment amount.
Note: Required when the payment method is PayPal.
paymentMethods
Object
No
List of enabled payment methods, which also determines the button rendering order. Valid values are:
  • alipay: Alipay
  • applePay: Apple Pay
  • googlePay: Google Pay
  • paypal: PayPal
Note: This parameter is optional. If it is not passed, no express checkout button will be displayed. To render express checkout buttons, pass in at least one payment method value.
Object
No
PayPal configuration parameters, required when integrating PayPal.
Object
No
Button type for each payment method.
Note: Alipay does not support this parameter.
Object
No
Button color for each payment method.
Note: Alipay does not support this parameter.
buttonHeight
Number
No
Unified button height, in px.

amount

Parameter
Type
Required
Description
currency
String
Yes
A three-letter currency code that follows the ISO 4217 standard.
Note: It must be consistent with the currency used when creating sessionData .
value
String
Yes
The amount value, expressed as a positive integer in the smallest currency unit.

paypal

Parameter
Type
Required
Description
businessDivision
String
Yes
Business division (country/region) identifier.
channelMerchantAccountId
String
Yes
PayPal merchant ID.
createOrder()
Function
Yes
Pass in order information to call the createPaymentSession (One-time Payments) API to create a payment session and obtain the createOrder() required paymentSessionData.
Object
No
Button shape.
Function
No
Shipping address change callback, wheredata is the raw data returned by PayPal.
Function
No
Shipping option change callback, wheredata is the raw data returned by PayPal.
style
Parameter
Type
Required
Description
shape
String
No
Button shape:
  • rect: Rectangular shape
  • pill: Pill shape
  • sharp: Sharp-corner shape

buttonType

Parameter
Type
Required
Description
applePay
String
No
The supported labels for the Apple Pay payment method button include:
  • buy
  • pay
  • plain
  • check-out
  • book
  • donate
  • subscribe
googlePay
String
No
The supported labels for the Google Pay payment method button include:
  • pay
  • book
  • buy
  • checkout
  • donate
  • order
  • plain
  • subscribe
paypal
String
No
The supported labels for the PayPal payment method button include:
  • paypal
  • checkout
  • buynow
  • pay

buttonTheme

Parameter
Type
Required
Description
applePay
String
No
The supported colors for the Apple Pay payment method button include:
  • black
  • white
  • white-outline
googlePay
String
No
The supported colors for the Google Pay payment method button include:
  • black
  • white
paypal
String
No
The supported colors for the PayPal payment method button include:
  • gold
  • blue
  • silver
  • white
  • black

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
Register event listeners for the Element instance.
Used to mount an element to a specified page node, and can be passed in a specific HTMLElement.
Unmount the current Element (can be remounted).
Destroy the current Element (cannot be remounted).
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.