APM payments

Checkout Payment provides a comprehensive payment solution for your website and applications, supporting seamless integration of desktop browsers, mobile browsers and other scenarios. With a one-time integration, you can quickly access a variety of online payment methods, including digital wallets, online banking and card payments, effectively reducing the technical barrier. You can choose convenient and secure payment methods according to your personal preferences and enjoy a better payment experience.

User experience

The following figures show the user experience of various payment methods:

Digital wallet owns a system of independent accounts. Buyers can easily complete online or in-store payments by using their accounts, achieving an efficient, secure and convenient payment experience..

image.png

Payment flow

The payment flow of each payment method is composed of the following steps:

APM_en.png

  1. The buyer enters the checkout page.
  2. Create a payment request.
    After the buyer selects a payment method and submits the order, the merchant server calls the pay (Checkout Payment) API to obtain the payment link to complete the payment based on the payment method, amount, and currency.
  3. Handle the payment continuation URL.
    The merchant client redirects to the URL page returned by the payment request, or invokes the relevant application to complete the payment. The payment continuation URL proceeds the payment process with different operations based on the characteristics of payment methods, such as collecting information, redirecting buyers, invoking the app, displaying QR codes, and performing verifications.
  4. Get the payment result.
    The merchant server receives the payment result notification returned by the Antom server, and processes the transaction according to the result. Obtain the payment result using one of the following two methods:
    • Asynchronous notification: Specify the paymentNotifyUrl in the pay (Checkout Payment) API to set the address for receiving asynchronous notifications. When the payment is successful or expires, Antom uses notifyPayment to send asynchronous notifications to you.
    • Synchronous inquiry: Call the inquiryPayment API to check the payment status.

Integration steps

Start your integration by taking the following steps:

  1. Add a list of payment methods
  2. Create a payment order
  3. Get the payment continuation URL
  4. Receive the asynchronous notification

Step 1: Add a list of payment methods Client-side

Display the payment method logos and names you plan to integrate in the payment method list on the buyer's order page, so that buyers can choose according to their needs and preferences.

You can source the logos and names in two ways:

  • RecommendedSelf-obtained: Obtain the logo and name of the payment method through Brand asset. If some payment methods are not available online, contact Antom Technical Support for assistance.
  • Call the consult (Checkout Payment) API: Obtain the payment methods and logoUrl supported by the current transactions based on the currency, transaction initiation terminal type, buyer region, and contracted payment methods.

Notes:

  • The payment method list page needs to be implemented by you.
  • If you manually obtain the logo and its name, skip the following steps and proceed directly with Step 2: Create a payment order.

Antom provides server-side interface libraries in multiple languages. The following code takes Java as an example, refer to Antom SDK for other languages.

1. Install an API library

You can find the latest version on GitHub.

copy
<dependency>
    <groupId>com.alipay.global.sdk</groupId>
    <artifactId>global-open-sdk-java</artifactId>
    <version>{latest_version}</version>
</dependency>

2. Initialize the request instance

Create a singleton resource to make a request to Antom.

copy
import com.alipay.global.api.AlipayClient;
import com.alipay.global.api.DefaultAlipayClient;
import com.alipay.global.api.model.constants.EndPointConstants;

public class Sample {
    public static final String        CLIENT_ID            = "";
    public static final String        ANTOM_PUBLIC_KEY     = "";
    public static final String        MERCHANT_PRIVATE_KEY = "";

    private final static AlipayClient CLIENT               = new DefaultAlipayClient(
            EndPointConstants.SG, MERCHANT_PRIVATE_KEY, ANTOM_PUBLIC_KEY, CLIENT_ID);

}

3. Create a payment consultation request

The following key parameters are included in the request.

Parameter nameIs required?Description

productCode

Yes

In this scenario, the field is fixed to CASHIER_PAYMENT.

paymentFactor.presentmentMode

Yes

In this scenario, the field is fixed to TILE.

paymentAmount

Yes

Payment amount, which is set to the smallest unit of the payment currency.

settlementStrategy.settlementCurrency

Yes

The settlement currency of the payment. If you have signed multiple settlement currencies, you need to specify it in the API.

env.terminalType

Yes

The environment in which the buyer initiates a transaction.

  • WEB: The client terminal type is a website, which is opened through a PC browser.
  • WAP: The client terminal type is the H5 page, which is opened through a mobile browser.
  • APP: The client terminal type is a mobile application.

For more information about the complete parameters, refer to the consult (Checkout Payment) API.

The following code is an example of calling the consult (Checkout Payment) API:

copy
public static void executeConsult() {
        AlipayPayConsultRequest alipayPayConsultRequest = new AlipayPayConsultRequest();
        alipayPayConsultRequest.setProductCode(ProductCodeType.CASHIER_PAYMENT);

        // set amount
        Amount amount = Amount.builder().value("4200").currency("USD").build();
        alipayPayConsultRequest.setPaymentAmount(amount);

        // set env info
        Env env = Env.builder().terminalType(TerminalType.WEB).build();
        alipayPayConsultRequest.setEnv(env);

        AlipayPayConsultResponse alipayPayConsultResponse = null;

        try {
            alipayPayConsultResponse = CLIENT.execute(alipayPayConsultRequest);
        } catch (AlipayApiException e) {
            String errorMsg = e.getMessage();
            // handle error condition
        }
    }

The following code shows a sample of the request message:

copy
{
    "env": {
        "terminalType": "WEB"
    },
    "paymentAmount": {
        "currency": "USD",
        "value": "30000"
    },
    "settlementStrategy": {
        "settlementCurrency": "USD"
    },
    "paymentFactor": {
        "presentmentMode": "TILE"
    },
    "productCode": "CASHIER_PAYMENT"
}

The following key parameters are included in the response message.

Parameter nameDescription

result.resultStatus

Indicates the call status of the consult (Checkout Payment) API.

paymentOptions.enabled

Indicates whether the payment method is available.

paymentOptions.logo.logoName

The logo name of the payment method.

paymentOptions.logo.logoUrl

The logo URL of the payment method.

The following shows a sample of the response message:

copy
{
    "paymentOptions": [
        {
          "enabled": true,
            "logo": {
                "logoName": "FPX",
                "logoUrl": "https://resource.alipayplus.com/storage/ipaymentmngfd5e514400714344/2024/06/13/e08cb444-be0d-45b9-8a8d-44966aad5825.png"
            },
            "paymentMethodCategory": "ONLINE_BANKING",
            "paymentMethodRegion": [
                "MY"
            ],
            "paymentMethodType": "ONLINEBANKING_FPX",
            "preferred": false
        },
      {
            "disableReason": "CURRENT_CHANNEL_NOT_EXIST",
            "enabled": false,
            "logo": {
                "logoName": "Bank of Ayudhya Online Banking",
                "logoUrl": "https://gw.alipay.com/antom/icon/medium/default/BankofAyutthaya.svg"
            },
            "paymentMethodCategory": "ONLINE_BANKING",
            "paymentMethodRegion": [
                "TH"
            ],
            "paymentMethodType": "ONLINEBANKING_BANKOFAYUDHYA",
            "preferred": false
        }
    ],
    "result": {
        "resultCode": "SUCCESS",
        "resultMessage": "success.",
        "resultStatus": "S"
    }
}

The table shows the possible values that the result.resultStatus field in the response message may return. Handle the result according to the guidance:

result.resultStatus

MessageFurther actions

S

The API call is successful.

When paymentOptions.enabled is true, take logo.logoName and logo.logoUrl in the current array to display.

F

The API call is failed.

Refer to the error code for the next step.

U

Unknown reasons.

If UNKNOWN_EXCEPTION is returned, the API call failed due to unknown reasons. Call the API again.

Note: If you did not receive a response message, it might be due to a network timeout. Call the API again to resolve the issue.

The following image shows the visualization effect of the payment page after adding a payment method:

page.png

Common questions

Q: What is allowedPaymentMethodRegions

A: Indicates a list of region codes that represent the countries or regions of payment methods. The value of this parameter is a 2-letter ISO country code or GLOBAL. If you do not specify the value, a full list of all supported payment methods will be returned. If HK is specified, it will take effect in the form of a whitelist, and only the list of supported payment methods in Hong Kong, China will be returned.

Q: What is userRegion

A: The 2-letter country or region code. For more information, see ISO 3166 Country Codes standard. If you do not specify the value, it will not affect the filtering of the payment method list, and only serve as a sorting feature. If HK is specified, the payment method in Hong Kong, China will be sorted as high priority in the return list.

Step 2: Create a payment order Sever-side

Call the pay (Checkout Payment) API to initiate a payment request, you need to collect the buyer's payment method, order information, device information, and payment amount.

Note: If you had called the consult (Checkout Payment) API to add the payment method list in Step 1, the API library installation and request initialization would have been completed. You can proceed directly to Create a payment request.

Antom provides server-side interface libraries in multiple languages. The following code takes Java as an example, refer to Antom SDK for other languages.

1. Install an API library

You can find the latest version on GitHub.

copy
<dependency>
    <groupId>com.alipay.global.sdk</groupId>
    <artifactId>global-open-sdk-java</artifactId>
    <version>{latest_version}</version>
</dependency>

2. Initialize the request instance

Create a singleton resource to make a request to Antom.

copy
import com.alipay.global.api.AlipayClient;
import com.alipay.global.api.DefaultAlipayClient;
import com.alipay.global.api.model.constants.EndPointConstants;

public class Sample {
    public static final String        CLIENT_ID            = "";
    public static final String        ANTOM_PUBLIC_KEY     = "";
    public static final String        MERCHANT_PRIVATE_KEY = "";

    private final static AlipayClient CLIENT               = new DefaultAlipayClient(
            EndPointConstants.SG, MERCHANT_PRIVATE_KEY, ANTOM_PUBLIC_KEY, CLIENT_ID);

}

3. Create a payment request

The following key parameters are included in the payment request.

Parameter nameIs required?Description

productCode

Yes

In this scenario, the field is fixed to CASHIER_PAYMENT.

paymentRequestId

Yes

A unique ID generated by the merchant.

paymentAmount

Yes

Payment amount, which is set to the smallest unit of the payment currency.

paymentMethod

Yes

Payment method enumeration value.

paymentRedirectUrl

Yes

The payment result page of the merchant side, which needs to be displayed according to the results of the server, and is not fixed as a successful page.

paymentNotifyUrl

No

The payment result notification address, which can be specified via the API or set a fixed value in Antom Dashboard.

settlementStrategy

Yes

The settlement currency of the payment. If you have signed multiple settlement currencies, you need to specify it in the API.

order

Yes

Order information, including order amount, order ID, and order description.

env.terminalType

Yes

The environment in which the buyer initiates a transaction.

  • WEB: The client terminal type is a website, which is opened through a PC browser.
  • WAP: The client terminal type is the H5 page, which is opened through a mobile browser.
  • APP: The client terminal type is a mobile application.

env.osType

No

The environment in which the buyer initiates a transaction. When initiated on the merchant's mobile browser, env.osType is ANDROID or IOS.

For more information about the complete parameters, refer to the pay (Checkout Payment) API.

The following shows a sample of how to call the pay (Checkout Payment) API to initiate a payment:

copy
public static void executePayWithCard() {
        AlipayPayRequest alipayPayRequest = new AlipayPayRequest();
        alipayPayRequest.setClientId(CLIENT_ID);
        alipayPayRequest.setPath("/ams/api/v1/payments/pay");
        alipayPayRequest.setProductCode(ProductCodeType.CASHIER_PAYMENT);

        // replace with your paymentRequestId
        alipayPayRequest.setPaymentRequestId("paymentRequestId01");

        // set amount
        Amount amount = new Amount();
        amount.setCurrency("HKD");
        amount.setValue("100");
        alipayPayRequest.setPaymentAmount(amount);

        // set paymentMethod
        PaymentMethod paymentMethod = new PaymentMethod();
        paymentMethod.setPaymentMethodType("ALIPAY_HK");
        alipayPayRequest.setPaymentMethod(paymentMethod);

        // set order Info
        Order order = new Order();
        order.setReferenceOrderId("referenceOrderId01");
        order.setOrderDescription("antom test order");
        order.setOrderAmount(amount);
        alipayPayRequest.setOrder(order);

        //set env Info
        Env env = new Env();
        env.setTerminalType(TerminalType.WAP);
        env.setClientIp("114.121.121.01");
        env.setOsType(OsType.ANDROID);
        alipayPayRequest.setEnv(env);

        // replace with your notify url
        alipayPayRequest.setPaymentNotifyUrl("http://www.yourNotifyUrl.com");

        // replace with your redirect url
        alipayPayRequest.setPaymentRedirectUrl("http://www.yourRedirectUrl.com");

        //make Payment
        AlipayPayResponse alipayPayResponse = null;
        try {
          alipayPayResponse = defaultAlipayClient.execute(alipayPayRequest);
        } catch (AlipayApiException e) {
          String errorMsg = e.getMessage();
          // handle error condition
        }
    }    

The following code shows a sample of the request message:

copy
{
  "paymentNotifyUrl": "http://www.yourNotifyUrl.com",
  "paymentRequestId": "paymentRequestId01",
  "env": {
    "terminalType": "WAP",
    "clientIp": "114.121.121.01",
    "osType": "ANDROID"
  },
  "paymentAmount": {
    "currency": "HKD",
    "value": "100"
  },
  "productCode": "CASHIER_PAYMENT",
  "paymentRedirectUrl": "http://www.yourRedirectUrl.com",
  "paymentMethod": {
    "paymentMethodType": "ALIPAY_HK"
  },
  "order": {
    "orderAmount": {
      "currency": "HKD",
      "value": "100"
    },
    "referenceOrderId": "referenceOrderId01",
    "orderDescription": "antom test order"
  }
}

The following key parameters are included in the response message.

Parameter nameDescription

result.resultStatus

Indicates the call status of the pay (Checkout Payment) API.

normalUrl

The URL that redirects users to a WAP or Web page in the default browser or the embedded WebView.

applinkUrl

The URL that redirects users to open an app when the target app is installed, or to open a WAP page when the target app is not installed.

schemeUrl

The URL scheme that redirects users to open an app in an Android or iOS system when the target app is installed.

The following code shows a sample of the response message:

copy
{
    "appIdentifier": "my.com.myboost",
    "applinkUrl": "https://myboost.app.link/IvWm7QZkfjb?%24fallback_url=https%3A%2F%2Fmsp.boost-my.com%2Fonlinepayment%2Fauthorise&source=alipay-connect&codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A",
    "normalUrl": "https://msp.boost-my.com/onlinepayment/authorise?source=alipay-connect&codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A",
    "orderCodeForm": {
        "codeDetails": [
            {
                "codeValue": "https://global.alipay.com/281002040098ZClz8ZTk46JEsh1jzyU3zx0A",
                "displayType": "TEXT"
            },
            {
                "codeValue": "https://global.alipay.com/merchant/order/showQrImage.htm?code=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A&picSize=L",
                "displayType": "BIGIMAGE"
            },
            {
                "codeValue": "https://global.alipay.com/merchant/order/showQrImage.htm?code=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A&picSize=M",
                "displayType": "MIDDLEIMAGE"
            },
            {
                "codeValue": "https://global.alipay.com/merchant/order/showQrImage.htm?code=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A&picSize=S",
                "displayType": "SMALLIMAGE"
            }
        ],
        "expireTime": "2025-04-03T01:18:36-07:00"
    },
    "paymentActionForm": "{\"method\":\"GET\",\"paymentActionFormType\":\"RedirectActionForm\",\"redirectUrl\":\"https://myboost.app.link/IvWm7QZkfjb?%24fallback_url=https%3A%2F%2Fmsp.boost-my.com%2Fonlinepayment%2Fauthorise&source=alipay-connect&codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A\"}",
    "paymentAmount": {
        "currency": "MYR",
        "value": "230"
    },
    "paymentCreateTime": "2025-04-03T01:04:37-07:00",
    "paymentData": "{\"codeValue\":\"https://global.alipay.com/281002040098ZClz8ZTk46JEsh1jzyU3zx0A\",\"displayPaymentAmount\":\"2.30\",\"displayPaymentCurrency\":\"MYR\",\"wallets\":[{\"enabled\":true,\"redirectionInfo\":{\"appIdentifier\":\"my.com.myboost\",\"applinkUrl\":\"https://myboost.app.link/IvWm7QZkfjb?%24fallback_url=https%3A%2F%2Fmsp.boost-my.com%2Fonlinepayment%2Fauthorise&source=alipay-connect&codeValue=${codeValue}\",\"normalUrl\":\"https://msp.boost-my.com/onlinepayment/authorise?source=alipay-connect&codeValue=${codeValue}\",\"schemeUrl\":\"boostapp://inAppDeeplink?deeplink_path=deeplink/onetimepayment&source=alipay-connect&codeValue=${codeValue}\"},\"walletBrandName\":\"Boost\",\"walletLogo\":{\"logoName\":\"BOOST\",\"logoUrl\":\"https://gw.alipay.com/icon/large/rectangle/BOOST.png\"},\"walletName\":\"BOOST\"}]}",
    "paymentId": "20250403194010800100188550285911975",
    "paymentRequestId": "PAY_20250403160436230",
    "redirectActionForm": {
        "method": "GET",
        "redirectUrl": "https://myboost.app.link/IvWm7QZkfjb?%24fallback_url=https%3A%2F%2Fmsp.boost-my.com%2Fonlinepayment%2Fauthorise&source=alipay-connect&codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A"
    },
    "schemeUrl": "boostapp://inAppDeeplink?deeplink_path=deeplink/onetimepayment&source=alipay-connect&codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040098ZClz8ZTk46JEsh1jzyU3zx0A",
    "result": {
        "resultCode": "PAYMENT_IN_PROCESS",
        "resultMessage": "payment in process",
        "resultStatus": "U"
    }
}

The table shows the possible values that the result.resultStatus field in the response message may return. Handle the result according to the guidance:

result.resultStatus

MessageFurther actions

S

The payment is successful.

No further action is needed.

F

The payment is failed.

Close the current transaction order, or replace the paymentRequestId and initiate a payment request again.

U

Unknown reasons.

  • If PAYMENT_IN_PROCESS is returned, use any of the URLs (appLinkUrl, normalUrl, or schemeUrl) to launch the checkout page.
  • If other result codes are returned, close the current transaction order, or replace the paymentRequestId and initiate a payment request again.

Note: If you did not receive a response message, it might be due to a network timeout. Close the current transaction order, or replace the paymentRequestId and initiate a payment request again.

Common questions

Q: How to determine the type of URL that needs to be consumed in the response message?

A: Depending on the payment method and the type of payment on different terminals, Antom may return one or more of the following three URLs: normalUrl, applinkUrl, and schemeUrl. The merchant server needs to pass these URLs to the merchant front end, and you can choose any URL for redirect consumption.

Q: What is paymentId

A: If you store the corresponding order number for subsequent refunds and reconciliations, you can specify paymentId.

Q: How to set terminalType?

A: The valid values of terminalType are:

  • If the buyer initiates a transaction from PC, the terminalType needs to be specified as WEB.
  • If the buyer initiates a transaction from the mobile browser, the terminalType needs to be specified as WAP. Add the osType parameter and fill in the corresponding system parameters ANDROID or IOS according to the buyer's mobile phone.
  • If the buyer initiates a transaction from app, the terminalType needs to be specified as APP.

Step 3: Get the payment continuation URL Client-side

After getting the payment continuation URL returned by Antom, the merchant server passes the address to the front end. The merchant front end redirects to the payment method page. The different types of payment continuation URL are shown in the following table:

Type

Description

Example URL

normalUrl

The URL of an HTTPS address, used to redirect to the website page of the payment method on the same browser page.

URL=serverResponse.normal

applinkUrl

The Android App Link or iOS Universal Link that is used for redirection in the payment process.

URL=serverResponse.applink

schemeUrl

The scheme URL that is used to open a payment method app.

URL=serverResponse.scheme

Refer to How to properly use the payment continuation URL for more details.

The following is the sample codes for loading payment continuation URL on the merchant front end:

copy
if (URL != null) {
    window.open(URL, '_blank');
}

The following figure shows the effect of the payment method checkout page:

page2.png

Different payment methods return different payment continuation URLs at different terminals. Antom returns different payment continuation URLs based on the paymentMethod and terminalType values you specified. The following table lists the types of returned payment continuation URLs and user experience on different terminals. Refer to URLs returned for payment methods for more details.

Type

Description

User experience

applinkUrl

  • If the buyer has installed the payment method app, launch the payment method app.
  • If the buyer does not have the payment method app installed, launch the mobile browser page.
  • Automatically determine whether the buyer has installed the payment method app.
  • This URL is typically returned when a buyer initiates a payment from a merchant's app or mobile website, depending on whether the payment method is supported.
  • When the buyer has the payment method app installed:

image.png

  • When the buyer does not have the payment method app installed:

image.png

schemeUrl

  • Launch the payment method app directly via the app scheme.
  • If the buyer does not have the payment method app installed, the app cannot be launched, and an exception will be displayed. Refer to Best practices for more details.
  • This URL is typically returned when a buyer initiates a payment from a merchant's app or mobile website, depending on whether the payment method is supported.
  • When the buyer has the payment method app installed:

image.png

  • Not supported if the buyer does not have the payment method app installed

normalUrl

  • The H5 page of the payment method.
  • The H5 page experience for each payment method varies. For example, certain payment methods support direct payment after login, while others require an intermediate page to invoke the payment method app for payment.
  • This URL is returned when the buyer initiates a payment from the merchant's webpage, depending on whether the payment method is supported.
  • Payment made on a web page:

image.png

  • Payment made on an H5 page:

image.png

  • When the intermediate page invokes the payment method app for payment:

image.png

The paymentRedirectUrl field you specified in the pay (Checkout Payment) API provides an HTTPS address, which is used to display the payment results on the merchant side. The following is an example of your payment results page:

page3.png

Common questions

Q: How to handle different payment experiences?

A: You are not required to handle the experience of each payment method. However, redirection from the front end page to the normalUrl address is required. normalUrl will render the experience for each payment method and complete the payment process accordingly.

Q: How to display the payment result page?

A: In the case of successful or failed payments, you may be able to redirect back to the merchant page from the payment method side. To avoid misunderstandings, refer to the result returned by the Antom server, and do not fix paymentRedirectUrl to the payment successful page. If the transaction is initiated from the app platform, set paymentRedirectUrl as the merchant app scheme URL.

Q: Does redirecting to the results page mean the payment was successful?

A: The result page cannot be used as the basis for judging whether the payment is successful. There may be the following scenarios that cause the failure of the redirection to the merchant page:

  • After making a successful payment, the buyer may not be redirected to the result page due to network or other reasons.
  • If the buyer has not completed the payment, the buyer may be redirected back to the merchant page via the payment method side.
  • Antom will not specify information that represents the payment result in the paymentRedirectUrl field.

Step 4: Receive the asynchronous notification Sever-side

When a payment is completed or fails, Antom sends an asynchronous notification (notifyPayment) to the address that you specified in the pay (Checkout Payment) API via the paymentNotifyUrl parameter.

  1. You can choose one of two ways to set an address to receive notifications:
    • If each of your orders has a unique notification URL, it is recommended to set the notification URL in each request. You can specify the asynchronous notification address through the paymentNotifyUrl field of the pay (Checkout Payment) API.
    • If all your orders share a unified notification URL, you can set the notification URL in Antom Dashboard > Developer > Notification URL. Refer to Notification URL for more details.

The following key parameters are included in the payment notification.

Parameter nameIs required?Description

resultStatus

Yes

Indicates the status of the order payment result.

paymentRequestId

Yes

A unique ID generated by the merchant.

paymentAmount

Yes

Payment amount.

For more information about the complete parameters, refer to notifyPayment.

The following is the notification request sample code:

copy
{
  "notifyType": "PAYMENT_RESULT",
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "success"
  },
  "paymentRequestId": "2020010123456789XXXX",
  "paymentId": "2020010123456789XXXX",
  "paymentAmount": {
    "value": "8000",
    "currency": "EUR"
  },
  "paymentCreateTime": "2020-01-01T12:01:00+08:30",
  "paymentTime": "2020-01-01T12:01:01+08:30"
}

The table shows the possible values that the result.resultStatus field in the asynchronous notification of payment results may return. Handle the result according to the guidance:

result.resultStatus

MessageFurther actions

S

The payment is successful.

The following field information is available:

  • paymentId: indicates the payment order ID generated by Antom, used for refund and reconciliation.

F

The payment is failed.

Close the current transaction order, or replace the paymentRequestId and initiate a payment request again.

Note: When a payment is completed or fails, the merchant server receives an asynchronous notification. However, when some failure scenarios (such as parameter exceptions) occur, the pay (Checkout Payment) API returns F synchronously, and Antom does not send an asynchronous notification. You can directly close the order according to the returned F status.

  1. When you receive an asynchronous notification from Antom, you are required to return the response in the Sample code format, but you do not need to countersign the response.

You are required to verify the payment notification sent by Antom as follows:

copy
import javax.servlet.http.HttpServletRequest;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.alipay.global.api.model.Result;
import com.alipay.global.api.model.ResultStatusType;
import com.alipay.global.api.response.AlipayResponse;
import com.alipay.global.api.tools.WebhookTool;

@RestController
public class PaymentNotifyHandleBySDK {

    /**
     * alipay public key, used to verify signature
     */
    private static final String SERVER_PUBLIC_KEY = "";
            
    /**
     * payment result notify processor
     * using <a href="https://spring.io">Spring Framework</a>
     *
     * @param request    HttpServletRequest
     * @param notifyBody notify body
     * @return
     */
    @PostMapping("/payNotify")
    public Object payNotifyHandler(HttpServletRequest request, @RequestBody String notifyBody) {

        // retrieve the required parameters from http request.
        String requestUri = request.getRequestURI();
        String requestMethod = request.getMethod();

        // retrieve the required parameters from request header.
        String requestTime = request.getHeader("request-time");
        String clientId = request.getHeader("client-id");
        String signature = request.getHeader("signature");

        Result result;
        AlipayResponse response = new AlipayResponse();

        try {
            // verify the signature of notification
            boolean verifyResult = WebhookTool.checkSignature(requestUri, requestMethod, clientId, requestTime, signature, notifyBody, SERVER_PUBLIC_KEY);
            if (!verifyResult) {
                throw new RuntimeException("Invalid notify signature");
            }

            // deserialize the notification body
            
            // update the order status with notify result

            // respond the server that the notification is received
            result = new Result("SUCCESS", "success", ResultStatusType.S);

        } catch (Exception e) {
            String errorMsg = e.getMessage();
            // handle error condition
            result = new Result("ERROR", errorMsg, ResultStatusType.F);
        }
        response.setResult(result);
        return ResponseEntity.ok().body(response);
    }

}

Regardless of whether the order is paid successfully, each notification request must be responded in the following fixed format. Otherwise, Antom resends the asynchronous notification.

copy
{
    "result": {
        "resultCode": "SUCCESS",
        "resultStatus": "S",
        "resultMessage": "success"
    }
}

Common questions

Q: When will the notification be sent?

A: It depends on whether the payment is completed:

  • If the payment is successfully completed, Antom will usually send you an asynchronous notification within 3 to 5 seconds. For some payment methods like Cash payment, the notification might take a bit longer.
  • If the payment is not completed, Antom needs to close the order first before sending an asynchronous notification. The time it takes for different payment methods to close the order varies, usually defaulting to 14 minutes.

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.

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: When responding to asynchronous notification, do I need to add a digital signature?

A: If you receive an asynchronous notification from Antom, you are required to return the response in the Sample code format, but you do not need to countersign the response.

Q: Do I need to verify the signature after receiving the payment result notification?

A: Yes. To ensure that the callback request is indeed sent by Antom, verification is required during signature verification. When assembling messages to be verified, you are required to process in the following standard order: <http-method> <http-uri> <client-id>.<request-time>.<request-body>. Note that request-body should be assembled directly from the original value, rather than parsed into JSON and then assembled.

After payments

The following describes how to actively query the transaction status, initiate transaction cancellations, and refund through Antom server after payments, helping you achieve a stable and reliable payment management experience.

Inquire about the result Sever-side

You can get the corresponding payment result from the Antom asynchronous notification or by actively inquiring the payment result. Call the inquiryPayment API to inquire about the payment result by specifying the following parameters:

Parameter nameIs required?Description

paymentRequestId

No

The unique ID that is assigned by a merchant to identify a payment request.

For more information about the complete parameters, refer to the inquiryPayment API.

The following is the sample code for calling the inquiryPayment API:

copy
public static void inquiryPayment() {
    AlipayPayQueryRequest alipayPayQueryRequest = new AlipayPayQueryRequest();

    // replace with your paymentRequestId
    alipayPayQueryRequest.setPaymentRequestId("yourPaymentRequestId");

    AlipayPayQueryResponse alipayPayQueryResponse = null;
    try {
        alipayPayQueryResponse = CLIENT.execute(alipayPayQueryRequest);
    } catch (AlipayApiException e) {
        String errorMsg = e.getMessage();
        // handle error condition
    }
}

The following is a request example:

copy
{
    "paymentRequestId": "REQUEST_20250327164938236"
}

The following code is the sample response:

copy
{
  "actualPaymentAmount": {
    "currency": "THB",
    "value": "299"
  },
  "paymentAmount": {
    "currency": "THB",
    "value": "299"
  },
  "paymentId": "20250217194010800100188760278262487",
  "paymentMethodType": "TRUEMONEY",
  "paymentRedirectUrl": "https://kademo.intlalipay.cn/melitigo/Test_114.html",
  "paymentRequestId": "3IOS47F3C9B7D96",
  "paymentResultCode": "SUCCESS",
  "paymentResultMessage": "success.",
  "paymentStatus": "SUCCESS",
  "paymentTime": "2025-02-17T08:06:43-08:00",
  "pspCustomerInfo": {
    "pspName": "TRUEMONEY"
  },
  "result": {
    "resultCode": "SUCCESS",
    "resultMessage": "success.",
    "resultStatus": "S"
  }
}

Handle the result according to the paymentStatus field in the response:

paymentStatus

MessageFurther actions

SUCCESS

The payment is successful.

No further action is needed.

FAIL

The payment is failed.

Close the current transaction order, or replace the paymentRequestId and initiate a payment request again.

PROCESSING

The payment is under processing.

It is recommended to wait for a while before continuing to query the status or closing the order before querying again.

Common questions

Q: What fields should be consumed when calling the inquiryPayment API?

A: Pay attention to these key parameters:

  • result: Indicates the result of the inquiryPayment API call, the result of the order needs to be judged according to paymentStatus:
    • SUCCESS and FAIL represent the final result.
    • PROCESSING represents the processing.
  • paymentAmount: Indicates the payment amount.

Q: What is the recommended interval for initiating a query?

A: Call the inquiryPayment API constantly with an interval of 2 seconds until the final payment result is obtained or an asynchronous payment result notification is received.

Cancel Sever-side

For orders completed with successful payment, if the buyer requests a cancellation or refund within the same day, you can cancel or unfreeze the order status through the cancel API provided by Antom. In addition, you can directly cancel orders that have not been paid. Refer to Cancel for more information on how to cancel an order.

Refund Sever-side

After the transaction is paid successfully, you can initiate a refund through the following two ways:

  • Refund using the refund API: You can initiate a refund for a successfully paid transaction by calling the refund API.
  • Refund in Antom DashboardFor more information about how to issue a refund and view the refund result, see Initiate a refund.

The refund capabilities supported by Antom are as follows:

  • Support full refunds.
  • Support partial multiple refunds. The total amount of multiple refunds must be less than or equal to the capture amount.

Refer to Refund for more information on refund integrations.

Best practices

Antom provides you with best practice solutions such as client-side optimization, the display of merchant page redirection, payment-retry solution, API timeout settings, and intermediate page optimization. For more details, refer to Best practices.

Payment method features

This section aims to explain the differences in the supported features of each payment method.

Transaction cancellation

There are differences in the cancellation period for different payment methods, refer to Cancel for more information.

Refund

Different payment methods have different refund capabilities, mainly whether can support refunds and supported refund period. Refer to Supported payment methods for more information on refund capabilities.

Default timeout

For more information on the default timeout supported by the payment methods, refer to Default timeout.

Integration key points

The following table lists the integration key points and recommended resolutions for each payment method.

Payment method

Key points

Recommended solution

PayPay

  • There is a length limit on the paymentRedirectUrl field.
  • Refunds cannot exceed 20 times.

The paymentRedirectUrl field should be no longer than 255 characters.

QRIS

Payment discrepancy may occur.

Call the inquiryPayment API of the payment discrepancy to check the payment status and perceive the occurrence of the payment discrepancy in advance. Contact Antom Technical Support for more information.

PromptPay

Payment discrepancy may occur.

Call the inquiryPayment API of the payment discrepancy to check the payment status and perceive the occurrence of the payment discrepancy in advance. Contact Antom Technical Support for more information.

Maybank

Once the payment is completed, there is a 5-minute delay in sending the asynchronous notification.

Display a status prompt of order is being confirmed for buyers.

OVO/Pix/BANCOMAT Pay

The payment method app cannot be launched automatically.

The buyer must manually launch the payment method app to complete the payment.

Siam Commercial Bank

  • A processing fee may be applied to payments.
  • Not supported on PC.

Prompt the buyer that a processing fee may be applied to payments made using the payment method. The fee amount is determined by the buyer's bank level.

Bank of Ayudhya

  • A processing fee may be applied to payments.
  • Not supported on PC.

Prompt the buyer that a processing fee may be applied to payments made using the payment method. The fee amount is determined by the buyer's bank level.

GoPay/Bangkok Bank/

KrungThai Bank

Not supported on PC.

None

NAVER Pay

The PC client requires additional integration. After the buyer logs in, payment is not completed directly on the original page, but is automatically redirected to a new tab.

Enable the browser pop-up access, and create a new browser object (or window) in the code to open the pop-up page to process the payment.

Mercado Pago (Brazil)

The buyerEmail field is consumed, resulting in a direct failure of the payment.

Specify the payerEmail field.