Enable Google Pay in your Android app using the N-Genius Android SDK.
This guide explains the setup, required parameters, and code updates to support Google Pay.
See also:
- Enable Google Pay – how to enable Google Pay on your merchant account.
- Google Pay Direct API Integration – order creation, URL mapping, and certificate upload.
Deprecation Notice
The method launchCardPayment
in the PaymentClient
class is deprecated.
Use the new PaymentsLauncher
class with the launch()
method.
Prerequisites
- N-Genius Android SDK v4.0.5 or higher
- Google Pay enabled on your merchant account (Enable Google Pay)
- Google Pay merchant gateway ID (
merchantGatewayId
) → This is your Recipient ID, which you can find in the Google Pay & Wallet console when you register your merchant.
Implementation Steps
1. Configure Google Pay
Create a GooglePayConfig
object with your environment and merchant gateway ID:
val googlePayConfig = GooglePayConfig(
environment = GooglePayConfig.Environment.Production, // or Test
merchantGatewayId = "BCR2DN4T27NJW2Y" // replace with your ID
)
2. Launch Payments with Google Pay Support
Pass the authorization URL, payPageUrl, and GooglePayConfig into PaymentsLauncher.launch()
:
paymentsLauncher.launch(
PaymentsRequest.builder()
.gatewayAuthorizationUrl(authUrl)
.payPageUrl(payPageUrl)
.setGooglePayConfig(googlePayConfig)
.build()
)
- authUrl → Gateway authorization URL (from your backend order creation response).
- payPageUrl → Payment page URL (from your backend order creation response).
- googlePayConfig → Configuration object from step 1.
Testing & Verification
- In Sandbox, the Google Pay button will appear for eligible devices/accounts.
- When tapped, the Buy with Google Pay button triggers the Google Pay sheet.
- Users may be prompted to sign in with their Google account.
- On success, the flow continues as with card payments.
Always test thoroughly in sandbox before going live.
Notes
- This integration requires SDK v4.0.5+.
- The Buy with Google Pay button appears automatically once configured.
- Backend order creation and URL mapping are covered in the Google Pay Direct API Integration.
Sample App
For a working example, check the Android SDK Sample App.