Google Pay allows users to make payments using payment cards saved in their Google account. When paying with this method, if the user is logged into Google, they will see their preferred payment card, an option to switch to another card saved in their Google account, and a way to confirm the transaction. If the user is not logged in, a login form for their Google account will be displayed. During the payment process, a one-time payment token is generated by Google and used instead of card data, enhancing transaction security.
Ensure that you:
Execute Google Pay payments using the transaction creation endpoint with groupId: 166.
To create a Google Pay transaction, send a POST request to the endpoint:
https://api.tpay.com/transactions
Check details in the API Reference documentation: POST /transactions
Specify the following parameters in the request:
amount * | Transaction amount. |
description * | Description of the transaction visible to the payer. |
payer.email | Payer's email address. |
payer.name | Payer's full name. |
pay.groupId | Payment group identifier for Google Pay: 166. |
* Fields required.
The basic body of the request should look as follows:
{ "amount": 0.1, "description": "Google Pay test payment", "payer": { "email": "[email protected]", "name": "John Doe" }, "pay": { "groupId": 166 } }
Example:
curl --location 'https://api.tpay.com/transactions' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "amount": 0.1, "description": "Google Pay test payment", "payer": { "email": "[email protected]", "name": "John Doe" }, "pay": { "groupId": 166 } }'
After sending the request, you will receive a TransactionCreated schema in response.
Key response parameters:
result | success - The transaction was created successfully. |
status | pending - The transaction is awaiting payment. |
transactionPaymentUrl | URL to redirect the payer to. |
Example response:
{ "result": "success", "requestId": "8d67feda5067b7df97f0", "transactionId": "01K5BK4HEPB0WBCGT51FMTYSYJ", "title": "TR-BRA-CN7CN3X", "posId": "ps_NyRBLzV5kelrpjaM", "status": "pending", "date": { "creation": "2024-06-04 21:39:46", "realization": null }, "amount": 0.1, "currency": "PLN", "description": "Google Pay test payment", "hiddenDescription": "", "payer": { "payerId": "py_a9rjlZWxRLdG1bqY", "email": "[email protected]", "name": "John Doe", "phone": "", "address": "", "city": "", "country": "PL", "postalCode": "" }, "payments": { "status": "pending", "method": "pay_by_link", "amountPaid": 0, "date": { "realization": null } }, "transactionPaymentUrl": "https://secure.tpay.com/?title=TR-BRA-CN7CN3X&uid=01HZJC7HJXA31Z67XNWRV9R0A3" }
Redirect the payer to the URL provided in the transactionPaymentUrl field in the response.
At the provided URL, the payer will see a payment sheet with a list of available payment cards saved in their Google account or a login form for their Google account.
The payer selects a card and completes the transaction.
If you integrate payments with a mobile application and open the transaction panel in WebView, the Google Pay payment method will not be properly supported. We recommend opening payments in the default web browser or on-site integration.
When the Google Pay payment is completed, the payer will be redirected to a success page or error page depending on whether the transaction was successful.
We will notify you about the transaction status via the transaction webhook. Check the details.
Google Pay on-site is an integration of Google Pay payments directly in an online store/mobile application.
It consists of implementing the Google Pay payment mechanism in a way that allows customers to pay directly from your website/mobile application.
The Google Pay on-site method is currently available only for the Pekao acquiring agent. Check whether your card payments are processed through this acquiring agent.
Google Pay on-site can be integrated in the following scenarios:
| Scenario | Description |
|---|---|
| Android application (native) | Google Pay is launched directly in a native Android mobile application, where the integration is implemented using the Google Pay API for Android. |
| Android application with WebView | Google Pay is launched in a mobile application via the WebView component, where the user is redirected to the Tpay transaction panel handling the Google Pay payment. |
| Web browser (Web) | Google Pay is launched directly on the checkout page in your online store, where the integration is implemented using the Google Pay JavaScript SDK. |
If you are integrating your payment in an Android mobile application, follow the instructions prepared by Google:
Requirements:
To correctly launch Google Pay in an Android application, the application should:
Application requirements and environment configuration are described in Google's documentation:
Testing and production readiness
Google provides a checklist of functional and branding requirements that must be met before publishing the integration:
Integration checklist (Android)
For Google Pay integration in a mobile application using WebView, the application should redirect the user to the Tpay transaction panel, where the Google Pay payment is launched.
In this model:
Application-side requirements:
For the Google Pay payment to be correctly launched in WebView, the application should:
Detailed implementation steps are described in Google's documentation:
If the WebView environment does not meet Google Pay requirements, the payment button may not be displayed or the payment may not be correctly launched.
If you are integrating your payment in a system that the payer uses through a web browser, follow the tutorial prepared by Google:
Domain registration (Web – required)
For Google Pay integration in a browser, you must register the domain on which the checkout is launched in the Google Pay & Wallet Console.
To do this:
During the approval process, Google verifies, among other things:
Domain registration applies to integrations implemented directly on the merchant's website. If the payment is processed via redirection to the Tpay transaction panel, domain registration on the merchant side is not required.
Additional requirements and a list of implementation steps are available in the Google documentation
Google Pay SDK configuration for web integration
For correct implementation, configure the payment method as follows.
Google Pay API version used in the integration:
Gateway used during payment:
parameters.gateway | ensure it is set to tpaycom. |
{MERCHANT_ID} | unique identifier assigned to you during Tpay account registration. |
Supported card networks:
Supported authorization methods:
Address format:
The value provided above is the default value; you do not need to implement it.
To create a Google Pay transaction, send a POST request to the endpoint:
https://api.tpay.com/transactions
Check details in the API Reference documentation: POST /transactions
Specify the following parameters in the request:
amount * | Transaction amount. |
description * | Description of the transaction visible to the payer. |
payer.email | Payer's email address. |
payer.name | Payer's full name. |
payer.ip | The payer’s IP address (IPv4 or IPv6). Important note: required for integration with acquirer Pekao. |
groupId | Payment group identifier for Google Pay: 166. |
* Fields required.
The basic body of the request should look as follows:
{ "amount": 0.1, "description": "Google Pay test payment", "payer": { "email": "[email protected]", "name": "John Doe", "ip": "127.0.0.1" }, "pay": { "groupId": 166 } }
Example:
curl --location 'https://api.tpay.com/transactions' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "amount": 0.1, "description": "Google Pay test payment", "payer": { "email": "[email protected]", "name": "John Doe", "ip": "127.0.0.1" }, "pay": { "groupId": 166 } }'
After sending the request, you will receive a TransactionCreated schema in response.
Key response parameters:
result | success - The transaction was created successfully. |
status | pending - The transaction is awaiting payment. |
transactionId | Unique transaction identifier - store it in your system. |
Example response:
{ "result": "success", "requestId": "8d67feda5067b7df97f0", "transactionId": "01K5BK4HEPB0WBCGT51FMTYSYJ", "title": "TR-BRA-CN7CN3X", "posId": "ps_NyRBLzV5kelrpjaM", "status": "pending", "date": { "creation": "2024-06-04 21:39:46", "realization": null }, "amount": 0.1, "currency": "PLN", "description": "Google Pay test payment", "hiddenDescription": "", "payer": { "payerId": "py_a9rjlZWxRLdG1bqY", "email": "[email protected]", "name": "John Doe", "ip": "127.0.0.1", "phone": "", "address": "", "city": "", "country": "PL", "postalCode": "" }, "payments": { "status": "pending", "method": "pay_by_link", "amountPaid": 0, "date": { "realization": null } }, "transactionPaymentUrl": "https://secure.tpay.com/?title=TR-BRA-CN7CN3X&uid=01HZJC7HJXA31Z67XNWRV9R0A3" }
When the payer confirms the payment in the Google Pay form, handle the returned payment data.
Android how to process payment data
Browser how to process payment data
To complete the Google Pay on-site transaction, use the previously stored transactionId parameter, sending a POST request to the address:
https://api.tpay.com/transactions/{transactionId}/pay
Place {transactionId} in the URL, for example:
https://api.tpay.com/transactions/01K5BK4HEPB0WBCGT51FMTYSYJ/pay
Specify the following parameters in the request:
groupId * | Payment group identifier for Google Pay: 166. |
googlePayPaymentData * | Encrypted payment token in base64 format. |
* Fields required.
The payment token is located in the paymentMethodData.tokenizationData.token.object. Encrypt its content using the base64 algorithm.
The basic body of the request should look as follows:
Example:
After sending the request, you will receive a TransactionCreated(https://api.tpay.com/#tag/Transactions/operation/post_transactions_create) schema in response.
The status parameter with the value pending,indicates that the transaction requires additional 3D Secure authentication. Redirect the payer to the address specified in the transactionPaymentUrl parameter, where they can complete the 3D Secure authentication. Check more.
After receiving the notification about the transaction status, use the tr_status field and display the transaction result.