# Google Pay Response Objects

#### *For complete sample code please refer* [*here*](/mobile-wallets/google-pay-hosted-checkout/sample-code.md) <a href="#for-complete-sample-code-please-refer-here" id="for-complete-sample-code-please-refer-here"></a>

## Available Response Objects

### PaymentResponse Object

This Object contains Google Pay response.

| **Name**          | **Type**                                   | **Always exists** | **Description**                                                                    |
| ----------------- | ------------------------------------------ | ----------------- | ---------------------------------------------------------------------------------- |
| `transactionInfo` | [TransactionInfo](#transactioninfo-object) | Yes               | Contains all transaction data. For more details please click on the link           |
| `paymentData`     | [PaymentData](#paymentdata-object)         | Yes               | This is a response object that's returned by Google after a payer approves payment |

### TransactionInfo Object

| **Name**           | **Type**    | **Always exists** | **Description**                                                                                                                                                                                     |
| ------------------ | ----------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `displayItems`     | DisplayItem | Yes               | Array of line items describing the charge. For more details please click on the link                                                                                                                |
| `countryCode`      | String      | Yes               | ISO 3166-1 alpha-2 country code                                                                                                                                                                     |
| `currencyCode`     | String      | Yes               | ISO 4217 alphabetic currency code.                                                                                                                                                                  |
| `totalPriceStatus` | String      | Yes               | Set to `FINAL`                                                                                                                                                                                      |
| `totalPrice`       | String      | Yes               | Total amount consumer should be charged. This is a sum of all DisplayItems                                                                                                                          |
| `transactionId`    | String      | Yes               | A unique ID that identifies a transaction attempt. Can be passed on the Request through [billingParameters](/mobile-wallets/google-pay-hosted-checkout/request-objects.md#BillingParameters-Object) |

### DisplayItem Object

| **Name** | **Type** | **Always exists** | **Description**                                                                                                                                                                                                   |
| -------- | -------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `label`  | String   | Yes               | <p><em>From Google documentation</em>:<br>The label to be displayed for the given option</p>                                                                                                                      |
| `type`   | String   | Yes               | <p><em>From Google documentation</em>:<br>Type of displayed line item:</p><ul><li><code>LINE\_ITEM</code></li><li><code>SUBTOTAL</code></li></ul>                                                                 |
| `price`  | String   | Yes               | <p><em>From Google documentation</em>:<br>The monetary value of the cart item with an optional decimal precision of two decimal places. Negative values are allowed.</p>                                          |
| `status` | String   | Yes               | <p><em>From Google documentation</em>:<br>The following variables define price variance:</p><ul><li><code>FINAL</code></li><li><code>PENDING</code></li></ul><p>Default to <code>FINAL</code> if not provided</p> |

#### **TransactionInfo example**

```
"transactionInfo": {
    "displayItems": [
        {
		"label": "Subtotal",
		"type": "SUBTOTAL",
		"price": "2"
        }, 
        {
		"label": "Tax",
		"type": "TAX",
		"price": "0.2"
        }, 
        {
		"type": "LINE_ITEM",
		"label": "Shipping cost",
		"price": "0.00",
		"status": "FINAL"
        }
    ],
    "countryCode": "US",
    "currencyCode": "USD",
    "totalPriceStatus": "FINAL",
    "totalPrice": "2.2",
    "totalPriceLabel": "Total",
    "transactionId": "1200640e-5ed3-45d3-870b-5491d5af8248"
}
```

### PaymentData Object

| **Name**             | **Type**                                           | **Always exists** | **Description**                                                                                  |
| -------------------- | -------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------ |
| `apiVersion`         | Number                                             | Yes               | <p><em>From Google documentation</em>:<br>Major API version</p>                                  |
| `apiVersionMinor`    | Number                                             | Yes               | <p><em>From Google documentation</em>:<br>Minor API version</p>                                  |
| `paymentMethodData`  | [PaymentMethodData](#paymentmethoddata-object)     | Yes               | <p><em>From Google documentation</em>:<br>Data about the selected payment method</p>             |
| `email`              | String                                             | No                | Email address, if `emailRequired` is set to `true` in the *request*                              |
| `shippingOptionData` | [SelectionOptionData](#selectionoptiondata-object) | No                | <p><em>From Google documentation</em>:<br>The selected shipping option in the payment sheet.</p> |
| `shippingAddress`    | [Address](#address-object)                         | No                | Shipping address, if `shippingAddressRequired` is set to `true` in the request                   |

### SelectionOptionData Object

| **Name** | **Type** | **Always exists** | **Description**                    |
| -------- | -------- | ----------------- | ---------------------------------- |
| `id`     | String   | Yes               | Id of the selected Shipping Option |

### PaymentMethodData Object

| **Name**           | **Type**                                                               | **Always exists** | **Description**                                                                                                               |
| ------------------ | ---------------------------------------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `description`      | String                                                                 | Yes               | <p><em>From Google documentation</em>:<br>User-facing message to describe the payment method that funds this transaction.</p> |
| `info`             | [CardInfo](#cardinfo-object)                                           | Yes               | <p><em>From Google documentation</em>:<br>Data about the selected payment method</p>                                          |
| `tokenizationData` | [PaymentMethodTokenizationData](#paymentmethodtokenizationdata-object) | No                | <p><em>From Google documentation</em>:<br>Payment tokenization data for the selected payment method.</p>                      |
| `type`             | String                                                                 | Yes               | Will be always set to `CARD`                                                                                                  |

### CardInfo Object

| **Name**           | **Type**    | **Always exists** | **Description**                                                                                                                                                                                                                 |
| ------------------ | ----------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cardNetwork`      | String      | Yes               | <p><em>From Google documentation</em>:<br>The payment card network of the selected payment.</p>                                                                                                                                 |
| `cardDetails`      | String      | Yes               | <p><em>From Google documentation</em>:<br>The details about the card. This value is commonly the last four digits of the selected payment account number.</p>                                                                   |
| `assuranceDetails` | String      | Yes               | <p><em>From Google documentation</em>:<br>This object provides information about the validation performed on the returned payment data if <code>assuranceDetailsRequired</code> is set to <code>true</code> on the request.</p> |
| `billingAddress`   | **Address** | No                | <p><em>From Google documentation</em>:<br>The billing address associated with the provided payment method, if <code>billingAddressRequired</code> is set to <code>true</code> in the request</p>                                |

### PaymentMethodTokenizationData Object

| **Name** | **Type** | **Always exists** | **Description**                                                        |
| -------- | -------- | ----------------- | ---------------------------------------------------------------------- |
| `type`   | String   | Yes               | Will be always set to `PAYMENT_GATEWAY`                                |
| `token`  | String   | No                | A JSON object string that contains a chargeable token issued by Google |

#### PaymentData Example

```
{
  "apiVersion": 2,
  "apiVersionMinor": 0,
  "paymentMethodData": {
    "type": "CARD",
    "description": "Visa •••• 1234",
    "info": {
      "cardNetwork": "VISA",
      "cardDetails": "1234"
    },
    "tokenizationData": {
      "type": "PAYMENT_GATEWAY",
      "token": "examplePaymentMethodToken"
    }
  }
}
```

### Address Object

| **Name**             | **Address format** | **Description**                                                                                                                                  |
| -------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `name`               | MIN                | <p><em>From Google documentation</em>:<br>The full name of the addressee.</p>                                                                    |
| `postalCode`         | MIN                | <p><em>From Google documentation</em>:<br>The postal or ZIP code.</p>                                                                            |
| `countryCode`        | MIN                | <p><em>From Google documentation</em>:<br>ISO 3166-1 alpha-2 country code.</p>                                                                   |
| `phoneNumber`        | MIN                | <p><em>From Google documentation</em>:<br>A telephone number, if <code>phoneNumberRequired</code> is set to <code>true</code> in the request</p> |
| `address1`           | FULL               | <p><em>From Google documentation</em>:<br>The first line of the address.</p>                                                                     |
| `address2`           | FULL               | <p><em>From Google documentation</em>:<br>The second line of the address.</p>                                                                    |
| `address3`           | FULL               | <p><em>From Google documentation</em>:<br>The third line of the address.</p>                                                                     |
| `locality`           | FULL               | <p><em>From Google documentation</em>:<br>City, town, neighborhood, or suburb.</p>                                                               |
| `administrativeArea` | FULL               | <p><em>From Google documentation</em>:<br>A country subdivision, such as a state or province.</p>                                                |
| `sortingCode`        | FULL               | <p><em>From Google documentation</em>:<br>The sorting code.</p>                                                                                  |

#### Address Example

```json
{
  "name": "John Doe",
  "address1": "c/o Google LLC",
  "address2": "1600 Amphitheatre Pkwy",
  "address3": "Building 40",
  "locality": "Mountain View",
  "administrativeArea": "CA",
  "countryCode": "US",
  "postalCode": "94043",
  "sortingCode": ""
}
```

### Full Response Object

```json
{
  "transactionInfo": {
    "displayItems": [
      {
        "label": "Subtotal",
        "type": "SUBTOTAL",
        "price": "2"
      },
      {
        "label": "Tax",
        "type": "TAX",
        "price": "0.2"
      },
      {
        "type": "LINE_ITEM",
        "label": "Shipping cost",
        "price": "0.00",
        "status": "FINAL"
      }
    ],
    "countryCode": "US",
    "currencyCode": "USD",
    "totalPriceStatus": "FINAL",
    "totalPrice": "2.2",
    "totalPriceLabel": "Total",
    "transactionId": "aff9e1-3209-4b2c-8037-120d2c0d"
  },
  "paymentData": {
    "apiVersionMinor": 0,
    "apiVersion": 2,
    "paymentMethodData": {
      "description": "Mastercard •••• 1771",
      "tokenizationData": {
        "type": "PAYMENT_GATEWAY",
        "token": "{\"signature\":\"MEUCI+slJGaKBHZmphgIgJ8GKHlrPKnQcObF/lGfYjDmt1pu3kzPOYoBmdjdUFvw\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQca0NVUE0gp/9xbueVNmy1o+NTcInbX/9ZN0QbXr8mng\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1614913712991\\\"}\",\"signatures\":[\"MEUCIQDb6d5nYqcL57Q09DPDrDKWxMgIgKaiLAEfdwNwG7S6nMvX1gRvQ\\u003d\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"9gmVUfk1Jua03felBqSUY4yXwzDzlhSHE2jm4VHDgsQ3xnzjQrlTAiyM87dP+8Cx9cks6SbrrK6vyWR7WmrPFhOaNFlulCvn9fI213ofHjRz7ebP71IFRCpgjeqG+nMQJXY8zjkhwXkUJTtOJ4SpXV7ByLyIXb/UJU7pg3O1m3Tl1zpe8C+hLQpKvAIZSAwEl4EBRafbcE33JyuV7RNLMlAerlELsGPUm0c04mM11vF3vdBVfgiyvVw5pJD2Gk/DX7fHdrUpPnzRt5ZoFU0jWZq/8rsj57cEzR+MK2MJVZE014D7iB8+7qcFjJ5H6Tdc/DCsyO5XDVp3Lu5aWZrIqJ6b9BkNPGiCDrV1OKRngc4OYPIGj7OrP7nQgIeU97EYT2xLzqWnfZ/PNCtj89mvT9mKp8y7V6eCJmK8BJsH9MLH08olwGo9pcU7Av2OXo837qUkcCxrkDrYh+wSbqS4p1SyoqgW+2BR+2zRoXU/\\\",\\\"ephemeralPublicKey\\\":\\\"BAAqw+C7aP+Z6KL2HLiP5J7Y/gEWpLQedowh7+r/7taxfNbNuC4\\\\u003d\\\",\\\"tag\\\":\\\"jkqoAh5l16mzlpmqVzpFx/k64\\\\u003d\\\"}\"}"
      },
      "type": "CARD",
      "info": {
        "cardNetwork": "MASTERCARD",
        "cardDetails": "1771",
        "billingAddress": {
          "address3": "",
          "sortingCode": "",
          "address2": "",
          "countryCode": "US",
          "address1": "123 Main Street",
          "postalCode": "07103",
          "name": "John Smith",
          "locality": "Newark",
          "administrativeArea": "NJ"
        }
      }
    },
    "shippingOptionData": {
      "id": "shipping-001"
    },
    "shippingAddress": {
      "address3": "",
      "sortingCode": "",
      "address2": "",
      "countryCode": "US",
      "address1": "123 Main Street",
      "postalCode": "10601",
      "name": "Test Test",
      "locality": "White Plains",
      "administrativeArea": "NY"
    },
    "email": "jsmith1234@abc.com"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.solapayments.com/mobile-wallets/google-pay-hosted-checkout/response-objects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
