Google Pay Request Objects
For complete sample code please refer here
Available dictionary objects
iStatus
Use: iStatus.success
GPEnvironment
Use: GPEnvironment.test
GPButtonColor
Use: GPButtonColor.white
GPButtonType
Use: GPButtonType.buy
GPButtonSizeMode
Use: GPButtonSizeMode.fill
GPBillingAddressFormat
Use: GPBillingAddressFormat.min
Request objects
GooglePayRequest
The Main object that contains all the information necessary to communicate with Google Pay API.
Name
Type
Required
Description
merchantInfo
No
Describes the Merchant name and website. For more information please click the link
onGPButtonLoaded
String
No
Name of a callback function to be called when Google Pay button is loaded. Accepts an object of type GPButtonLoadedResult.
onGetTransactionInfo
String
Yes
Name of a callback function to be called that returns the final price and tax calculations. Please click here for the sample code
onBeforeProcessPayment
String
No
Name of a callback function to be called when consumer clicked the button but before Google Pay sheet is loaded . Usually used to make validations before the payment. Please click here for the sample code
onProcessPayment
String
Yes
Name of a callback function to be called when Google Payment is authorized for the completion of the transaction. This function accepts a parameter of PaymentResponse. Please click here for the sample code
onPaymentCanceled
String
No
Name of a callback function to be called when Google Pay sheet is closed/canceled without completing the transaction. Please click here for the sample code
environment
String
No
Google Pay Environment. Could be either “TEST“ or “PRODUCTION“. If omitted, defaults to “TEST“
billingParameters
No
Sets Billing parameters, including transactionId. For more information please click the link
shippingParameters
No
Sets various Shipping Options. For more information please click the link
buttonOptions
No
Provides Google Pay button customization options. For more information please click the link
Payment Request example
onGPButtonLoaded example
onGetTransactionInfo example
onBeforeProcessPayment callback example
onProcessPayment callback example
onPaymentCanceled callback example
MerchantInfo Object
Name
Type
Required
Description
merchantName
String
Yes
From Google documentation:
Merchant name encoded as UTF-8. Merchant name is rendered in the payment sheet. In TEST
environment, or if a merchant isn't recognized, a “Pay Unverified Merchant” message is displayed in the payment sheet.
Merchant Info example
GPButtonLoadedResult Object
Name
Type
Description
status
There are 3 possible cases:
Google Pay Button loaded successfully:
status = iStatus.success
Google Pay not supported:
status = iStatus.unsupported
An error occurred while loading Google Pay Button:
status = iStatus.error
reason
String
If Google Pay Button failed to load this field will be populated with the reason.
BillingParameters Object
Name
Type
Required
Description
transactionId
String
No
From Google documentation: A unique ID that identifies a transaction attempt. If not provided will be automatically generated by iFields API. Will be sent back on paymentRequest..transactionInfo response object.
allowedAuthMethods
String[]
No
If not provided will be defaulted to ["PAN_ONLY", "CRYPTOGRAM_3DS"]
From Google documentation:
Fields supported to authenticate a card transaction.
PAN_ONLY
: This authentication method is associated with payment cards stored on file with the user's Google Account. Returned payment data includes personal account number (PAN) with the expiration month and the expiration year.CRYPTOGRAM_3DS
: This authentication method is associated with cards stored as Android device tokens. Returned payment data includes a 3-D Secure (3DS) cryptogram generated on the device.
allowedCardNetworks
String[]
No
If not provided will be defaulted to ["AMEX", "DISCOVER", "MASTERCARD", "VISA"]
From Google documentation:
One or more card networks that you support, also supported by the Google Pay API.
AMEX
DISCOVER
INTERAC
JCB
MASTERCARD
VISA
assuranceDetailsRequired
Boolean
No
From Google documentation:
Set to true
to request assuranceDetails
. This object provides information about the validation performed on the returned payment data.
billingAddressRequired
Boolean
No
From Google documentation:
Set to true
if you require a billing address. A billing address should only be requested if it's required to process the transaction.
billingAddressFormat
No
Has an effect when billingAddressRequired is set to true From Google documentation: Billing address format required to complete the transaction.
MIN
: Name, country code, and postal code (default).FULL
: Name, street address, locality, region, country code, and postal code.
phoneNumberRequired
Boolean
No
Has an effect when billingAddressRequired is set to true
From Google documentation:
Set to true
if a phone number is required to process the transaction.
Billing Parameters example
ShippingParameters Object
Name
Type
Required
Description
onGetShippingOptions
String
No
When shipping is required you need to provide the name of your
function that returns a list of shipping options.
For an example - please see below
onGetShippingCosts
String
No
When shipping is required you need to provide the name of your
function that returns a list of shipping costs.
For an example - please see below
shippingAddressRequired
Boolean
No
From Google documentation:
Set to true
to request a full shipping address..
emailRequired
Boolean
No
From Google documentation:
Set to true
to request an email address.
phoneNumberRequired
Boolean
No
From Google documentation:
Set to true
if a phone number is required for the provided shipping address.
allowedCountryCodes
String[]
No
From Google documentation:
ISO 3166-1 alpha-2 country code values of the countries where shipping is allowed. If this object isn't specified, will be defaulted to US
only.
Shipping Parameters example
ShippingData Object
Name
Type
Description
shippingAddress
An Address containing countryCode
, postalCode
, locality
(city), administrativeArea
(state).
ShippingData object example
ShippingAddress Object
Name
Type
Description
postalCode
String
From Google documentation: The postal or ZIP code.
countryCode
String
From Google documentation: ISO 3166-1 alpha-2 country code.
locality
String
From Google documentation: City, town, neighborhood, or suburb.
administrativeArea
String
From Google documentation: A country subdivision, such as a state or province.
ShippingOptionData Object
Name
Type
Description
id
String
id of selected shipping option
ButtonOptions Object
Name
Type
Required
Description
buttonColor
No
From Google documentation:
default
: A Google-selected default value. Currentlyblack
but it may change over time (default).black
: A black button suitable for use on white or light backgrounds.white
: A white button suitable for use on colorful backgrounds.
buttonType
No
From Google documentation:
buy
: "Buy with Google Pay" button (default).donate
: "Donate with Google Pay" button.plain
: Google Pay button without additional text.
buttonSizeMode
No
From Google documentation:
static
: Button has a static width and height (default).fill
: Button size changes to fill the size of its container.
Button Options example
Last updated