SDK Integration
  • Getting Started
  • Onboarding Requirements
  • Hash Generation
  • Test Merchant list
  • Android
    • Android SDK Offering
    • PayUCheckoutPro
      • Integration
      • Build the Payment Params
        • Additional Params
      • Hash Generation
      • Set up the payment hashes
      • Initiate the Payment
      • Customized Integration
        • Set Webview Properties
        • SDK Configuration
        • Additional Offerings
      • Offers Integration
      • Convenience Fee Integration
      • Custom Note Integration
      • MCP Integration
    • Core
      • Supported Payment Types
      • TPV Integration
      • Merchant Web Services
        • Getting Enabled Payment Options
        • GetCheckoutDetails API
        • Lookup API
    • Custom Browser
      • Integration
        • CustomBrowser Config
        • CustomBrowserCallback
        • Supporting below Lollipop Versions
        • Third-Party Payments Support
      • Sample App
      • Change Logs
    • Native OTP Assist
      • Integration
      • Customization
      • Change Logs
    • UPI
      • Integration
      • TPV Integration in UPI
      • Sample App
      • Change Logs
    • Google Pay™
      • Integration
      • Sample App
    • PhonePe
      • Integration
      • Sample App
      • Change Logs
    • OlaMoney
    • PayU OTP Parser
      • Integration
    • FAQ Android
  • iOS
    • PayUCheckoutPro
      • Integration
      • Advanced Integration
      • Set up the payment hashes
      • Convenience Fee Integration
      • MCP Integration
      • Custom Note Integration
    • Core
      • POD Integration
      • Seamless
      • Web Services
      • Objective C-Non-Seamless
      • Standing Instructions
      • TPV Integration
      • Sample App
    • Custom Browser
      • Sample App
    • OlaMoney
    • Native OTP Assist
      • Integration
      • Customization
    • UPI
      • Integration
      • Sample App
    • PayUParams
      • PayUSIParams
      • PayUBeneficiaryParams
  • Releasing to Apple
  • React-Native
    • PayUCheckoutPro
      • Integration
      • Set up the payment hashes
      • Advanced Integration
      • Change Logs
    • Core
    • Non-Seamless Wrapper
    • TPV (beta)
      • Integration
  • FAQ iOS
Powered by GitBook
On this page
  • Gradle Dependency
  • Callbacks
  • Set up for Test/Sandbox Merchant
  • Check Payment Availability
  • Make Payment by Google Pay
  • Verify the transaction through Webhooks or polling
  • Implementation of PayU WebHook

Was this helpful?

  1. Android
  2. Google Pay™

Integration

This page describes how to integrate with Google Pay SDK.

Gradle Dependency

Add below dependency in application's build.gradle.

implementation 'in.payu:payu-gpay:1.4.0'

Callbacks

List of the callback function provided by PayU Google Pay:

  1. onPaymentFailure (String payuResponse, String merchantResponse) - Calls when payment fails

  2. onPaymentSuccess (String payuResponse, String merchantResponse) - Calls when payment succeeds

  3. onPaymentOptionInitialisationFailure (int errorCode,String description) - Called for Google Pay initialisation failure where,

    • errorCode : Error Code

    • description : Error Description

  4. onPaymentInitialisationSuccess() - Callback when Google Pay is successfully initialized.

  5. onGpayErrorReceived(int errorCode, String description) - Callback when found any error while making payment transaction.

    Following are error messages w.r.t. Google Pay Payment failure

   - ErrorCode        : Description

   - 1                : Google Pay payment not enabled on this merchant key     // Merchant is not registered for 
       
   - 2                : Please check input data.     // Input Data is missing to make payment with Google Pay.
   
   - 3                : Payment APIs Error

Set up for Test/Sandbox Merchant

If you are using the SDK with a test merchant, please provide this metadata value to the manifest file else removed these lines below.

    <application
    <meta-data
        android:name="payu_web_service_url"
        android:value="https://test.payu.in" />

    <meta-data
        android:name="payu_post_url"
        android:value="https://test.payu.in" />

</application>

Check Payment Availability

Call method checkForPaymentAvailability available in Google Pay to check if Google Pay payment is available or not on the device. This method is called before showing Google Pay as a checkout option.

Sample:

GPay.getInstance().checkForPaymentAvailability(Activity activity, PayUGPayCallback callback, String paymentOptionHash, String merchantKey, String user_credentials)

PayUGPayCallback : the class to provide callbacks
Activity : Activity 
paymentOptionHash : Payment Related Details hash 
merchantKey : PayU Merchant Key 
user_credentials : Provide user credentials or use "default"

Make Payment by Google Pay

After successful initialisation of Google Pay by calling checkForPaymentAvailability method call makePayment method to make payment.

GPay.getInstance().makePayment(Activity activity, String postData, final PayUGPayCallback payUGPayCallback, String merchantKey, View loadingDialogView);

PayUGPayCallback : the class to provide callbacks
Activity : activity instance
postData : PayU postdata
merchantKey : Your Merchant Key
loadingDialogView : ProgressDialog View

Sample PostData

txnid=1524122818080&productinfo=product_info&user_credentials=default&key=*****&surl=**SUCCESS_URL**&furl=**FAILURE_URL&firstname=firstname&email=test@gmail.com&amount=10&udf1=udf1&udf2=udf2&udf3=udf3&udf4=udf4&udf5=udf5&pg=UPI&bankcode=TEZ&hash=***PAYMENT_HASH***

Verify the transaction through Webhooks or polling

Once you get the response from SDK, make sure to confirm it with the PayU server. It is recommended to implement the PayU Webhook or backend verify call from your backend.

Implementation of PayU WebHook

Webhook is a server-to-server callback. Once this feature is activated for merchants, PayU would send an S2S response, in addition to SDK callback, to the merchant. It is recommended for the merchant to process the transaction order status – based upon the S2S response and not via the Browser Redirection/SDK callback response to ensure optimum translation outcomes.

PreviousGoogle Pay™NextPhonePe

Last updated 3 years ago

Was this helpful?

To generate PaymentOption Hash visit .

Refer to this , for Webhook implementation.

There is another option to through polling, the transaction status after the SDK callback from your backend.

document
verify payment
here