Antom, leading provider of tailored payment solutions

element.updateConfig()

The element.updateConfig() method is used to update part of an Element’s configuration. After it is called, the Element will re-render based on the new configuration passed in, without requiring the instance to be recreated. Configurations that are not passed in will remain unchanged.
Notes:
  • This method is not applicable to CVVElement.
  • In the Express Element scenario, you can update the frontend amount configuration, but changing the currency is not currently supported. After the update, you must call the updatePaymentSession API to synchronize and update the sessionData.

Method signature

When calling this method, please use the following standard method signature format.
JavaScript
javascript
element.updateConfig(newConfig);
TypeScript
typescript
element.updateConfig(newConfig: Partial<VaultingAppConfig>): void

Parameters

Parameter
Data type
Required
Description
Object
Yes
The configuration object used to update the Element.
Note: Dynamically updating sessionData is not supported.

newConfig

Parameter
Type
Required
Description
Object
Yes
Payment amount.

amount

Parameter
Type
Required
Description
currency
String
Yes
A three-letter currency code that follows the ISO 4217 standard.
Note: 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.

Return value

In the Express Element scenario, a Promise is returned. After the Promise resolves, an update result object is returned. When the update fails, the object contains error information to describe the specific error.
Parameter
Type
Required
Description
Object
No
Error information when the update fails.

error

Parameter
Type
Required
Description
String
Yes
Error code.
message
String
Yes
Error message.
source
String
Yes
Error source. Valid values are:
  • SDK_INTERNAL:SDK internal error.
  • SDK_USAGE:SDK usage error.
  • APP_RUNTIME:Merchant application runtime error.
  • SERVER_API:Server API error.
  • SYSTEM:System or browser environment error.
reason
String
Yes
Error reason.

code

code
Description
Next steps
CHECKOUT_NOT_READY
The amount is updated before the checkout is loaded.
Update the amount after the checkout is loaded.
PAYMENT_IN_PROGRESS
The amount is updated during payment.
Update the amount before payment.
AMOUNT_VALUE_INVALID
An invalid amount is passed in.
Pass in a valid amount.
AMOUNT_VALUE_EMPTY
No amount is passed in.
Pass in a valid amount.
AMOUNT_CURRENCY_MISMATCH
A currency inconsistent with sessionData is passed in.
Pass in the same currency as the one used to create sessionData.
AMOUNT_CURRENCY_UNSUPPORTED
An invalid currency is passed in.
Pass in a valid currency.
AMOUNT_PRECISION_UNSUPPORTED
The amount passed in exceeds the supported precision.
Pass in a valid amount.
AMOUNT_RESOLVE_FAILED
Amount conversion failed.
Contact Antom technical support for details.

Best practices

  • Re-rendering: After updating the configuration, the Element will automatically re-render, and buyers may see interface changes.
  • Calling timing: It is recommended to call element.updateConfig() after the Element is mounted. If called before mounting, the updated configuration will take effect upon mounting.
  • Theme switching: When dynamically switching themes, the Element will retain data already entered by the buyer and only update the styles.