---
title: "Creating a Google Pay™ Payment on a Customized Checkout Page"
source_url: https://docs.rapyd.net/en/creating-a-google-pay--payment-on-a-customized-checkout-page-542754.html
lang: en
---

# Creating a Google Pay™ Payment on a Customized Checkout Page

Create Google Pay™ payments on your customized hosted page via direct integration.

Using direct integration, merchants integrate Google Pay payment directly on the checkout page hosted on their servers.

Note that this direct integration is different from the direct integration described in [Google online documentation](https://developers.google.com/pay/api/android/guides/tutorial#tokenization).

### Prerequisites

- Onboard with the Rapyd Client Portal. See [Get Started](https://docs.rapyd.net/en/get-started.md "Get Started").
- Customize Hosted pages with Google Pay. See [Customizing Hosted Pages with Google Pay™](https://docs.rapyd.net/en/customizing-hosted-pages-with-google-pay-.md "Customizing Hosted Pages with Google Pay™").
- For [Google Pay on the web](https://developers.google.com/pay/api/web/overview): A [JavaScript library](https://pay.google.com/gp/p/js/pay.js). Follow the [Google Pay Web brand guidelines](https://developers.google.com/pay/api/android/guides/brand-guidelines) and the [Google Pay Web integration checklist](https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist).
- For [Google Pay on Android](https://developers.google.com/pay/api/android/overview): The mobile SDK provided by Google Pay. Follow the [Google Pay Android brand guidelines](https://developers.google.com/pay/api/android/guides/brand-guidelines) and the [Google Pay Android integration checklist](https://developers.google.com/pay/api/android/guides/test-and-deploy/integration-checklist).

### Direct Integration Procedure

To use direct integration to create Google Pay™ payments on a customized hosted page:

1. Send the relevant API request to determine whether Google Pay™ is available.

   Google Pay™ sends a successful response.

   The merchant checkout page displays a Google Pay™ button.
2. When a customer presses the Google Pay™ button, send a payment request to Google Pay™. Set the following values:

   - `apiVersion` - **2**
   - `apiVersionMinor` - **0**
   - `allowedCardNetworks` - **MASTERCARD, VISA**
   - `allowedPaymentMethods.parameters.allowedAuthMethods` - **PAN_ONLY, CRYPTOGRAM_3DS**
   - `allowedPaymentMethods.tokenizationSpecification.type` - **PAYMENT_GATEWAY**
   - `allowedPaymentMethods.tokenizationSpecification.parameters.gateway` - **Rapyd**
   - `allowedPaymentMethods.tokenizationSpecification.parameters.gatewayMerchantId` - The merchant's organization ID/access key.
   - `billingAddress` - Not required
   - `merchantInfo.merchantId` - Merchant ID provided by Google

   The Google Pay™ response contains the payment data, including the encrypted payment token.
3. Send an INITIATE request to Rapyd to authorize the order. Include the payment data from the Google Pay™ response in `paymentData` . See [PaymentDataRequest](https://developers.google.com/pay/api/android/reference/request-objects#PaymentDataRequest). In this example, replace the sample with the payment token from the Google Pay™ response.

   ```json
   {  
     {  
       "apiVersionMinor": 0,  
       "apiVersion": 2,  
       "paymentMethodData": {  
           "description": "Mastercard  •••• 1111",  
           "tokenizationData": {  
               "type": "PAYMENT_GATEWAY",  
               "token": "{\"signature\":\"MEQCIBjQhjaZB76j...d}"  
           }  
       },  
       "type": "CARD",  
       "info": {  
           "cardNetwork": "MASTERCARD",  
           "cardDetails": "1111"  
       }  
   }
   ```

   Rapyd validates the data.

   - If 3DS authentication is required, Rapyd sends a URL for 3DS authentication to the merchant for the customer.
   - If 3DS authentication is not required, Rapyd screens for fraud. If successful, Rapyd processes the payment and sends a response to the merchant.
4. Process the Rapyd response.

   - If 3DS authentication is required, provide the 3DS authentication URL to the customer.
   - If 3DS authentication is not required, complete the checkout payment process.

### Create Payment with Google Pay™

Create the payment as described in [Create Payment](https://docs.rapyd.net/en/create-payment.md "Create Payment"). Set the following values:

- Set `payment_method.type` to the payment method type.
- Set `digital_wallet.type` to google_pay.
- Set `payment_method.digital_wallet.details.token` to the entire token object from Google Pay™, without any changes.
