Headless Google Pay
Headless Google Pay is a lightweight, embeddable UI module that allows partners to offer Google Pay as a payment method directly within their own application without loading any widget.
Watch: How Headless Google Pay Works
A short walkthrough of Headless Google Pay and how it embeds the Google Pay flow directly inside your own app.
Our Solution
Headless Google Pay exposes just the Google Pay button as a standalone, embeddable component. Partners control where it sits, how it looks, and what happens after payment. Transak handles all the payment infrastructure in the background.
Here are some of the key benefits of the Headless Google Pay solution:
How does it work?
Current Limitations
Before you start
Complete the prerequisites
Get access to the Whitelabel API and set up the mandatory terms. See Quickstart.
Also ask Transak to whitelist your API key and enable Headless Google Pay for it, and share your backend’s public IP addresses. See Need help in Integration.
Complete the Whitelabel API setup
Run Lookup, Authentication and Check KYC status. See How the integration fits together. Continue with the steps below only when Get KYC Requirement returns APPROVED.
When you call Get Quote, set paymentMethod to google_pay.
US, EEA and UK users: show the disclaimers for the termsIds in the Get Quote response directly above the Google Pay component, before the user places the order. See How to Display Disclaimers in Your API Integration.
How to integrate?
Get User Limits
Call Get User Limits with paymentCategory = google_pay and fiatCurrency to fetch the user’s monthly, daily, and yearly limits.
On success → proceed to Get Active Orders.
Get Active Orders
Call Get Active Orders to check for any existing pending orders. Transak doesn’t support placing multiple orders simultaneously.
Cancel Order
Call Cancel Order with orderId and cancelReason to cancel the pending order.
This is only required when an active order is present. After cancellation, proceed to Create a transaction session.
Create a transaction session (using Backend only)
Call the Transaction Session API from your backend using the quoteId, successUrl, failureUrl and the user’s wallet address. You can optionally pass a config and billingAddress object to customise the look and feel of the Google Pay component and billing details.
A successful response returns a sessionId.
Load the Google Pay Component via Transak UI SDK
Use the Transak UI SDK to render the Google Pay component. Pass the sessionId received in previous Step.
JS
React
React Native
Flutter
Call googlePay.unmount() to remove the component from the page after onSuccess fires, or when the user leaves the checkout screen.
The package needs Flutter 3.29 or later. Give the widget a fixed height, and remove it from the widget tree after onSuccess fires, or when the user leaves the checkout screen.
Google Pay opens inside an Android WebView, so add these entries to android/app/src/main/AndroidManifest.xml:
onClick callback
The onClick callback fires each time the user taps the Google Pay button, including when they tap again after closing the Google Pay sheet. It has no payload.
onError callback
The onError callback returns one of the following error codes. Use it to handle each failure case.
Here’s how the Google Pay module appears :
.png)
Place the order (using Backend only)
Once the SDK fires onSuccess with a requestId, call the Create Order API from your backend using the requestId to complete the payment and create the order.
A successful response returns the full order details with redirectUrl.
Open the redirectUrl in a browser or WebView
Always open the redirectUrl returned in the previous step in a browser or WebView.
Upon completing the transaction, the user is redirected based on the payment status:
Track the requestId (using Backend only)
Call the Transaction Request Status API to check whether the request has been processed. Poll this endpoint until the status reaches a terminal state.
Once you receive an orderId, use the Get Order by ID API to fetch full order details.