This guide explains how to integrate Google Pay directly using the N-Genius Direct API.
The N-Genius Android SDK supports Google Pay starting from v4.0.5.
This guide explains how to enable Google Pay in your app, migrate from older methods, and correctly map the required URLs for a successful transaction.
Prerequisites
-
Download the latest Android SDK (v4.0.5 or higher):
N-Genius Payment SDK for Android -
Ensure Google Pay has been enabled for your merchant account by contacting your Relationship Manager or the Support team.
Migration Note
If you are currently using the PaymentClient.launchCardPayment()
method, note that it has been deprecated.
You must migrate to the PaymentsLauncher.launch()
method, which now supports Google Pay by requiring an additional configuration parameter.
Integration Steps
-
Use SDK v4.0.5 or higher (older versions do not support Google Pay).
-
Define GooglePayConfig:
Google Pay requires two parameters:- environment →
Test
orProduction
. - merchantGatewayId → provided by Google Pay when registering your account.
- environment →
val googlePayConfig = GooglePayConfig(
environment = GooglePayConfig.Environment.Production,
merchantGatewayId = "BCR2DN4T27NJW2Y"
- Launch the Payment Request:
Pass the authorization URL, payPageUrl, and GooglePayConfig into thePaymentsRequest
builder.
paymentsLauncher.launch(
PaymentsRequest.builder()
.gatewayAuthorizationUrl(authUrl)
.payPageUrl(payPageUrl)
.setGooglePayConfig(googlePayConfig)
.build()
)
Order Creation & URL Mapping
When integrating with the SDK, you must first create an order.
The response will return the URLs required by the SDK:
- authUrl → maps to the
payment-authorization
object:
"payment-authorization": {
"href": "https://api-gateway-sandbox.platform.network.ae/transactions/paymentAuthorization"
}
- payPageUrl → maps to the
payment
object:
"payment": {
"href": "https://paypage-sandbox.platform.network.ae/?code=84553269c3a5bb75"
}
Use these values to populate the arguments in the PaymentsRequest
object.
Certificate Upload
To complete your integration:
- Upload your signed Google Pay certificate to the *N-Genius Portal*.
- Certificates can be uploaded via the portal UI or using the API.
Once configured, a “Buy with GPay” button will appear on your payment screen.
Testing the Flow
- When users tap “Buy with GPay”, the Google Pay sheet will appear.
- Users may be prompted to sign in with Gmail.
- Once confirmed, the payment flow will continue as expected.
Always test thoroughly in sandbox before going live.
Conclusion
By following these steps, you can integrate Google Pay seamlessly using the N-Genius Android SDK v4.0.5.
Ensure that your order creation flow correctly maps the authUrl and payPageUrl, and that your Google Pay configuration is properly set up with the required credentials.
This guarantees a smooth and secure Google Pay checkout experience for your users.