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:

Python
result = gateway.transaction.sale({
    "amount": "10.00",
    "payment_method_nonce": nonce_from_the_client,
    "options": {
      "submit_for_settlement": True
    },
    "billing": {
      "postal_code": postal_code_from_the_client
    }
})
This code snippet now uses gateway instance methods instead of class-level methods. Learn more.
note

Google Pay cards are represented as Android Pay cards in our API to prevent breaking changes. For example, the response from a PaymentMethod.create() call with a card from Google Pay will include the AndroidPayCard response object.

Using PayPal nonces

If you have enabled PayPal via Google Pay, the nonces returned from the client will represent a PayPalAccount rather than an AndroidPayCard. To create a transaction with a PayPal account:

Python
result = gateway.transaction.sale({
    "amount" : request.form["amount"],
    "payment_method_nonce" : request.form["payment_method_nonce"],
    "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.is_success:
    "Success ID: ".format(result.transaction.id)
else:
    format(result.message)
This code snippet now uses gateway instance methods instead of class-level methods. Learn more.
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.

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:

Next Page: Testing and Go Live →