JSON response objects

This reference describes the Google Pay API response object options to use with your website. Response objects are objects that are returned by the Google Pay API client methods.

PaymentData

This is a response object that's returned by Google after a payer approves payment.

Property Type Always exists Description
apiVersion number Yes Major API version. The value in the response matches the value provided in PaymentDataRequest.
apiVersionMinor number Yes Minor API version. The value in the response matches the value provided in PaymentDataRequest.
paymentMethodData PaymentMethodData Yes Data about the selected payment method.
email string No Email address, if emailRequired is set to true in the PaymentDataRequest. If another request has the property set to true there's no effect.
shippingAddress Address No Shipping address, if shippingAddressRequired is set to true in the PaymentDataRequest.

Example

This example response for Google Pay API version 2.0 shows a CARD payment method selected in the Google Pay payment sheet. A payment method token was generated for the example gateway.

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

PaymentMethodData

This object provides data for a selected payment method.

Property Type Always exists Description
type string Yes PaymentMethod type selected in the Google Pay payment sheet.
description string Yes

User-facing message to describe the payment method that funds this transaction.

info object Yes The value of this property depends on the payment method type returned. For CARD, see CardInfo.
tokenizationData PaymentMethodTokenizationData Yes Payment tokenization data for the selected payment method.

Example

This example response shows how a CARD payment method that's selected in the Google Pay payment sheet generates a payment method token for the example gateway.

{
  "type": "CARD",
  "description": "Visa •••• 1234",
  "info": {
    "cardNetwork": "VISA",
    "cardDetails": "1234"
  },
  "tokenizationData": {
    "type": "PAYMENT_GATEWAY",
    "token": "examplePaymentMethodToken"
  }
}

CardInfo

This object provides information about the selected payment card.

Property Type Always exists Description
cardDetails string Yes The details about the card. This value is commonly the last four digits of the selected payment account number.
assuranceDetails AssuranceDetailsSpecifications Yes This object provides information about the validation performed on the returned payment data if assuranceDetailsRequired is set to true in the CardParameters.
cardNetwork string Yes

The payment card network of the selected payment. Returned values match the format of allowedCardNetworks in CardParameters.

This card network value should not be displayed to the buyer. It's used when the details of a buyer's card are needed. For example, if customer support needs this value to identify the card a buyer used for their transaction. For a user-visible description, use the description property of PaymentMethodData instead.

billingAddress Address No The billing address associated with the provided payment method, if billingAddressRequired is set to true in CardParameters.

Example

This example shows a card on the Visa network.

{
  "cardNetwork": "VISA",
  "cardDetails": "1234",
  "assuranceDetails": {
    "cardHolderAuthenticated": "false",
    "accountVerified": "true"
  }
}

AssuranceDetailsSpecifications

This object provides information about what validation has been performed on the returned payment credentials so that appropriate instrument risk checks can be applied.

Name Type Description
accountVerified boolean If true, indicates that Cardholder possession validation has been performed on returned payment credential.
cardHolderAuthenticated boolean

If true, indicates that identification and verifications (ID&V) was performed on the returned payment credential.

If false, the same risk-based authentication can be performed as you would for card transactions. This risk-based authentication can include, but not limited to, step-up with 3D Secure protocol if applicable.

You can receive and process the response Object even if you don’t use the assuranceDetails field. To receive this object, include assuranceDetailsRequired: true in the Request object's CardParameters.

PaymentMethodTokenizationData

This object provides tokenization data for the payment method.

Property Type Always exists Description
type string Yes The type of tokenization to be applied to the selected payment method. This value matches the type set in PaymentMethodTokenizationSpecification.
token string No

The generated payment method token.

Example

This is an example of a tokenized response prepared for the example gateway.

{
  "type": "PAYMENT_GATEWAY",
  "token": "examplePaymentMethodToken"
}

Address

This object provides information about a requested postal address. All the properties are strings.

A MIN address format may be returned if billingAddressFormat is set to MIN. A shipping address is returned in the FULL address format. All properties in a MIN formatted response exist in a FULL formatted response.

Property Address format Description
name MIN The full name of the addressee.
postalCode MIN The postal or ZIP code.
countryCode MIN ISO 3166-1 alpha-2 country code.
phoneNumber MIN A telephone number, if phoneNumberRequired is set to true in the PaymentDataRequest.
address1 FULL The first line of the address.
address2 FULL The second line of the address.
address3 FULL The third line of the address.
locality FULL City, town, neighborhood, or suburb.
administrativeArea FULL A country subdivision, such as a state or province.
sortingCode FULL The sorting code.

Example

This is an example address in the United States with multiple lines of street address data.

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