Page Summary
-
Google Pay API utilizes
IsReadyToPayRequest,PaymentDataRequest, andMerchantInforequest objects for payment processing. -
IsReadyToPayRequestchecks user payment capabilities, whilePaymentDataRequestconfigures payment and user data requests within the app. -
MerchantInfoprovides merchant details for display in the Google Pay payment sheet. -
Payment methods are specified using the
PaymentMethodobject, currently supporting card payments with configurable tokenization options. -
Secure handling of payment data is achieved through tokenization, enabling integration with various payment gateways listed in the documentation.
This reference page describes the Google Pay API request object options to use with your application.
IsReadyToPayRequest
This object specifies which payment methods are supported.
| Property | Type | Necessity | Description |
|---|---|---|---|
apiVersion |
number | Required | Major API version. The value is |
apiVersionMinor |
number | Required | Minor API version. The value is |
allowedPaymentMethods |
PaymentMethod[ ] | Required | Specifies support for one or more payment methods supported by the Google Pay API. A |
existingPaymentMethodRequired |
boolean | Optional |
If set to |
Example
This example shows you how to support payment cards and Android device tokens from all supported card networks.
{ "apiVersion": 2, "apiVersionMinor": 0, "allowedPaymentMethods": [ { "type": "CARD", "parameters": { "allowedAuthMethods": ["PAN_ONLY", "CRYPTOGRAM_3DS"], "allowedCardNetworks": ["AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA"] } } ] }
PaymentDataRequest
Use this object to configure your app's support for the Google Pay API.
| Property | Type | Necessity | Description |
|---|---|---|---|
apiVersion |
number | Required | Major API version. The value is 2 for this
specification. |
apiVersionMinor |
number | Required | Minor API version. The value is 0 for this
specification. |
merchantInfo |
MerchantInfo | Optional | Information about the merchant that requests payment data. |
allowedPaymentMethods |
PaymentMethod[ ] | Required | Specifies support for one or more payment methods supported by the Google Pay API. |
transactionInfo |
TransactionInfo | Conditional | Details about the facilitation of the transaction based upon whether the user agrees to the transaction or not. Includes total price and price status. Exactly, one of the |
recurringTransactionInfo |
RecurringTransactionInfo | Conditional | Details about enrollment for a recurring transaction. |
deferredTransactionInfo |
DeferredTransactionInfo | Conditional | Details about enrollment for a deferred transaction. |
automaticReloadTransactionInfo |
AutomaticReloadTransactionInfo | Conditional | Details about enrollment for automatic reload of a stored balance account. |
emailRequired |
boolean | Optional | Set to true to request an email address. |
shippingAddressRequired |
boolean | Optional | Set to true to request a full shipping address. |
shippingAddressParameters |
ShippingAddressParameters | Optional | If shippingAddressParameters is set to true, specify shipping
address restrictions. |
Example
The following example shows you how to support payment cards and Android device tokens from all supported card networks. The payment cards are tokenized for an example gateway. The request is for a payment method to charge a final amount of 12.34 United States dollars.
{ "apiVersion": 2, "apiVersionMinor": 0, "merchantInfo": { "merchantName": "Example Merchant" }, "allowedPaymentMethods": [ { "type": "CARD", "parameters": { "allowedAuthMethods": ["PAN_ONLY", "CRYPTOGRAM_3DS"], "allowedCardNetworks": ["AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA"] }, "tokenizationSpecification": { "type": "PAYMENT_GATEWAY", "parameters": { "gateway": "example", "gatewayMerchantId": "exampleGatewayMerchantId" } } } ], "transactionInfo": { "totalPriceStatus"