Google Pay
Server-Side Implementation
Important
Your integration may be impacted by upcoming certificate changes. Visit our best practices guide to learn more.
GraphQL
Click here to view the server-side
implementation using GraphQL.
Availability
Google Pay is currently available with our latest Android and JavaScript SDKs.
Creating transactions
Using card nonces
Include the Google Pay card nonce in the
Transaction: Sale
call on your server:
Collect device data
from the client and include the device_data_from_the_client in the
transaction.
- Ruby
result = gateway.transaction.sale({
:amount => "10.00",
:payment_method_nonce => nonce_from_the_client,
:device_data => device_data_from_the_client,
:options => {
:submit_for_settlement => true
},
:billing => {
:postal_code => postal_code_from_the_client
}
});
Using PayPal nonces
PayPal nonces returned from the client will be a PayPalAccount
type rather than a
GooglePayCard. To create a transaction with a PayPal nonce:Collect device data
from the client and include the device_data_from_the_client in the
transaction.
- Ruby
result = gateway.transaction.sale({
:amount => "10.00",
:payment_method_nonce => params[:payment_method_nonce],
:device_data => params[:device_data],
:order_id => "Mapped to PayPal Invoice Number",
:options => {
:submit_for_settlement => true,
:paypal => {
:custom_field => "PayPal custom field",
:description => "Description for PayPal email receipt",
}
}
});
if result.success?
"Success ID: #{result.transaction.id}"
else
result.message
end;
Note
The merchant account used at transaction time must accept PayPal transactions.
Note
For certain account setups, it is recommended that merchants collect and pass billing address
information when storing payment methods and/or creating transactions. Passing billing address
details (postal code at minimum) can help increase the likelihood of a successful authorization.
To learn more about your specific account setup,
contact us.
Vaulting Google Pay
Google Pay cards can only be
saved to your Vault for specific use
cases;
see the support article for details. Vaulting of PayPal accounts from Google Pay is currently not supported. This means the
options.store_in_vault
and
options.store_in_vault_on_success
options are not supported when creating a transaction. If your use case is supported, you can store
a customer's Google Pay card in your Vault in a few different ways:
-
In a separate
Payment Method: Create
request -
In a separate
Customer: Create
orCustomer: Update
request -
In your
Transaction: Sale
request by using options.store_in_vault or options.store_in_vault_on_success