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
​TransactionInfo​
Yes
Contains all transaction data. For more details please click on the link
paymentData
​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

1
"transactionInfo": {
2
"displayItems": [
3
{
4
"label": "Subtotal",
5
"type": "SUBTOTAL",
6
"price": "2"
7
},
8
{
9
"label": "Tax",
10
"type": "TAX",
11
"price": "0.2"
12
},
13
{
14
"type": "LINE_ITEM",
15
"label": "Shipping cost",
16
"price": "0.00",
17
"status": "FINAL"
18
}
19
],
20
"countryCode": "US",
21
"currencyCode": "USD",
22
"totalPriceStatus": "FINAL",
23
"totalPrice": "2.2",
24
"totalPriceLabel": "Total",
25
"transactionId": "1200640e-5ed3-45d3-870b-5491d5af8248"
26
}
Copied!

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
​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
​Address​
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
​CardInfo​
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

1
{
2
"apiVersion": 2,
3
"apiVersionMinor": 0,
4
"paymentMethodData": {
5
"type": "CARD",
6
"description": "Visa ‒‒‒‒ 1234",
7
"info": {
8
"cardNetwork": "VISA",
9
"cardDetails": "1234"
10
},
11
"tokenizationData": {
12
"type": "PAYMENT_GATEWAY",
13
"token": "examplePaymentMethodToken"
14
}
15
}
16
}
Copied!

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

1
{
2
"name": "John Doe",
3
"address1": "c/o Google LLC",
4
"address2": "1600 Amphitheatre Pkwy",
5
"address3": "Building 40",
6
"locality": "Mountain View",
7
"administrativeArea": "CA",
8
"countryCode": "US",
9
"postalCode": "94043",
10
"sortingCode": ""
11
}
Copied!

Full Response Object

1
{
2
"transactionInfo": {
3
"displayItems": [
4
{
5
"label": "Subtotal",
6
"type": "SUBTOTAL",
7
"price": "2"
8
},
9
{
10
"label": "Tax",
11
"type": "TAX",
12
"price": "0.2"
13
},
14
{
15
"type": "LINE_ITEM",
16
"label": "Shipping cost",
17
"price": "0.00",
18
"status": "FINAL"
19
}
20
],
21
"countryCode": "US",
22
"currencyCode": "USD",
23
"totalPriceStatus": "FINAL",
24
"totalPrice": "2.2",
25
"totalPriceLabel": "Total",
26
"transactionId": "aff9e1-3209-4b2c-8037-120d2c0d"
27
},
28
"paymentData": {
29
"apiVersionMinor": 0,
30
"apiVersion": 2,
31
"paymentMethodData": {
32
"description": "Mastercard ‒‒‒‒ 1771",
33
"tokenizationData": {
34
"type": "PAYMENT_GATEWAY",
35
"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\\\"}\"}"
36
},
37
"type": "CARD",
38
"info": {
39
"cardNetwork": "MASTERCARD",
40
"cardDetails": "1771",
41
"billingAddress": {
42
"address3": "",
43
"sortingCode": "",
44
"address2": "",
45
"countryCode": "US",
46
"address1": "123 Main Street",
47
"postalCode": "07103",
48
"name": "John Smith",
49
"locality": "Newark",
50
"administrativeArea": "NJ"
51
}
52
}
53
},
54
"shippingOptionData": {
55
"id": "shipping-001"
56
},
57
"shippingAddress": {
58
"address3": "",
59
"sortingCode": "",
60
"address2": "",
61
"countryCode": "US",
62
"address1": "123 Main Street",
63
"postalCode": "10601",
64
"name": "Test Test",
65
"locality": "White Plains",
66
"administrativeArea": "NY"
67
},
68
"email": "[email protected]"
69
}
70
}
Copied!
Last modified 1mo ago