Skip to main content
Google Pay

This page explains how to use Google Pay to process payments using the EBANX Direct API. This integration offers a seamless way for customers to pay with their saved credit or debit cards and other payment information stored in their Google Account (including Android Pay, Chrome, and YouTube), making the checkout process faster and more convenient.

Requirements

Before beginning the integration, ensure you have the following:

  • Google Pay business account - and access to the Google Pay API Console.
  • EBANX account
  • SSL Certificates - Make sure SSL certificates are properly installed on your servers (Google Pay requires HTTPS).

How it works

Follow the numbered steps below for a detailed explanation of the Google Pay integration process.

Google Pay flow

Availability

Google Pay is available in the following countries.

CountryPayment MethodsCurrencies
Brazil flagBrazil
Credit CardsBrazilian Reais, Euros, US Dollars

Instructions

Follow the steps below.

  1. Set up Google Pay

    When a customer selects Pay with Google, Google Pay uses the payment methods (credit or debit cards) saved in the customer’s Google account. Google Pay does not send raw payment data directly to your server. Instead, it returns a token to the client's browser, which represents the customer’s payment details (card number, expiration date, etc.). The token is received by the client (typically the browser or mobile app) and is sent to your backend. Your backend forwards this token, along with other transaction details (such as amount, currency, and customer information), to the EBANX API for processing.

    To setup your Google Pay account to integrate with EBANX, see below.


    When configuring Google Pay, you need to provide the following parameters specific to EBANX:

    ParameterDetails
    gatewayMerchantIdRetrieve from your EBANX Dashboard at:
    Username / Account Settings / Integration / Test (or Live) Integration Keys / Secret Keys
    gatewaySet to ebanx

    Example response from Google Pay, when a shopper chooses Pay with Google (Step 2 above)

    // Example client response from Google Pay.
    {
    "paymentMethodData": {
    "type": "CARD",
    "description": "Visa •••• 1234",
    "tokenizationData": {
    "type": "PAYMENT_GATEWAY",
    "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ijc2Y..." // tokenized payment method
    }
    }
    }
  2. Build your EBANX Direct API call

    Google Pay token:

    When you receive tokenized customer information from Google Pay, ensure that you include the token in the google_pay parameter when building your EBANX Direct API request.

    Example:

    // Add to your EBANX request.
    {
    "card" :
    {
    "google_pay": "your_google_pay_token_here" // string
    }
    }

    Required Fields - When processing a Google Pay transaction, ensure that the following information is included in your EBANX Direct API request.

    ParameterDescription
    integration_keyYour unique EBANX integration key.Required
    operationIndicates the operation type. Set to "request".Required
    payment.nameCustomer's full name.Required
    payment.emailCustomer's email address.Required
    payment.documentCustomer's CPF (Cadastro de Pessoas Físicas) number. Required for Brazilian payments.Required
    payment.addressCustomer's street address.Required
    payment.street_numberStreet number of the customer's address.Required
    payment.cityCustomer's city.Required
    payment.stateCustomer's state.Required
    payment.zipcodeCustomer's postal code.Required
    payment.countryCustomer's country code (e.g., "BR" for Brazil).Required
    payment.phone_numberCustomer's phone number.
    payment.payment_type_codePayment type. Set to "creditcard".Required
    payment.merchant_payment_codeUnique identifier for the payment in your system.Required
    payment.currency_codeCurrency code (e.g., "BRL" for Brazilian Real).Required
    payment.amount_totalTotal transaction amount.Required
    payment.card.card_nameCardholder's name.Required
    payment.card.google_payToken received from Google Pay.Required

    For more information, refer to the
    EBANX Direct API guidechevron_right
  3. Sample request

    Use the following example to initiate a payment request.

    curl -X POST \
    --location 'https://api.ebanxpay.com/ws/direct' \
    --header 'Content-Type: application/json' \
    --data '{
    "integration_key": "your_ebanx_integration_key",
    "operation": "request",
    "payment": {
    "name": "José Silva",
    "email": "jose@example.com",
    "document": "853.513.468-93",
    "address": "Rua E",
    "street_number": "1040",
    "city": "Maracanaú",
    "state": "CE",
    "zipcode": "61919-230",
    "country": "br",
    "phone_number": "8522847035",
    "payment_type_code": "creditcard",
    "merchant_payment_code": "<%= random_order_id %>",
    "currency_code": "BRL",
    "amount_total": 100,
    "card": {
    "card_name": "José Silva",
    "google_pay": "{\"signature\":\"MEUCIFU/vJavw2HKB4bHbVxZp1JqaIdUa5R1ENbk59MG +
    fHFAiEA1UBu7ZS1YC1v + Go6ScIbel / XyBKVt29Qr1mSdObWIig\\ u003d\ ",\"protoc
    olVersion\ ":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\
    "ZkxOdAiV2EJXbNRkU1izADoLPyQtidbSvAC4HxnAGJPkFcnFbwwMVKHeXYjmkGbIjAg
    3 uzIqsds1G5NrDMzwwztdwmPQ0BjE3lIhVASIg1iljIiNQzcTkhHqTMc01Rs9yn3w2T9W
    gws2UGJ42YEnkeiVPjQfM3NvIAmxwCA8CAWrYZFmQfQCUGHK6H0dZolvjGGI8YtNwaImo
    4 aC6YMCo4t9FfwT + pITZdS9BfIMmjx2iXzjZF1Iy + c53lwzVVFEljGF5mh6cHEzZdKCVj
    F5U11tKt6MybAkEU6yxEqOfdjp41FwjcJ3SknlzrDBrFXqL66cq + xtfCGTPfRvzs7SnFE
    h5MKtzg14VmAQ0TyoQpZuBvrhRnmWxkQU4yzj4q6wCX2VSDO4M4KVvSpVUVTCWVydPmdn
    hFKzL84uVU2YKV8dxjGz7VJNOlF4sJH + G158Ru + w\\\\ u003d\\\ ",\\\"ephemeralPu
    blicKey\\\ ":\\\"BF1s3ATPQMJkfCvLmOAgG9oTcF+P9Wdh5WNJyGeMjcywjEtBhfFdG
    HOkZTZR + poT2LQjBrRADtWkD5yFuEEV7w\\\\ u003d\\\ ",\\\"tag\\\":\\\"SP4tH1
    HxhSTbcNEhmFfEgSRHW7G46B1J3m / FEl6mPzg\\\\ u003d\\\ "}\"}"
    }
    }
    }'
  4. Sample response

    Each request returns a response similar to the example below.


    {
    "payment": {
    "hash": "5a1c6820f28a2fd24c11a1dcde32e79c01c9814b66183cc3",
    "merchant_payment_code": "80b83352839",
    "order_number": null,
    "status": "CO",
    "status_date": "2017-11-27 19:31:43",
    "open_date": "2017-11-27 19:31:43",
    "confirm_date": "2017-11-27 19:31:43",
    "transfer_date": null,
    "amount_br": "100.38",
    "amount_ext": "100.00",
    "amount_iof": "0.38",
    "currency_rate": "1.0000",
    "currency_ext": "BRL",
    "due_date": "2017-11-30",
    "instalments": "1",
    "payment_type_code": "visa",
    "details": {
    "billing_descriptor": "YOUR DESCRIPTOR"
    },
    "transaction_status": {
    "acquirer": "EBANX",
    "code": "OK",
    "description": "Accepted",
    "authcode": "82656"
    },
    "pre_approved": true,
    "capture_available": false
    },
    "status": "SUCCESS"
    }

  5. Congratulations!

    You have completed the necessary steps to integrate Google Pay.


Resources

Use the following resources when testing in your sandbox environment.


Still need help?

Help Image

We hope this article was helpful. If you still have questions, you can explore the following options: