Google Pay

Server-Side Implementationanchor

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 transactionsanchor

Using card noncesanchor

Include the Google Pay card nonce in the Transaction: Sale call on your server: Collect device data from the client and include the deviceDataFromTheClient in the transaction.

  1. Java
TransactionRequest request = new TransactionRequest()
  .amount(new BigDecimal("10.00"))
  .paymentMethodNonce(nonceFromTheClient)
  .deviceData(deviceDataFromTheClient)
  .options()
    .submitForSettlement(true)
    .done()
  .billingAddress()
    .postalCode(postalCodeFromTheClient)
    .done();

Result<Transaction> result = gateway.transaction().sale(request);
note

Google Pay cards are represented as Android Pay cards in our API to prevent breaking changes. For example, the response from a Payment Method: Create call with a card from Google Pay will include the AndroidPayCard response object.

Using PayPal noncesanchor

PayPal nonces returned from the client will be a PayPalAccount type rather than an AndroidPayCard. To create a transaction with a PayPal nonce:

Collect device data from the client and include the deviceDataFromTheClient in the transaction.

  1. Java
TransactionRequest request = new TransactionRequest()
  .amount(request.queryParams("amount"))
  .paymentMethodNonce(request.queryParams("paymentMethodNonce"))
  .deviceData(request.queryParams("device_data"))
  .orderId("Mapped to PayPal Invoice Number")
  .options()
    .submitForSettlement(true)
    .paypal()
      .customField("PayPal custom field")
      .description("Description for PayPal email receipt")
      .done()
    .storeInVaultOnSuccess(true)
    .done();

Result<Transaction> saleResult = gateway.transaction().sale(request);

if (result.isSuccess()) {
  Transaction transaction = result.getTarget();
  System.out.println("Success ID: " + transaction.getId());
} else {
  System.out.println("Message: " + result.getMessage());
}
note

The merchant account used at transaction time must accept PayPal transactions.

Because creating a transaction with a PayPalAccount nonce from Google Pay is effectively the same as creating a transaction from your PayPal integration, they have the same settlement rules and options that typical PayPal transactions have.

When making a transaction with PayPalAccount nonce through Google Pay, the resulting transaction will have facilitatorDetails.oauthApplicationName set to Google.

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 Payanchor

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.storeInVault and options.storeInVaultOnSuccess 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:


Next Page: Testing and Go Live