Accept payments with Google Pay

Through the Google Pay service, buyers can make payments using credit or debit cards stored in their Google accounts. With Antom Checkout Page (CKP), you do not need to integrate the Google Pay SDK separately. Checkout Page will automatically load Google Pay services for you and can be configured to support Google Pay as an express payment method.

User experience

1761631626526-200d995a-1d54-453d-913f-518b34d2438d.png

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.

Integration steps

Follow these steps to start the integration:

  1. Create a payment session
  2. Redirect to Antom Checkout Page
  3. Obtain the payment result
  4. Capture

Step 1: Create a payment session Server-side

When the buyer clicks payment on the product details or shopping cart page, they can select the payment method provided by Antom. For payment method configurations, see Specify a payment method. When the buyer makes a payment, you need to collect key information, such as the payment request ID, order details, payment redirect URL, and payment notification URL. You need to call the createPaymentSession (One-time Payments) API and pass in the following parameters to create a payment session, then redirect to the Antom Checkout Page.

Type

Parameter name

Required

Description

Basic parameters

productCode

Yes

The value of this field in this scenario is fixed as CASHIER_PAYMENT.

productScene

Yes

The value of this field in this scenario is fixed as CHECKOUT_PAYMENT.

paymentRequestId

Yes

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

Yes

The payment amount that you requests to receive in the order currency.

paymentRedirectUrl

Yes

The merchant page URL that the buyer is redirected to after the payment is completed.
paymentNotifyUrl

No

The URL that is used to receive the payment result notification. You can also set the URL to receive the result notification on Antom Dashboard.

settlementStrategy

No

The settlement strategy for the payment request. Specify the settlementCurrency  parameter in the API if you signed up for multiple settlement currencies.

locale

No

Language tag specified for the Checkout Page. If this field is empty or set to automatic, the default language setting of the browser will be used, which is usually English.

paymentFactor.captureMode

No

Indicates the method for capturing funds after the user authorizes the payment. Valid values are:

  • AUTOMATIC: indicates that Antom automatically captures the funds after the authorization. The same applies when the value is empty or you do not pass in this parameter.
  • MANUAL: indicates that you manually capture the funds by calling the capture (One-time Payments) API.

Order parameters

order.goods

No

Goods information in the order. If you use this parameter to pass goods information in the API, you must specify the following parameters:

  • referenceGoodsId: The unique ID to identify the goods.
  • goodsName: Goods name.
  • goodsUnitAmount: Price of goods.
  • goodsQuantity: Quantity of goods.

order.orderAmount

Yes

The order amount on the merchant side for the services or products provided to the buyer. This parameter is used to display the buyer’s consumption record or payment result page. It includes the following parameters:

  • currency: The transaction currency that is specified in the contract. A 3-letter currency code that follows the ISO 4217 standard.
  • value: The amount to charge as a positive integer in the smallest currency unit.

Note: If goods information is specified, the value of order.orderAmount.value must exactly match the total amount calculated from the goods details. Otherwise, the API will return a parameter validation error. Calculation logic: Σ(goods[i].goodsUnitAmount.value × goods[i].goodsQuantity) = order.orderAmount.value

order.referenceOrderId

Yes

The unique ID to identify the order on the merchant side. 

order.orderDescription

Yes

Summary description of the order on the merchant side.

order.buyer

Yes

The buyer information of the merchant side. At least one of the following information must be provided: 

  • order.buyer.referenceBuyerId
  • order.buyer.buyerPhoneNo
  • order.buyer.buyerEmail 

Note: If buyer information is not passed, selecting Google Pay and submitting the payment will trigger a page error and cause the payment process to fail.

Google Pay 

parameters

availablePaymentMethod.paymentMethodMetaData.googlePayConfiguration

No

In the Checkout Page scenario, it is recommended to use the default value for this parameter.

Note: You can specify Google Pay as the only payment method in the checkout page by setting this parameter. For more details, refer to Specify a payment method.

availablePaymentMethod.paymentMethodTypeList.expressCheckout

No

You can specify Google Pay as an express payment method either by setting this parameter to true or via the Antom Dashboard.

The above parameters are the basic parameters for creating a payment session. For complete and additional requirements for specific payment methods, please refer to createPaymentSession (One-time Payments).

The following sample code shows how to call the createPaymentSession (One-time Payments) API:

copy
public static void createPaymentSession() {
    AlipayPaymentSessionRequest alipayPaymentSessionRequest = new AlipayPaymentSessionRequest();
    alipayPaymentSessionRequest.setProductCode(ProductCodeType.CASHIER_PAYMENT);
    alipayPaymentSessionRequest.setProductScene(ProductSceneConstants.CHECKOUT_PAYMENT);

    // replace with your paymentRequestId
    String paymentRequestId = UUID.randomUUID().toString();
    alipayPaymentSessionRequest.setPaymentRequestId(paymentRequestId);

    // replace with your orderId
    String orderId = UUID.randomUUID().toString();

    // set buyer info
    Buyer buyer = Buyer.builder().referenceBuyerId("yourBuyerId").build();

    // convert amount unit(in practice, amount should be calculated on your serverside)
    // For details, please refer to: <a href="https://docs.antom.com/ac/ref/cc">Usage rules of the Amount object</a>
    Amount goodAmount = Amount.builder().currency("SGD").value("3000").build();

    // set goods info
    // note that goods.referenceGoodsId, good.referenceGoodsId, and goods.goodsName are required
    Goods goods = Goods.builder().goodsBrand("Antom Brand").goodsCategory("outdoor goods/bag").goodsName("Classic Woman Bag").goodsQuantity("2")
            .goodsSkuName("Black").goodsImageUrl("https://mdn.alipayobjects.com/portal_pdqp4x/afts/file/A*H8M9RrxlArAAAAAAAAAAAAAAAQAAAQ")
            .goodsUnitAmount(goodAmount).goodsUrl("https://yourGoodsUrl").referenceGoodsId("yourGoodsId").build();

    // set amount
    // amount.value equals goodsAmount.value * goods.goodsQuantity
    // for the currencies supported by payment methods, please refer to: <a href="https://docs.antom.com/ac/pm/supported_pm">Supported payment methods</a>
    Amount amount = Amount.builder().currency("SGD").value("6000").build();
    alipayPaymentSessionRequest.setPaymentAmount(amount);

    // set order info
    // note that order.orderAmount, order.referenceOrderId, and order.orderDescription are required
    Order order = Order.builder().referenceOrderId(orderId)
            .orderDescription("antom ckp testing order").orderAmount(amount).buyer(buyer).goods(Stream.of(goods).collect(Collectors.toList())).build();
    alipayPaymentSessionRequest.setOrder(order);

    // replace with your notify url
    // or configure your notify url here: <a href="https://dashboard.antom.com/global-payments/developers/iNotify">Notification URL</a>
    alipayPaymentSessionRequest.setPaymentNotifyUrl("http://www.yourNotifyUrl.com/payment/receiveNotify");
    // replace with your redirect url
    alipayPaymentSessionRequest.setPaymentRedirectUrl(
            "http://localhost:8080/index.html?paymentRequestId=" + paymentRequestId);

    AlipayPaymentSessionResponse alipayPaymentSessionResponse;
    try {
        System.out.println(JSON.toJSONString(alipayPaymentSessionRequest));
        alipayPaymentSessionResponse = CLIENT.execute(alipayPaymentSessionRequest);
    } catch (AlipayApiException e) {
        String errorMsg = e.getMessage();
        // handle error condition
    }
}

The following shows the sample code of a request:

copy
{
  "order": {
    "buyer": {
      "referenceBuyerId": "yourBuyerId"
    },
    "goods": [
      {
        "goodsBrand": "Antom Brand",
        "goodsCategory": "outdoor goods/bag",
        "goodsImageUrl": "https://mdn.alipayobjects.com/portal_pdqp4x/afts/file/A*H8M9RrxlArAAAAAAAAAAAAAAAQAAAQ",
        "goodsName": "Classic Woman Bag",
        "goodsQuantity": "1",
        "goodsSkuName": "Black",
        "goodsUnitAmount": {
          "currency": "SGD",
          "value": "6000"
        },
        "goodsUrl": "https://yourGoodsUrl",
        "referenceGoodsId": "yourGoodsId"
      }
    ],
    "orderAmount": {
      "currency": "SGD",
      "value": "6000"
    },
    "orderDescription": "antom ckp testing order",
    "referenceOrderId": "c3df9b82-ff67-424b-880b-06c3615b46ea"
  },
  "paymentAmount": {
    "currency": "SGD",
    "value": "6000"
  },
  "availablePaymentMethod": {
    "paymentMethodTypeList": [
      {
        "paymentMethodType": "GOOGLEPAY",
        "expressCheckout": false,
        "paymentMethodOrder": 1
      }
    ]
  },
  "paymentNotifyUrl": "http://www.yourNotifyUrl.com/payment/receiveNotify",
  "paymentRedirectUrl": "http://localhost:8080/index.html?paymentRequestId=597795b7-c812-4132-bd7d-c55914eefdcb",
  "paymentRequestId": "597795b7-c812-4132-bd7d-c55914eefdcb",
  "productCode": "CASHIER_PAYMENT",
  "productScene": "CHECKOUT_PAYMENT"
}

The following shows the sample code of a response, which contains the following parameters:

  • paymentSessionData: The encrypted payment session data. Pass the data to your front end.
  • paymentSessionExpiryTime: The specific date and time after which the payment session will expire.
  • normalUrl: The URL used to redirect to the Checkout Page.
copy
{
    "normalUrl": "https://checkout.antom.com/checkout-page/pages/payment/index.html?sessionData=1iwX2rH5kXnUGT5372d0kHD7PwcgPmRSMgAsvKs8hqRkqobbtWbep59PU2eO5w72h%2B%2XXXX",
    "paymentSessionData": "1iwX2rH5kXnUGT5372d0kHD7PwcgPmRSMgAsvKs8hqRkqobbtWbep59PU2eO5w72h+/c278B+P+nDVNzrQySQQ==&&SG&&188&&eyJleHRlbmRJbmZvIjoie1wiT1BFTl9NVUxUSXXXX",
    "paymentSessionExpiryTime": "2025-03-19T16:21:06+08:00",
    "paymentSessionId": "1iwX2rH5kXnUGT5372d0kHD7PwcgPmRSMgAsvKs8hqSln4WiVZXXXX",
    "result": {
        "resultCode": "SUCCESS",
        "resultMessage": "success.",
        "resultStatus": "S"
    }
}

The table shows the possible values that the result.resultStatus field in the request message may return. Please handle the result according to the guidances:

result.resultStatus

Message

Further actions

S

Indicates that payment session creation succeeded.

Obtain the Antom Checkout Page URL (normalUrl) and return to the merchant's front end. For detailed steps, please refer to Step 2.

UIndicates that payment session creation failed for unknown reasons.

Please change the paymentRequestId and call the API again to resolve the issue. Please contact Antom Technical Support if the problem persists.

FIndicates that the payment session creation failed.

Please check and verify whether the current API required request fields (including header fields and body fields) are correctly passed and valid.

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

Step 2: Redirect to Antom Checkout Page Client-side

After the merchant server obtains normalUrl and passes it to front end, it will redirect from the merchant front end to the Antom Checkout Page.

After obtaining the normalUrl, you need to redirect the page to Antom Checkout Page in the browser, or open it in a new tab.

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

The image below shows the rendering result of the redirected Antom Checkout Page:

跳转 Antom Checkout Page 渲染页面.png

Step 3: Obtain the authorization result Server-side

Upon authorized payment success, failure, or order timeout, Antom will send the corresponding authorization results to you through server interaction. You can obtain the authorization result using one of the following methods:

  • Receive asynchronous notifications from Antom
  • Inquire about the result

Receive asynchronous notifications

Follow the steps below to receive and process asynchronous notifications from Antom:

  1. Configure the webhook URL to receive asynchronous notifications

When an authorized payment succeeds or fails, Antom will send an asynchronous notification to the webhook URL you set. You can choose one of the following two methods to configure the webhook URL for receiving notifications (if both are set, the URL specified in the request takes precedence):

  • If each of your orders has a unique notification URL, it is recommended to set the webhook URL in each request. You can pass the asynchronous notification receiving URL for the specific order through paymentNotifyUrl in the createPaymentSession (One-time Payments) API.
  • If all your orders share a unified notification URL, you can set the webhook URL on Antom Dashboard through Developer > Notification URL. For detailed steps, refer to Notification URL.

The following code shows a sample of the asynchronous notification request:

copy
{
    "actualPaymentAmount": {
        "currency": "HKD",
        "value": "4100"
    },
    "authExpiryTime": "2026-05-15T23:32:30-07:00",
    "cardInfo": {
        "avsResultRaw": "0",
        "cardBrand": "MASTERCARD",
        "cardCategory": "CONSUMER",
        "cardNo": "****************",
        "credentialTypeUsed": "PAN",
        "cvvResultRaw": "",
        "expiryMonth": "*",
        "expiryYear": "**",
        "funding": "CREDIT",
        "issuingCountry": "HK",
        "networkTransactionId": "0509MCW******",
        "paymentMethodRegion": "GLOBAL",
        "threeDSResult": {
            "cavv": "ABpkeUUsZcGvAHC72UQRGg******",
            "challengeCancel": "",
            "challenged": false,
            "eci": "",
            "threeDSOffered": false,
            "threeDStransactionStatusReason": ""
        }
    },
    "notifyType": "PAYMENT_RESULT",
    "paymentAmount": {
        "currency": "HKD",
        "value": "4100"
    },
    "paymentCreateTime": "2026-05-08T23:32:25-07:00",
    "paymentId": "20260509194010800100188260263******",
    "paymentMethodType": "GOOGLEPAY",
    "paymentRequestId": "20260509143211987010000******",
    "paymentResultInfo": {
        "avsResultRaw": "0",
        "cardBrand": "MASTERCARD",
        "cardCategory": "CONSUMER",
        "cardNo": "****************",
        "credentialTypeUsed": "PAN",
        "cvvResultRaw": "",
        "expiryMonth": "*",
        "expiryYear": "**",
        "funding": "CREDIT",
        "issuingCountry": "HK",
        "networkTransactionId": "0509MCW******",
        "paymentMethodRegion": "GLOBAL",
        "threeDSResult": {
            "cavv": "ABpkeUUsZcGvAHC72UQRGg******",
            "challengeCancel": "",
            "challenged": false,
            "eci": "",
            "threeDSOffered": false,
            "threeDStransactionStatusReason": ""
        }
    },
    "paymentTime": "2026-05-08T23:32:30-07:00",
    "result": {
        "resultCode": "SUCCESS",
        "resultMessage": "success.",
        "resultStatus": "S"
    }
}

The following table shows the possible values of result.resultStatus in the notification request of authorization result. Please handle the result according to the guidance provided:

result.resultStatus

Message

Further action

S

Authorization was successful.

The order can be proceeded with capture.

F

Authorization failed.

Please submit a new order with a different paymentRequestId.

  1. Verify the asynchronous notification

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 need to verify the signature of the notification sent by Antom:

copy
/**
 * receive notify
 *
 * @param request    request
 * @param notifyBody notify body
 * @return Result
 */
@PostMapping("/receiveNotify")
@ResponseBody
public Result receiveNotify(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");

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

        // deserialize the notification body
        JSONObject jsonObject = JSON.parseObject(notifyBody);
        String notifyType = (String)jsonObject.get("notifyType");
        if("PAYMENT_RESULT".equals(notifyType)){
            AlipayPayResultNotify paymentNotify = jsonObject.toJavaObject(AlipayPayResultNotify.class);
            if (paymentNotify != null && "SUCCESS".equals(paymentNotify.getResult().getResultCode())) {
                // handle your own business logic.
                // e.g. The relationship between payment information and users is kept in the database.
                System.out.println("receive payment notify: " + JSON.toJSONString(paymentNotify));
                return Result.builder().resultCode("SUCCESS").resultMessage("success.").resultStatus(ResultStatusType.S).build();
            }
        }else if("CAPTURE_RESULT".equals(notifyType)){
            AlipayCaptureResultNotify captureNotify = jsonObject.toJavaObject(AlipayCaptureResultNotify.class);
            if (captureNotify != null && "SUCCESS".equals(captureNotify.getResult().getResultCode())) {
                // handle your own business logic.
                System.out.println("receive capture notify: " + JSON.toJSONString(captureNotify));
                return Result.builder().resultCode("SUCCESS").resultMessage("success.").resultStatus(ResultStatusType.S).build();
            }
        }

    } catch (Exception e) {
        // handle error condition
        return Result.builder().resultCode("FAIL").resultMessage("fail.").resultStatus(ResultStatusType.F).build();
    }

    return Result.builder().resultCode("SYSTEM_ERROR").resultMessage("system error.").resultStatus(ResultStatusType.F).build();
}

Whether the payment is successful or not, each notification request must be responded to in the format specified below. Otherwise, Antom will resend the asynchronous notification.

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

Common questions

Q: When will the notification be sent?

A: The sending time of asynchronous notifications varies in different scenarios.

  • 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 buyer does not submit a payment, when the payment session times out, Antom does not send an asynchronous notification.
  • If the buyer submits a payment but the final payment is not completed:
    • When the last order is closed, if the payment session is still valid, Antom will send asynchronous notifications when the payment session expires.
    • When the last order is closed, if the payment session expired, Antom will send an asynchronous notification when the last order is closed.

Note: The default payment session expiry time is 1 hour. The time it takes to close an order varies for different payment methods, the default is 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: What are the key parameters in the notification that I need to use?

A: Pay attention to the following key parameters:

  • result: indicates the payment result of the order.
  • paymentRequestId: indicates the payment request number you generated for consult, cancel, and reconciliation.
  • paymentId: indicates the payment order number generated by Antom, used for refund and reconciliation.
  • paymentAmount: indicates the payment amount.
  • paymentMethodTpye: indicates the payment method type that is included in payment method options.

Q: There are two types of asynchronous notifications. Which one should be used as the basis for shipment?

A: When you receives a PAYMENT_RESULT notifyType notification, you should first check whether the paymentMethodType is CARD. If it is not CARD, you can decide whether to proceed with shipment based on the result of this notification. If it is CARD, you need to wait for a notification of CAPTURE_RESULT type before making the decision to ship.

Inquire about the result

You can also inquire about the authorization result by calling the inquiryPayment API using paymentRequestId from the payment request.

The following sample code shows how to call 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 sample code shows a response message:

copy
{
    "actualPaymentAmount": {
        "currency": "HKD",
        "value": "5300"
    },
    "authExpiryTime": "2026-05-15T03:26:01-07:00",
    "cardInfo": {
        "cardBrand": "MASTERCARD",
        "cardCategory": "CONSUMER",
        "funding": "CREDIT",
        "issuingCountry": "HK"
    },
    "paymentAmount": {
        "currency": "HKD",
        "value": "5300"
    },
    "paymentId": "20260508194010800100188690262******",
    "paymentMethodType": "GOOGLEPAY",
    "paymentRedirectUrl": "https://u.alipay.cn/_2MYEg9VBNiGHgOVk8kY4L",
    "paymentRequestId": "20260508182444438010000******",
    "paymentResultCode": "SUCCESS",
    "paymentResultInfo": {
        "avsResultRaw": "0",
        "cardBrand": "MASTERCARD",
        "cardCategory": "CONSUMER",
        "cardNo": "****************",
        "credentialTypeUsed": "PAN",
        "cvvResultRaw": "",
        "expiryMonth": "*",
        "expiryYear": "**",
        "funding": "CREDIT",
        "issuingCountry": "HK",
        "networkTransactionId": "0508MPLBVOIB5",
        "paymentMethodRegion": "GLOBAL",
        "threeDSResult": {
            "cavv": "",
            "challengeCancel": "",
            "challenged": false,
            "eci": "",
            "threeDSOffered": false,
            "threeDStransactionStatusReason": ""
        }
    },
    "paymentResultMessage": "success.",
    "paymentStatus": "SUCCESS",
    "paymentTime": "2026-05-08T03:26:01-07:00",
    "transactions": [
        {
            "transactionAmount": {
                "currency": "HKD",
                "value": "5300"
            },
            "transactionId": "20260508194010807000188690265******",
            "transactionRequestId": "20260508182444438010000******",
            "transactionResult": {
                "resultCode": "SUCCESS",
                "resultMessage": "success",
                "resultStatus": "S"
            },
            "transactionStatus": "SUCCESS",
            "transactionTime": "2026-05-08T03:26:05-07:00",
            "transactionType": "CAPTURE"
        }
    ],
    "result": {
        "resultCode": "SUCCESS",
        "resultMessage": "success.",
        "resultStatus": "S"
    }
}

Please handle the result based on the value of the paymentStatus parameter in the response. For specific return values, refer to the API documentation.

Note: When inquiring about the transaction, if the buyer does not submit the order, the ORDER_NOT_EXIST error code will be returned. This error is not returned if the order is submitted. 

Step 4: Capture Server-side

If payment is successful, Antom will automatically initiate capture for you, while you can also initiate capture manually. After capture, you can obtain the capture result either via asynchronous notification or active query. You should decide whether to ship goods based on the capture result. For specific operations, refer to Capture.

After payments

After completing the payment, you can perform the following actions:

Refund Server-side

To learn about Antom refund rules and how to initiate a refund for a successful transaction, see Refund for more information.

Dispute Server-side

When a buyer chooses to pay with a card, a dispute may occur. To learn more, see Dispute resolution.  

Reconciliation Server-side

After the transaction is completed, use the financial reports provided by Antom for reconciliation. For more information on how to reconcile and the settlement rules of Antom, please refer to Reconciliation.

Additional content

Specify a payment method

You can specify payment methods on Antom Dashboard through Payments > Checkout page > Payment methods. You can also pass the parameters in the createPaymentSession (One-time Payments) API to specify the display of payment methods on Checkout Page, the order of the payment method list, and the display of express payments. For specific steps, refer to Specify a payment method.

Note: If you pass parameters through the API, the API values take priority.