# Accept payments with Google Pay

> Learn how to accept payments with Google Pay through API-only integration.

 Through the  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  service, buyers can make payments using the credit or debit cards stored in their  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  accounts.       When using the Native API method, the merchant frontend needs to directly integrate the  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  SDK. After obtaining the card asset information, call Antom’s   [**pay (One-time Payments)**](https://docs.antom.com/ac/ams/payment_cashier.md)  API to initiate payment. For details on integrating the  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  SDK, refer to   [Google Pay for Payments (Web)](https://developers.google.com/pay/api/web/guides/tutorial)   or   [Google Pay for Payments (Android)](https://developers.google.com/pay/api/android/overview)  .

## **User experience** {#esj7b}

 The following figures demonstrate the user experience of paying with  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md) :

<!-- TabGroup -->

**Tab: Web**

![Web user experience for buyers completing payment with Google Pay through APM API-only integration](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/yuque/idocs/2025/png/c9b01442-e37c-4b37-8206-923ed35659bc.png)

**Tab: Mobile**

![Mobile user experience for buyers completing payment with Google Pay through APM API-only integration](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/yuque/idocs/2026/png/96a4242e-590a-45da-bc5a-4ff22426a16a.png)

<!-- /TabGroup -->

## Integration preparations {#i42B7}

 Before you start integrating, read the   [Integration Guide](https://docs.antom.com/integration_guide_en.md)   and   [API Overview](https://docs.antom.com/ac/ams/api_fund.md)   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](https://docs.antom.com/ac/sdks/server_sdks.md)  .

## Integration Steps {#ILjTF}

 Follow these steps to start the integration:

 1. Decrypt     *paymentToken*
2. Initiate an authorized payment
3. (Optional) Redirect to the 3DS authentication page
4. Obtain the authorization result
5. Capture

### Step 1: Decrypt paymentToken {#RO8WX}

 After you obtain     *paymentToken*    , you can choose one of the following methods to decrypt the token and call the   [**pay (One-time Payments)**](https://docs.antom.com/ac/ams/payment_cashier.md)      API to initiate an authorized payment request.

 - Hosted    decryption: Antom manages certificates and performs decryption on your behalf, so you do not need to be PCI-qualified.
- Merchant    decryption: You manage your own certificates and perform decryption operations yourself, and this mode requires that you are PCI-qualified.

 > **[INFO]** **Note**    :    For more information about PCI DSS compliance requirements, see   [PCI DSS standard](https://www.pcisecuritystandards.org/)  .

### Step 2: Initiate an authorized payment    ​  **[Server-side]** {#UaYcL}

 The parameters required for initiating an authorized payment differ depending on the decryption method used. Refer to the corresponding instructions based on the decryption method you adopt.

<!-- TabGroup -->

**Tab: Hosted decryption**

The following illustrates the payment flow for Antom-hosted decryption of     *paymentToken*    ：

 ![Payment flow for Antom-hosted decryption of paymentToken across merchant client, merchant server, Google Pay SDK and Antom server](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/yuque/idocs/2026/png/017c5a60-78b0-4e82-8fff-4141cea6f1dd.png)
 After you integrate the  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  SDK, use Antom's configuration in  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  to interact.
 Below is the acquirer information of Antom for  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md) :

 ```plain
gateway: alipayintl
gatewayMerchantId:  The merchant ID that the merchant obtains from Antom after onboarding in the corresponding environment (PROD/SANDBOX).
```

 The following is a sample code of the interaction:

<!-- TabGroup -->

**Tab: Web**

```java
const tokenizationSpecification = {
    type: 'PAYMENT_GATEWAY',
    parameters: {
    'gateway': "alipayintl",
    'gatewayMerchantId': "2188XXXXXXXX"
    }
};
```

**Tab: Android**

```java
private static JSONObject getGatewayTokenizationSpecification() throws JSONException {
return new JSONObject() {{
    put("type", "PAYMENT_GATEWAY");
    put("parameters", new JSONObject() {{
        put("gateway", "alipayintl");
        put("gatewayMerchantId", "2188XXXXXXXX");
    }});
}};
}
```

<!-- /TabGroup -->

 After you obtain     *paymentToken*     and have Antom decrypt it, initiate the payment using Antom’s card authorization payment capability. You can pass the decrypted     *paymentToken*     through the     *paymentMethod.paymentMethodMetaData.googlePayConfiguration*     parameter in the   [**pay (One-time Payments)**](https://docs.antom.com/ac/ams/payment_cashier.md)  API   .

 Follow   [Step 1: Initiate an authorized payment](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#z5Nqg)   to call the   [**pay (One-time Payments)**](https://docs.antom.com/ac/ams/payment_cashier.md)   API and submit the payment request. You need to pass in the basic parameters, order parameters, and device parameters in the payment request. While you do not need to pass in card payment parameters, but you need to pass in the following parameters:

 | **Parameter name** | **Required** | **Description** |
| --- | --- | --- |
| *paymentMethod.paymentMethodType* | Yes | Payment method enumeration values. For  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md) , pass in   `GOOGLEPAY`  . |
| *paymentMethod.paymentMethodMetaData.googlePayConfiguration.googlePayToken* | Yes | Pass in     *paymentToken*     you obtained. |

 For more information about the parameters used to initiate an authorized payment, refer to   [Step 1: Initiate an authorized payment](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#z5Nqg)  .

 ```java
public static void payByGooglePayServer2Server() {
   AlipayPayRequest alipayPayRequest = new AlipayPayRequest();
        alipayPayRequest.setProductCode(ProductCodeType.CASHIER_PAYMENT);

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

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

        // set paymentMethod
        PaymentMethod paymentMethod = PaymentMethod.builder().paymentMethodType("GOOGLEPAY").build();
        alipayPayRequest.setPaymentMethod(paymentMethod);

         // set Google Pay related parameters-hosted decryption
        Map<String, String> googlePayToken = new HashMap<String, String>();
        googlePayToken.put("googlePayToken", "{\"signature\":\"**\".....}");
        paymentMethodMetaData.put("googlePayConfiguration", googlePayToken);
        paymentMethod.setPaymentMethodMetaData(paymentMethodMetaData);

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

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

        // set order info
        Order order = Order.builder().referenceOrderId(orderId)
                .orderDescription("antom testing order").orderAmount(amount).buyer(buyer).build();
        alipayPayRequest.setOrder(order);

        // set env info
        Env env = Env.builder().terminalType(TerminalType.WEB).clientIp("1.2.3.4").build();
        alipayPayRequest.setEnv(env);

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

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

    // pay
    AlipayPayResponse alipayPayResponse = null;
    try {
        alipayPayResponse = CLIENT.execute(alipayPayRequest);
    } catch (AlipayApiException e) {
        String errorMsg = e.getMessage();
        // handle error condition
    }
}
```

 The following shows the sample code of a request:

 ```json
{
  ..................
  
  "paymentMethod": {
    "paymentMethodType": "GOOGLEPAY",
    "paymentMethodMetaData": {
      "googlePayConfiguration":{
        "googlePayToken":"{\"signature\":\"**\".....}"
      }
    },
  },
   ..................
}
```

 For the complete sample code, refer to   [Step 1: Initiate an authorized payment](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#z5Nqg)  .

**Tab: Merchant decryption**

The following illustrates the payment flow for merchant-decrypted     *paymentToken*    ：

 ![Payment flow for merchant-decrypte paymentToken across merchant client, merchant server, Google Pay SDK and Antom server](https://idocs-assets.marmot-cloud.com/storage/idocs87c36dc8dac653c1/yuque/idocs/2026/png/ed28fd25-48b2-4327-a496-40ef5454cd70.png) After integrating the  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  SDK, you can obtain     *paymentToken*     through   [direct tokenization](https://developers.google.com/pay/api/web/reference/request-objects#direct)  . For more deta   ils, refer to   [Google Pay Developer](https://developers.google.com/pay/api/web/reference/request-objects#direct)  .    Once you have obtained     *paymentToken*    , use Antom’s card authorized payment capability to initiate the payment.For more information about the parameters used to initiate an authorized payment, refer to   [Step 1: Initiate an authorized payment](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#z5Nqg)  .

 > **[INFO]** **Note**    : Using this mode requires that you are PCI-qualified.

 The following are key parameters for initiating a authotized payment request:

 | **Parameter name** | **Required** | **Description** |
| --- | --- | --- |
| *paymentMethod.paymentMethodType* | Yes | Payment method enumeration values. For  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md) , pass in   `GOOGLEPAY`  . |
| *paymentMethod.paymentMethodMetaData.cardNo* | Yes | Pass in the value of the     *paymentMethodDetails.pan*     parameter you obtained. |
| *paymentMethod.paymentMethodMetaData.expiryMonth* | Yes | Pass in the value of the     *paymentMethodDetails.expirationMonth*     parameter you obtained. |
| *paymentMethod.paymentMethodMetaData.expiryYear* | Yes | Pass in the value of the     *paymentMethodDetails.expirationYear*     parameter you obtained. |
| *mpiData.cavv* | No | Pass in the value of the     *paymentMethodDetails.cryptogram*     parameter you obtained. |
| *mpiData.eci* | No | Pass in the value of the     *paymentMethodDetails.eciIndicator*     parameter you obtained. |

 The following sample code shows how to call the   [**pay (One-time Payments)**](https://docs.antom.com/ac/ams/payment_cashier.md)      API:

 ```java
public static void payByGooglePayServer2Server() {
   AlipayPayRequest alipayPayRequest = new AlipayPayRequest();
        alipayPayRequest.setProductCode(ProductCodeType.CASHIER_PAYMENT);

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

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

        // set paymentMethod- PAN_ONLY scenario
        PaymentMethod paymentMethod = PaymentMethod.builder().paymentMethodType("CARD").build();
  
        // set paymentMethod- CRYPTOGRAM_3DS scenario
        //PaymentMethod paymentMethod = PaymentMethod.builder().paymentMethodType("GOOGLEPAY").build();
  
        alipayPayRequest.setPaymentMethod(paymentMethod);

         // set Google Pay related parameters-merchant decryption
        Map<String, Object> paymentMethodMetaData = new HashMap<String, Object>();
        paymentMethodMetaData.put("cardNo", "***********");
        paymentMethodMetaData.put("expiryMonth", "11");
        paymentMethodMetaData.put("expiryYear", "30");

        // Set MpiData info- CRYPTOGRAM_3DS scenario required
        // MpiData mapiDate=new MpiData();
        // mapiDate.setCavv("AAAAAA...");
        // mapiDate.setEci("eci indicator");
        // paymentMethodMetaData.put("mpiData",mapiDate);
  
        paymentMethod.setPaymentMethodMetaData(paymentMethodMetaData);

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

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

        // set order info
        Order order = Order.builder().referenceOrderId(orderId)
                .orderDescription("antom testing order").orderAmount(amount).buyer(buyer).build();
        alipayPayRequest.setOrder(order);

        // set env info
        Env env = Env.builder().terminalType(TerminalType.WEB).clientIp("1.2.3.4").build();
        alipayPayRequest.setEnv(env);

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

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

    // pay
    AlipayPayResponse alipayPayResponse = null;
    try {
        alipayPayResponse = CLIENT.execute(alipayPayRequest);
    } catch (AlipayApiException e) {
        String errorMsg = e.getMessage();
        // handle error condition
    }
}
```

 The following code shows a sample of the obtained  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  message and how to call the Antom's   [**pay (One-time Payments)**](https://docs.antom.com/ac/ams/payment_cashier.md)      API to initiate a payment request. It includes two    card transaction authentication scenarios   ,  `PAN_ONLY`   and   `CRYPTOGRAM_3DS`  :

 - `PAN_ONLY`  :    This authentication method is associated with the payment cards stored in the user’s Google Account.
- `CRYPTOGRAM_3DS`  :    This authentication method is associated with the cards stored as Android device tokens.

<!-- TabGroup -->

**Tab: PAN_ONLY**

The obtained  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  message:

 ```json
"paymentMethod": "CARD",
"paymentMethodDetails": {
  "authMethod": "PAN_ONLY",
  "pan": "1111222233334444",
  "expirationMonth": 10,
  "expirationYear": 2020
},  "gatewayMerchantId": "some-merchant-id",  "messageId": "some-message-id",
"messageExpiration": "1577862000000"
}
```

 The following shows the sample code of a request:

 ```json
{
  ........
  "paymentMethod": {
    "paymentMethodType": "CARD",
    "paymentMethodMetaData": {
      "cardNo":"1111222233334444",
      "expiryYear":"2020",
      "expiryMonth":"10"
    },
  },

  .........
}
```

 For the complete sample code,    refer to  [Step 1: Initiate an authorized payment.](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#z5Nqg)

**Tab: CRYPTOGRAM_3DS**

The obtained  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  message:

 ```json
{
  "paymentMethod": "CARD",
  "paymentMethodDetails": {
    "authMethod": "CRYPTOGRAM_3DS",
    "pan": "1111222233334444",
    "expirationMonth": 10,
    "expirationYear": 2020,
    "cryptogram": "AAAAAA...",
    "eciIndicator": "eci indicator"

  },

  "messageId": "some-message-id",
  "messageExpiration": "1577862000000"
}
```

 The following shows the sample code of a request:

 ```json
{
  ........
  "paymentMethod": {
    "paymentMethodType": "GOOGLEPAY",
    "paymentMethodMetaData": {
      "cardNo":"1111222233334444",
      "expiryYear":"2020",
      "expiryMonth":"10"
    },
    "mpiData":{
      "cavv":"AAAAAA..."
      "eci":"eci indicator"
    },
  },

  .........
}
```

 For the complete sample code,    refer to  [Step 1: Initiate an authorized payment](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#z5Nqg)  .

<!-- /TabGroup -->

<!-- /TabGroup -->

### (Optional) Step 3: Redirect to the 3DS authentication page   **[Client-side]** {#SDNrj}

 Once the merchant server obtains the     *normalUrl*     returned by the response of   [**pay (One-time Payments)**](https://docs.antom.com/ac/ams/payment_cashier.md)  , it should pass     *normalUrl*     to the frontend, which will then redirect the buyer to the 3DS authentication page. For details, see   [Step 2: Redirect to the 3DS authentication page](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#FfHej)  .

 For the processing logic and decision-making regarding 3DS authentication in  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  payments, refer to the 3D Secure 2 section of   [Card payment features](#NfW2T)  .

### Step 4: Obtain the authorization result  **[Server-side]** {#kBb1r}

 After the buyer completes payment or the payment times out, you can obtain the payment result either by receiving asynchronous notifications from Antom or by proactively querying the result. For detailed steps, refer to   [Step 3: Obtain the authorization result](https://docs.antom.com/ac/cashierpay/cardinfocallmerchant.md#Uflu0)  .

### Step 5: Capture  **[Server-side]** {#kBb2r}

 After successful authorization, Antom will automatically initiate capture for you, or you can choose to initiate capture manually. After capture, you can obtain the capture result either via asynchronous notification or active query. For specific steps, refer to   [Capture](https://docs.antom.com/ac/cashierpay/capture.md)  .

## After payments {#r6FIV}

### Cancellation   **[Server-side]** {#Pg7Z0}

 For successful payments, if the buyer requests cancellation or a refund on the same day, you can use Antom’s cancellation capability to cancel the order or release funds. Orders not yet completed can also be cancelled directly. For details, refer to   [Cancel](https://docs.antom.com/ac/cashierpay/cancel.md)  .

### Refund   **[Server-side]** {#SHB4j}

 To learn about Antom refund rules and how to initiate a refund for a successful transaction, see   [Refund](https://docs.antom.com/ac/cashierpay/refund.md)      for more information.

### Dispute   **[Server-side]** {#9fZTO}

 Antom provides dispute resolution services for contested transactions. For more information, refer to [Dispute Guidance](https://docs.antom.com/ac/dispute/overview.md) and [Dispute resolution](https://docs.antom.com/ac/dispute/dispute_resolution.md).

### Reconciliation  **[Server-side]** {#Ac5We}

 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, refer to   [Reconciliation](https://docs.antom.com/ac/cashierpay/reconcile.md)  .

## Additional content {#OwA04}

### Card payment features {#NfW2T}

 [Card payment features](https://docs.antom.com/ac/cashierpay/card_features.md)   also apply to  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md) . The following table outlines the support status of these features for  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md) :

 | **Type** | **Supported** | **Conditions** |
| --- | --- | --- |
| [**Antom Tokenization**](https://docs.antom.com/ac/pm/tokenization.md) | Conditional | - Not supported in CIT (Cardholder-Initiated Transaction) scenarios. It is recommended to store cards via Google accounts. - Supported in MIT (Merchant-Initiated Transaction) scenarios. |
| [**COF**](https://docs.antom.com/ac/cashierpay/cof.md) | Yes | None. |
| [**3D Secure 2**](https://docs.antom.com/ac/pm/3ds.md) | Yes | - If you set the     *paymentMethodMetaData.googlePayConfiguration.allowedAuthMethods*     parameter to   `CRYPTOGRAM_3DS`   (or use the default value), and 3DS authentication has already been completed on the  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  side, Antom will follow the standard third-party 3DS processing flow. As a result, no additional 3DS experience will be triggered by the payment method within the Checkout Page. For details, refer to   [Google Pay - Enabling liability shift for eligible Visa device token transactions globally](https://developers.googleblog.com/en/google-pay-enabling-liability-shift-for-eligible-visa-device-token-transactions-globally/)  . - If you set the     *paymentMethodMetaData.googlePayConfiguration.allowedAuthMethods*     parameter to both   `CRYPTOGRAM_3DS`   and   `PAN_ONLY`   (or use the default value), and 3DS authentication has not been completed on the  [Google Pay](https://docs.antom.com/ac/antomop/googlepay.md)  side, Checkout Page will determine whether 3DS authentication is required based on the values you provide for the     *is3DSAuthentication*     and     *enableAuthenticationUpgrade*     parameters. |
| [**Antom 3DS Retry**](https://docs.antom.com/ac/pm/3ds_retry.md) | Yes | None. |
| [**MIT**](about:blank) | Yes | None. |
| [**Installments**](https://docs.antom.com/ac/pm/installment.md) | No | None. |