createComponent()

createComponent() is called by merchant applications to create and display payment or card binding component UIs.

Notes:

Method signature

copy
Future<void> createComponent(
  String paymentSessionData,
  void Function(AMSStatusResult) onResult,
)

Parameters

Parameter

Data type

Is required?

Description

paymentSessionData

String

Yes

Payment session data. Pass the complete paymentSessionData value obtained from the createPaymentSession (One-time Payments) API response into this parameter.

Notes:

  • In the Payment Element scenario, this parameter is required.
  • Either this parameter or vaultSessionData must be provided.

vaultSessionData

String

Yes

Vaulting session data. Pass the complete vaultingSessionData value obtained from the createVaultingSession API response into this parameter.

Notes:

  • In the Vaulting Element scenario, this parameter is required.
  • Either this parameter or paymentSessionData must be provided.

onResult

Function

Yes

Initialization result callback function. Used to return the result of successful or failed initialization. Refer to onResult for details.

onResult

The result callback from the createComponent() method receives an AMSStatusResult object indicating whether the initialization was successful.

Parameter

Data type

Is required?

Description

result

AMSStatusResult

Yes

Status results containing initialization status and error details.

Return value

This method returns no value, and the initialization result is returned asynchronously through the onResult callback.

Error codes

Error messages are returned via AMSStatusResult in the onResult callback. When getStatus() returns FAIL , you can obtain error details through getError().

code

status

Suggested prompt to the buyer (message)

Description

Further action

INQUIRY_PAYMENT_SESSION_FAILED

FAIL

The order status is abnormal. Please check the payment status and contact the merchant.

The payment session has expired.

The order has timed out and been closed. Use a new paymentRequestId to initiate the payment again.

PARAM_INVALID

N/A

An error occurred. The transaction cannot be initiated.

SDK input parameters are abnormal.

Integration code exception. Troubleshoot yourself required. If the problem persists, contact Antom Technical Support.

UI_STATE_ERROR

N/A

An error occurred. The transaction cannot be initiated.

Abnormal timing when creating SDK instances or createComponent().

Integration code exception. Troubleshoot yourself required. If the problem persists, contact Antom Technical Support.

INITIALIZE_WEB_TIMEOUT

N/A

An error occurred. The transaction cannot be initiated.

The checkout page static resource loading had timed out.

Buyer network exception or Antom service exception detected. Retry the createComponent() method.