Accept payments with EasySafePay (SDK)
Antom EasySafePay is a minimalist payment solution focused on small-amount, high-frequency payment scenarios. With its innovative "bind payment method upon first payment" design and one-click payment feature, it significantly simplifies the payment process. Buyers can choose to pay directly or perform payment method binding during the first transaction, and subsequent payments can be processed instantly without repeated verification.
This solution leverages industry-leading intelligent risk control systems, dynamic polling technology, and payment failure recovery strategies to ensure transaction security while achieving top-tier payment success rates in the industry. It creates a win-win-win scenario for buyer payment experience, merchant conversion rates, and platform ecosystem value.
Web/WAP
User experience
Through simple browser integration, you can quickly enable digital wallet and online banking payment functionalities.



Different payment methods vary in their browser-side user experience. For specific interaction differences, refer to the table below:
Digital wallet
In the digital wallet payment scenario, the system will guide the buyer to complete the transaction on the merchant's page or within the payment method app after the buyer confirms the payment. The first payment verification and subsequent simplified payment process are illustrated as follows:
First payment
The first payment requires security authentication. Once authorized, the buyer will be enabled for password-free payments on subsequent transactions.

Subsequent payments
Subsequent payments will be processed automatically upon order submission, without requiring password entry.

Online banking
The online banking process is illustrated as follows, including first payment authentication and subsequent simplified payment flows.
First payment
The first payment requires security authentication. Once authorized, the buyer will be enabled for password-free payments on subsequent transactions.

Subsequent payments
Subsequent payments will be processed automatically upon order submission, without requiring password entry.

Payment flow
First payment
The first payment flow chart:

- The buyer enters the checkout page.
- Create a payment session request.
After the buyer selects a payment method and submits the order, you can obtain the payment session by calling the createPaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session and the SDK will automatically collect payment elements, render the payment interface, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. For detailed interaction differences across payment methods, refer to the User experience table. - Obtain the authorization result.
When the authorization is successful, Antom sends you the asynchronous notification through the notifyAuthorization API. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Subsequent payments
The subsequent payment flow chart:

- The buyer enters the checkout page.
- Create a payment session request.
After the buyer selects a payment method and submits the order, you can obtain the payment session by calling the createPaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session and the SDK will automatically collect payment elements, render the payment interface, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. For detailed interaction differences across payment methods, refer to the User experience table. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Integration preparations
Before you start integrating, read the Integration Guide and API Overview documents to understand the integration steps of the server-side API and the precautions for calling the API. Furthermore, ensure that the following prerequisites are met:
- Obtain a client ID
- Complete the key configuration
- Complete the configuration of paymentNotifyUrl to receive the asynchronous notification
- Integrate the server-side SDK package, install the server-side library, and initialize a request instance. For more details, refer to Server-side SDKs.
- If you need to conduct joint debugging by connecting the sandbox with the production environment, please contact Antom technical support at least two business days in advance to request configuration. The sandbox environment and production environment require separate configuration.
Integration steps
Start your integration by taking the following steps:
- (Optional) Preload the SDK
- Create a payment session
- Invoke the SDK
- Obtain the authorization and payment result
(Optional) Step 1: Preload the SDK Client-side
Preloading the SDK during the checkout page initialization significantly improves the rendering performance with no negative impact. It is recommended to trigger preloading of the SDK when the buyer selects a payment method.
Follow the code example below to perform the preloading:
Step 2: Create a payment session Server-side
When a buyer selects a payment method provided by Antom, you need to collect essential information including the payment request ID, order amount, payment method, order description, payment redirect page URL, and payment result notification URL.
Call the createPaymentSession (EasySafePay) API to create a payment session and initialize the Antom SDK using the paymentSessionData value returned in the response.
The table below lists the parameter specifications for calling the createPaymentSession (EasySafePay) API during the first and subsequent payments:
Note: For subsequent payments with Express Bank Transfer, simply keep the parameters consistent with the first payment. The buyer can open the Express Bank Transfer webpage and enter the phone number to proceed directly with the payment.
The parameter format for the buyer's payment account for each payment method is as follows:
During the first-time payment, passing the buyer's payment account will auto-fill the buyer's account on the payment page, eliminating manual input. Below is a comparison of the user experience with and without these fields:
With account parameter passed
Login account input is not required.

Without account parameter passed
Manual input of login account is required.

Below are code examples for first and subsequent payments.
First payment
The following code shows a sample of the request message:
The following code shows a sample of the response message:
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId and authstate value.
Subsequent payments
The following code shows a sample of the request message:
The following code shows a sample of the response message:
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId value.
Common questions
Q: Can I use Chinese characters in the value of the request parameters?
A: To avoid incompatibility of a certain payment method, do not use Chinese characters for parameters in the request.
Q: How to set the URL to receive the payment notification?
A: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to receive the asynchronous notification about the payment result (notifyPayment), or configure the receiving URL in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence.
Q: What is the difference between paymentAmount and orderAmount?
A: paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
A: paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
Q: What does paymentSessionExpiryTime specifically refer to in payment requests?
A: paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
A: paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
Q: Which parameters should be prioritized in the response message?
A: Pay attention to the following key parameters:
A: Pay attention to the following key parameters:
- result.resultStatus: Indicates the result of the API call.
- paymentSessionData: Encrypted payment session data, which is passed to the frontend for initializing the Antom SDK.
- paymentSessionExpiryTime: Expiration timestamp of the payment session.
Step 3: Invoke the SDK Client-side
After obtaining the paymentSessionData value on the merchant server side, the merchant client can invoke the SDK to redirect the checkout page to the payment method authorization page. When the buyer submits a payment request, the SDK will automatically handle encrypted communication, risk control verification, page redirection, and payment instruction execution, enabling an end-to-end payment authorization process.
1. Instantiate the SDK
- Use AMSEasyPayto create the SDK instance. The configuration object includes the following parameters:
The following sample code shows how to instantiate the SDK using npm or CDN:
npm
CDN
- Use createComponentin the instance object to create a payment component. The parameters involved are as follows:
The following sample code shows how to create the component:
The images below show the rendering effect when the SDK redirects the checkout page to the payment method authorization page:

Web
The image below shows the redirection from the merchant checkout page to the payment method page.

WAP
The image below shows the merchant checkout page launches a half-screen pop-up or redirects to the digital wallet app.

2. Handle SDK callback event codes
Below are the event codes returned by
onEventCallback
and handling recommendations:The following sample code shows how to handle the callback function:
3. Free SDK component resources
Call the
unmount
method to free SDK component resources in the following situations:- When the buyer switches views to exit the checkout page, free the component resources created in the createPaymentSession (EasySafePay) API.
- When the buyer initiates multiple payments, free the component resources created in the previous createPaymentSession (EasySafePay) API.
- After obtaining the final payment result, free the component resources.
The following sample code shows how to free components:
Common questions
Q: Can an
A: No. If you need to initiate a new payment, you need to create a new
AMSEasyPay
instance execute createComponent
multiple times?A: No. If you need to initiate a new payment, you need to create a new
AMSEasyPay
instance.Q: Are SDK calls required for both first and subsequent payments?
A: Yes.
A: Yes.
iOS
User experience
This iOS integration guide is designed to help you quickly integrate the digital wallet and online banking payment functions within the app and easily complete the payment interface rendering.




The user experience of each payment method on the iOS side varies; refer to the table below for specific interaction experiences:
Digital wallet
Below is the user experience for first and subsequent payments using digital wallets.
First payment
Upon the first payment, the buyer can choose to pay immediately or complete the authorization process. After successful authorization, subsequent payments will be processed by the password-free feature.
Pay on the merchant page

Pay on the payment method app

Subsequent payments
Subsequent payments are processed without requiring a password upon order submission.

Online banking
Below is the user experience for first and subsequent payments using online banking payment methods.
First payment
Upon the first payment, the buyer can choose to pay immediately or complete the authorization process. After successful authorization, subsequent payments will be processed by the password-free feature.

Subsequent payments
Subsequent payments are processed without requiring a password upon order submission.

Payment flow
First payment
The first payment flow chart:

- The buyer enters the checkout page.
- Create a payment session request.
After the buyer selects a payment method and submits the order, you can obtain the payment session by calling the createPaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session and the SDK will automatically collect payment elements, render the payment interface, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. For detailed interaction differences across payment methods, refer to the User experience table. - Obtain the authorization result.
When the authorization is successful, Antom sends you the asynchronous notification through the notifyAuthorization API. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Subsequent payments
The subsequent payment flow chart:

- The buyer enters the checkout page.
- Create a payment session request.
After the buyer selects a payment method and submits the order, you can obtain the payment session by calling the createPaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session and the SDK will automatically collect payment elements, render the payment interface, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. For detailed interaction differences across payment methods, refer to the User experience table. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Integration preparations
Before you start integrating, read the Integration Guide and API Overview documents to understand the integration steps of the server-side API and the precautions for calling the API. Furthermore, ensure that the following prerequisites are met:
- Obtain a client ID
- Complete the key configuration
- Complete the configuration of paymentNotifyUrl to receive the asynchronous notification
- Integrate the server-side SDK package, install the server-side library, and initialize a request instance. For more details, refer to Server-side SDKs.
- If you need to conduct joint debugging by connecting the sandbox with the production environment, please contact Antom technical support at least two business days in advance to request configuration. The sandbox environment and production environment require separate configuration.
Integration steps
Start your integration by taking the following steps:
- (Optional) Preload the SDK
- Create a payment session
- Invoke the SDK
- Obtain the authorization and payment result
(Optional) Step 1: Preload the SDK Client-side
Preloading the SDK during the checkout page initialization significantly improves the rendering performance with no negative impact. It is recommended to trigger preloading of the SDK when the buyer selects a payment method.
Follow the code example below to perform the preloading:
Step 2: Create a payment session Server-side
When a buyer selects a payment method provided by Antom, you need to collect essential information including the payment request ID, order amount, payment method, order description, payment redirect page URL, and payment result notification URL.
Call the createPaymentSession (EasySafePay) API to create a payment session and initialize the Antom SDK using the paymentSessionData value returned in the response.
The table below lists the parameter specifications for calling the createPaymentSession (EasySafePay) API during the first and subsequent payments:
Note: For subsequent payments with Express Bank Transfer, simply keep the parameters consistent with the first payment. The buyer can open the Express Bank Transfer webpage and enter the phone number to proceed directly with the payment.
The parameter format for the buyer's payment account for each payment method is as follows:
During the first-time payment, passing the buyer's payment account will auto-fill the buyer's account on the payment page, eliminating manual input. Below is a comparison of the user experience with and without these fields:
With account parameter passed
Login account input is not required.

Without account parameter passed
Manual input of login account is required.

Below are code examples for first and subsequent payments.
First payment
The following code shows a sample of the request message:
The following code shows a sample of the response message:
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId and authstate value.
Subsequent payments
The following code shows a sample of the request message:
The following code shows a sample of the response message:
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId value.
Common questions
Q: Can I use Chinese characters in the value of the request parameters?
A: To avoid incompatibility of a certain payment method, do not use Chinese characters for parameters in the request.
Q: How to set the URL to receive the payment notification?
A: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to receive the asynchronous notification about the payment result (notifyPayment), or configure the receiving URL in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence.
Q: What is the difference between paymentAmount and orderAmount?
A: paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
A: paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
Q: What does paymentSessionExpiryTime specifically refer to in payment requests?
A: paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
A: paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
Q: Which parameters should be prioritized in the response message?
A: Pay attention to the following key parameters:
A: Pay attention to the following key parameters:
- result.resultStatus: Indicates the result of the API call.
- paymentSessionData: Encrypted payment session data, which is passed to the frontend for initializing the Antom SDK.
- paymentSessionExpiryTime: Expiration timestamp of the payment session.
Step 3: Invoke the SDK Client-side
After obtaining the paymentSessionData value on the merchant server side, the merchant client can invoke the SDK to redirect the checkout page to the payment method authorization page. When the buyer submits a payment request, the SDK will automatically handle encrypted communication, risk control verification, page redirection, and payment instruction execution, enabling an end-to-end payment authorization process.
1. Instantiate the SDK
- Use AMSEasyPayConfigurationto create the SDK instance. The configuration object includes the following parameters:
- Create an instance of the AMSPaymentProtocol API to process the payment callback result, which includes the following method:
The following sample code shows how to instantiate the SDK:
The following image shows the rendering effect of the merchant checkout page invoking a half-screen pop-up or redirecting to the digital wallet app:

- Use the createComponentmethod in the instance object to create a payment component, which includes the following parameter:
The sample code is as follows:
2. Handle SDK callback event codes
Below are the event codes returned by
onEventCallback
and handling recommendations:The following sample code shows how to handle the callback function:
3. Free SDK component resources
Call the
onDestroy
method to free SDK component resources in the following situations:- When the buyer exits the checkout page, completely free the component resources created in the createPaymentSession (EasySafePay) API.
- When the buyer initiates multiple payments, and the parameters in initConfigurationhave changed, free the component resources created in the previous createPaymentSession (EasySafePay) API.
In the following scenario, you do not need to call
onDestroy
, and the SDK will automatically free partial resources (for iOS SDK AMSComponents 1.33.0 or above).- When the buyer initiates multiple payments, and the parameters in initConfigurationhave not changed. The SDK will automatically free partial resources after the payment is completed to reset to the state beforecreateComponentwas called.
The following sample code shows how to free components:
Common questions
Q: Is it mandatory to handle SDK callback events?
A: For Alipay, you must process event codes to display payment results, but this payment method is optional. Callback events can also be used for logging.
A: For Alipay, you must process event codes to display payment results, but this payment method is optional. Callback events can also be used for logging.
Q: Can an AMSEasypay instance execute createComponent multiple times?
A: No. You need to create a freshAMSEasypay instance to initiate a new payment.
A: No. You need to create a freshAMSEasypay instance to initiate a new payment.
Q: Are SDK calls required for both first-time and subsequent payments?
A: Yes.
A: Yes.
4. Receive notification from callback function (When integrating Alipay)
When integrating with Alipay, the merchant-client can receive notifications from the callback function. After receiving the callback notification, use the
openURL
method in the AppDelegate file to handle the result returned by Alipay:- Use canProcessOrderWithPaymentResult()to check whether the redirect URL, to redirect from the wallet to the merchant side, is valid.
- Use processOrderWithPaymentResult()to handle the redirection from the wallet to the merchant's side.
Android
User experience
This Android integration guide is designed to help you quickly integrate the digital wallet and online banking payment functions within the app and easily complete the payment interface rendering.




The user experience of each payment method on the Android side varies; refer to the table below for specific interaction experiences:
Digital wallet
Below is the user experience for first and subsequent payments using digital wallets.
First payment
Upon the first payment, the buyer can choose to pay immediately or complete the authorization process. After successful authorization, subsequent payments will be processed by the password-free feature.
Pay on the merchant page

Pay on the payment method app

Subsequent payments
Subsequent payments are processed without requiring a password upon order submission.

Online banking
Below is the user experience for first and subsequent payments using online banking payment methods.
First payment
Upon the first payment, the buyer can choose to pay immediately or complete the authorization process. After successful authorization, subsequent payments will be processed by the password-free feature.

Subsequent payments
Subsequent payments are processed without requiring a password upon order submission.

Payment flow
First payment
The first payment flow chart:

- The buyer enters the checkout page.
- Create a payment session request.
After the buyer selects a payment method and submits the order, you can obtain the payment session by calling the createPaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session and the SDK will automatically collect payment elements, render the payment interface, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. For detailed interaction differences across payment methods, refer to the User experience table. - Obtain the authorization result.
When the authorization is successful, Antom sends you the asynchronous notification through the notifyAuthorization API. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Subsequent payments
The subsequent payment flow chart:

- The buyer enters the checkout page.
- Create a payment session request.
After the buyer selects a payment method and submits the order, you can obtain the payment session by calling the createPaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session and the SDK will automatically collect payment elements, render the payment interface, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. For detailed interaction differences across payment methods, refer to the User experience table. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Integration preparations
Before you start integrating, read the Integration Guide and API Overview documents to understand the integration steps of the server-side API and the precautions for calling the API. Furthermore, ensure that the following prerequisites are met:
- Obtain a client ID
- Complete the key configuration
- Complete the configuration of paymentNotifyUrl to receive the asynchronous notification
- Integrate the server-side SDK package, install the server-side library, and initialize a request instance. For more details, refer to Server-side SDKs.
- If you need to conduct joint debugging by connecting the sandbox with the production environment, please contact Antom technical support at least two business days in advance to request configuration. The sandbox environment and production environment require separate configuration.
Integration steps
Start your integration by taking the following steps:
- (Optional) Preload the SDK
- Create a payment session
- Invoke the SDK
- Obtain the authorization and payment result
(Optional) Step 1: Preload the SDK Client-side
Preloading the SDK during the checkout page initialization significantly improves the rendering performance with no negative impact. It is recommended to trigger preloading of the SDK when the buyer selects a payment method.
Follow the code example below to perform the preloading:
Step 2: Create a payment session Server-side
When a buyer selects a payment method provided by Antom, you need to collect essential information including the payment request ID, order amount, payment method, order description, payment redirect page URL, and payment result notification URL.
Call the createPaymentSession (EasySafePay) API to create a payment session and initialize the Antom SDK using the paymentSessionData value returned in the response.
The table below lists the parameter specifications for calling the createPaymentSession (EasySafePay) API during the first and subsequent payments:
Note: For subsequent payments with Express Bank Transfer, simply keep the parameters consistent with the first payment. The buyer can open the Express Bank Transfer webpage and enter the phone number to proceed directly with the payment.
The parameter format for the buyer's payment account for each payment method is as follows:
During the first-time payment, passing the buyer's payment account will auto-fill the buyer's account on the payment page, eliminating manual input. Below is a comparison of the user experience with and without these fields:
With account parameter passed
Login account input is not required.

Without account parameter passed
Manual input of login account is required.

Below are code examples for first and subsequent payments.
First payment
The following code shows a sample of the request message:
The following code shows a sample of the response message:
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId and authstate value.
Subsequent payments
The following code shows a sample of the request message:
The following code shows a sample of the response message:
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId value.
Common questions
Q: Can I use Chinese characters in the value of the request parameters?
A: To avoid incompatibility of a certain payment method, do not use Chinese characters for parameters in the request.
Q: How to set the URL to receive the payment notification?
A: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to receive the asynchronous notification about the payment result (notifyPayment), or configure the receiving URL in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence.
Q: What is the difference between paymentAmount and orderAmount?
A: paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
A: paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
Q: What does paymentSessionExpiryTime specifically refer to in payment requests?
A: paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
A: paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
Q: Which parameters should be prioritized in the response message?
A: Pay attention to the following key parameters:
A: Pay attention to the following key parameters:
- result.resultStatus: Indicates the result of the API call.
- paymentSessionData: Encrypted payment session data, which is passed to the frontend for initializing the Antom SDK.
- paymentSessionExpiryTime: Expiration timestamp of the payment session.
Step 3: Invoke the SDK Client-side
After obtaining the paymentSessionData value on the merchant server side, the merchant client can invoke the SDK to redirect the checkout page to the payment method authorization page. When the buyer submits a payment request, the SDK will automatically handle encrypted communication, risk control verification, page redirection, and payment instruction execution, enabling an end-to-end payment authorization process.
1. Instantiate the SDK
- Use AMSEasyPayConfigurationto create the SDK instance. The configuration object includes the following parameters:
- Create an instance of the setOnCheckoutListener API to handle corresponding events that occur in subsequent processes, which include the following method:
The following sample code shows how to instantiate the SDK:
The following image shows the rendering effect of the merchant checkout page invoking a half-screen pop-up or redirecting to the digital wallet app:

- Use the createComponentmethod in the instance object to create a payment component, which includes the following parameter:
The sample code is as follows:
2. Handle SDK callback event codes
Below are the event codes returned by
onEventCallback
and handling recommendations:Note: In the Android Native environment, Alipay only supports redirecting to the merchant app's launch page, rather than the paymentRedirectUrl specified in the createPaymentSession (EasySafePay) API. The specific redirect page needs to be controlled through the event code.
The following sample code shows how to handle the callback function:
3. Free SDK component resources
Call the
onDestroy
method to free SDK component resources in the following situations:- When the buyer exits the checkout page, completely free the component resources created in the createPaymentSession (EasySafePay) API.
- When the buyer initiates multiple payments, and the parameters in AMSEasyPayConfigurationhave changed, free the component resources created in the previous createPaymentSession (EasySafePay) API.
In the following scenario, you do not need to call
onDestroy
, and the SDK will automatically free partial resources (for SDK 1.33.0 or above).- When the buyer initiates multiple payments, and the parameters in AMSEasyPayConfigurationhave not changed. The SDK will automatically free partial resources after the payment is completed to reset to the state beforecreateComponentwas called.
The following sample code shows how to free components:
Common questions
Q: Is it mandatory to handle SDK callback events?
A: For Alipay, you must process event codes to display payment results, but this payment method is optional. Callback events can also be used for logging.
A: For Alipay, you must process event codes to display payment results, but this payment method is optional. Callback events can also be used for logging.
Q: Can an AMSEasypay instance execute createComponent multiple times?
A: No. You need to create a freshAMSEasypay instance to initiate a new payment.
A: No. You need to create a freshAMSEasypay instance to initiate a new payment.
Q: Are SDK calls required for both first-time and subsequent payments?
A: Yes.
A: Yes.
WebView
User experience
The following screenshots show the user experience of wallet and bank transfer respectively:
Digital wallet
In the digital wallet payment scenario, the system will guide the buyer to complete the transaction on the merchant's page or within the payment method app after the buyer confirms the payment. The first payment verification and subsequent simplified payment process are illustrated as follows:
First payment
The first payment requires security authentication. Once authorized, the buyer will be enabled for password-free payments on subsequent transactions.
Pay on the merchant page

Pay on the payment method app

Subsequent payments
Subsequent payments are processed without requiring a password upon order submission.

Online banking
Below is the user experience for first and subsequent payments using online banking payment methods.
First payment
For the first payment, the buyer completes the payment authorization process to enable subsequent password-free payments.

Subsequent payments
Subsequent payments are processed without requiring a password upon order submission.

Payment flow
The following are flow chart for the first payment and subsequent payment:
First payment

- The buyer enters the checkout page.
- Preload the Antom SDK when the buyer chooses a payment method.
- Create a payment session request.
After the buyer submits the order, you can obtain the payment session by calling thecreatePaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session on the client side and the SDK will automatically collect payment elements, Display the payment page, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. - Obtain the authorization result.
When the authorization is successful, Antom sends you the asynchronous notification through thenotifyAuthorization API. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Subsequent payments

- The buyer enters the checkout page.
- Preload the Antom SDK when the buyer chooses a payment method.
- Create a payment session request.
After the buyer submits the order, you can obtain the payment session by calling thecreatePaymentSession (EasySafePay) API. - Invoke the client SDK.
Invoke the SDK using a payment session on the client side and the SDK will automatically collect payment elements, Display the payment page, handle page redirections, and guide buyers through payment completion based on the specific payment method's characteristics. - Obtain the payment result.
Obtain the payment result using one of the following methods:
- Asynchronous notification: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom will use notifyPayment to send asynchronous notifications to you.
- Synchronous inquiry: Call the inquiryPayment API to check the real-time payment status.
Integration preparations
Before you start integrating, read the Integration Guide and API Overview documents to understand the integration steps of the server-side API and the precautions for calling the API. Furthermore, ensure that the following prerequisites are met:
- Obtain a client ID
- Complete the key configuration
- Complete the configuration of paymentNotifyUrl to receive the asynchronous notification
- Integrate the server-side SDK package, install the server-side library, and initialize a request instance. For more details, refer to Server-side SDKs.
- If you need to conduct joint debugging by connecting the sandbox with the production environment, please contact Antom technical support at least two business days in advance to request configuration. The sandbox environment and production environment require separate configuration.
Version Requirements
- iOS:
- Install Xcode 12 or later.
- Compatible with iOS 11 or later.
- Android:
- Compatible with Android 4.4 (API level 19) or later.
Note: Flutter and React Native (RN) development frameworks are not currently supported.
Integration steps
Start your integration by taking the following steps:
- (Optional) Preload the SDK
- Create a payment session
- Invoke the SDK
- Obtain the authorization and payment result
(Optional) Step 1: Preload the SDK Client-side
Preloading the SDK during the checkout page initialization significantly improves the rendering performance with no negative impact. It is recommended to trigger preloading of the SDK when the buyer selects a payment method.
Follow the code example below to perform the preloading:
Step 2: Create a payment session Server-side
Call the createPaymentSession (EasySafePay) API to create a payment session and initialize the Antom SDK using the paymentSessionData value returned in the response.
The table below lists the parameter specifications for calling the createPaymentSession (EasySafePay) API during the first and subsequent payments:
Note: For subsequent payments with Express Bank Transfer, simply keep the parameters consistent with the first payment. The buyer can open the Express Bank Transfer webpage and enter the phone number to proceed directly with the payment.
The parameter format for the buyer's payment account for each payment method is as follows:
Below are code examples for first and subsequent payments.
First payment
The following code shows a sample of the request message:
The following code shows a sample of the response message, including the following key parameters:
- paymentSessionData: Encrypted payment session data. This data is passed to the frontend for invoking the Antom SDK.
- paymentSessionExpiryTime: Expiration time of the payment session.
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId and authstate value.
Subsequent payments
The following code shows a sample of the request message:
The following code shows a sample of the response message, including the following key parameters:
- paymentSessionData: Encrypted payment session data. This data is passed to the frontend for invoking the Antom SDK.
- paymentSessionExpiryTime: Expiration time of the payment session.
Please take the next step according to the value of the result.resultStatus.
Note: If you do not receive a response, it may be due to a network timeout. Please retry the API call with a new paymentRequestId value.
Common questions
Q: Can I use Chinese characters in the value of the request parameters?
A: To avoid incompatibility of a certain payment method, do not use Chinese characters for parameters in the request.
Q: How to set the URL to receive the payment notification?
A: Specify paymentNotifyUrl in the createPaymentSession (EasySafePay) API to receive the asynchronous notification about the payment result (notifyPayment), or configure the receiving URL in Antom Dashboard. If the URL is specified in both the request and Antom Dashboard, the value specified in the request takes precedence.
Q: What is the difference between paymentAmount and orderAmount?
A:paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
A:paymentAmount refers to the payment amount, while orderAmount refers to the order amount. The actual charged amount is determined by paymentAmount.
Q: What does paymentSessionExpiryTime specifically refer to in payment requests?
A:paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
A:paymentSessionExpiryTime indicates the validity period from successful payment session creation until the buyer submits the payment. After submission, the payment processing timeout is 10 minutes. Therefore, the maximum total duration from session creation to payment completion is 1 hour and 10 minutes.
Step 3: Invoke the SDK Server-side
After obtaining the paymentSessionData value on the merchant server side, the merchant client can invoke the SDK to redirect the checkout page to the payment method authorization page. When the buyer submits a payment request, the SDK will automatically handle encrypted communication, risk control verification, page redirection, and payment instruction execution, enabling an end-to-end payment authorization process.
1. Instantiate the SDK
- Use AMSEasyPayto create the SDK instance. The configuration object includes the following parameters:
The following sample code shows how to instantiate the SDK using npm or CDN:
npm
CDN
- Use createComponentin the instance object to create a payment component. The parameters involved are as follows:
The following sample code shows how to create the component:
- Listen for event code to handle redirection events.
By monitoring the
SDK_REDIRECT
event code, you can handle the subsequent process. An example code snippet is shown below:- Handle redirection events using a WebView container.
Use a WebView container to manage in-app redirection events. The following are sample codes for iOS and Android respectively:
iOS
Android
2. Handle SDK callback event codes
Below are the event codes returned by
onEventCallback
and handling recommendations:The following sample code shows how to handle the callback function:
3. Free SDK component resources
Call the
unmount
method to free SDK component resources in the following situations:- When the buyer switches views to exit the checkout page, free the component resources created in the createPaymentSession (EasySafePay) API.
- When the buyer initiates multiple payments, free the component resources created in the previous createPaymentSession (EasySafePay) API.
- After obtaining the final payment result, free the component resources.
The following sample code shows how to free components:
Common questions
Q: Is it mandatory to handle SDK callback events?
A: Perform the following operations based on the value ofisNativeAppWebview:
A: Perform the following operations based on the value ofisNativeAppWebview:
- When isNativeAppWebview is true, you need to handle SDK callback events. They are generally categorized into two types:
- Key callbacks (e.g., payment redirect SDK_REDIRECT): Must be handled, otherwise the payment process will be interrupted.
- Other callbacks: Optional handling. You may use these callback events for logging or tracking purposes.
- When isNativeAppWebviewisfalse, callback handling is optional. You may use the callback events for logging or tracking purposes.
Q: Can an AMSEasyPay instance execute createComponent multiple times?
A: No. If you need to initiate a new payment, you need to create a newAMSEasyPay instance.
A: No. If you need to initiate a new payment, you need to create a newAMSEasyPay instance.
Q: Are SDK calls required for both first and subsequent payments?
A: Yes.
A: Yes.
Step 4: Obtain authorization and payment result Client-side
For the first payment, you can obtain both the authorization and payment results, while for subsequent payments, only the payment result is available. Below are common scenarios:
Obtain the authorization result
Obtain the authorization result
When the authorization is successful during the first payment, Antom sends you the asynchronous notification through the notifyAuthorization API.
- Follow the steps below to set the notification webhook URL:
Log in to Antom Dashboard > Developer > Notification URL. Add the notification URL to alipay.ams.authorizations.notify. Refer to Notification URL for detailed steps.
The following code shows a sample of the asynchronous authorization notification request:
Based on the value of result.resultStatus in the authorization result notification request (only
S
is returned), process as follows:S
: Indicates successful authorization, and the following parameters are returned:The table below shows the token validity period for each payment method:
- The result notification sent by Antom is signed by Antom, it is recommended that you verify the signature to confirm that the notification was sent by Antom. Refer to the following code example to verify the notification:
- After receiving the notification, whether the authorization is successful or not, you are not required to sign the response, but each notification request must be responded to in the format specified below. Otherwise, Antom will resend the asynchronous notification.
Obtain the payment result
Obtain the payment result
After the first or subsequent payment is completed, you can obtain the payment result through one of the following methods:
- Receive the asynchronous notification: Receive the payment result delivered by the Antom server.
- Inquire about the result: Call inquiryPayment API to query payment status.
Receive the asynchronous notification
- Follow the steps below to set the notification webhook URL:
When the payment reaches a final status of success or failure, Antom sends an asynchronous notification to your configured webhook URL. You can choose one of the following two methods to set up the Webhook URL for receiving notifications:
- Order-level notification configuration: Specify an independent notification URL for each order through the paymentNotifyUrl parameter in the createPaymentSession (EasySafePay) API request.
- Merchant-level notification configuration: Log in to Antom Dashboard > Developer > Notification URL and add a notification URL for the alipay.ams.payments.payNotify API. For specific operations, refer to Notification URL.
Note: If you have configured notification URLs through both methods mentioned above, the API settings will take precedence.
The following code shows a sample of the notification request:
The table below displays the possible values returned in the resultStatus parameter of the response. Please follow the corresponding instructions for handling:
- The result notification sent by Antom is signed by Antom, it is recommended that you verify the signature to confirm that the notification was sent by Antom. Refer to the following code example to verify the notification:
- After receiving the notification, you are not required to sign the response, but must reply to every notification request in the following standardized format, regardless of whether the payment was successful or not.
Inquire about the payment result
Call the inquiryPayment API to initiate a query on the payment result. The payment status can be checked via polling or scheduled tasks after the payment is initiated.
The following code shows a sample of the request message:
The following code shows a sample of the response message:
The table below displays the possible values returned in the paymentStatus parameter of the response. Please follow the corresponding instructions for handling:
Common questions
Q: When is the payment notification sent?
A: It depends on whether the payment is completed: If the payment is successfully completed, Antom usually sends an asynchronous notification within 3 to 5 seconds.
Q: Is there an asynchronous notification sent for authorization failure?
A: No. An asynchronous notification will only be sent if the authorization is successful; there will be no notification returned for authorization failure.
Q: Will the asynchronous notification be re-sent?
A: Yes, the asynchronous notification will be re-sent automatically within 24 hours for the following cases:
- If you didn't receive the asynchronous notification due to network reasons.
- If you receive an asynchronous notification from Antom, but you didn't make a response to the notification in the sample code format of Process the notification.
The notification can be resent up to 8 times or until a correct response is received to terminate delivery. The sending intervals are as follows: 0 minutes, 2 minutes, 10 minutes, 10 minutes, 1 hour, 2 hours, 6 hours, and 15 hours.
Q: Are the authorization notification and payment result notification sent separately, and will the authorization notification always be received before the payment result notification?
A: Due to the uncontrollable nature of network stability, it is possible for the authorization notification to arrive later than the payment result notification.
Q: Is authorization result inquiry supported?
A: Currently, calling an interface to query the authorization result is not supported.
Q: When responding to an asynchronous notification, do I need to add a digital signature?
A: No. If you receive an asynchronous notification from Antom, you are required to return the response in the sample code format of Process the notification, but you do not need to countersign the response.
After payments
Revoke authorization
After authorization is completed, the buyer can revoke the authorization from either the merchant side or the payment method side. Once revoked, the original authorization token immediately becomes invalid and cannot be used for payments again. For details, refer to Revoke.
Cancel
You can cancel orders through the cancel API within the time window (by D+1 day 00:15 GMT+8). For details, refer to Cancel.
Refund
Reconciliation
After a transaction is completed, use the provided Antom financial reports to perform reconciliation. For settlement rules and reconciliation operations, refer to Reconciliation.
Best practices
Antom provides you with the following best practice solutions. Refer to Best practices for more details.
- Intelligent risk control service
- Security expansion package
- Order query after redirecting to the merchant result page
- Merchant-initiated transaction cancellation
- Payment failure retry