Google Pay Response Objects

For complete sample code please refer here

Available Response Objects

PaymentResponse Object

This Object contains Google Pay response.

Name

Type

Always exists

Description

transactionInfo

Yes

Contains all transaction data. For more details please click on the link

paymentData

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

DisplayItem Object

Name

Type

Always exists

Description

label

String

Yes

From Google documentation: The label to be displayed for the given option

type

String

Yes

From Google documentation: Type of displayed line item:

  • LINE_ITEM

  • SUBTOTAL

price

String

Yes

From Google documentation: The monetary value of the cart item with an optional decimal precision of two decimal places. Negative values are allowed.

status

String

Yes

From Google documentation: The following variables define price variance:

  • FINAL

  • PENDING

Default to FINAL if not provided

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

From Google documentation: Major API version

apiVersionMinor

Number

Yes

From Google documentation: Minor API version

paymentMethodData

Yes

From Google documentation: Data about the selected payment method

email

String

No

Email address, if emailRequired is set to true in the request

shippingOptionData

No

From Google documentation: The selected shipping option in the payment sheet.

shippingAddress

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

From Google documentation: User-facing message to describe the payment method that funds this transaction.

info

Yes

From Google documentation: Data about the selected payment method

tokenizationData

No

From Google documentation: Payment tokenization data for the selected payment method.

type

String

Yes

Will be always set to CARD

CardInfo Object

Name

Type

Always exists

Description

cardNetwork

String

Yes

From Google documentation: The payment card network of the selected payment.

cardDetails

String

Yes

From Google documentation: The details about the card. This value is commonly the last four digits of the selected payment account number.

assuranceDetails

String

Yes

From Google documentation: This object provides information about the validation performed on the returned payment data if assuranceDetailsRequired is set to true on the request.

billingAddress

Address

No

From Google documentation: The billing address associated with the provided payment method, if billingAddressRequired is set to true in the request

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

From Google documentation: The full name of the addressee.

postalCode

MIN

From Google documentation: The postal or ZIP code.

countryCode

MIN

From Google documentation: ISO 3166-1 alpha-2 country code.

phoneNumber

MIN

From Google documentation: A telephone number, if phoneNumberRequired is set to true in the request

address1

FULL

From Google documentation: The first line of the address.

address2

FULL

From Google documentation: The second line of the address.

address3

FULL

From Google documentation: The third line of the address.

locality

FULL

From Google documentation: City, town, neighborhood, or suburb.

administrativeArea

FULL

From Google documentation: A country subdivision, such as a state or province.

sortingCode

FULL

From Google documentation: The sorting code.

Address Example

{
  "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

{
  "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"
  }
}

Last updated