1. Integration Steps

Before you start with the integration, enable the payment methods that you want to offer to your customers from Dashboard > Settings > Payment methods. We enable Cards, UPI, and other payment methods by default, and we recommend that you enable other payment methods that are relevant to you.

Step 1: Create a PayU account

First, create a PayU account. See Register for a Merchant Account.

Step 2: Set Up build.gradle

Add the following dependency in your application’s build.gradle:

implementation 'in.payu:payu-custom-browser:7.13.1'


Watch Out!

If you are getting the following error: Default interface methods are only supported starting with Android N (--min-api 24): Landroidx/lifecycle/DefaultLifecycleObserver;onCreate(Landroidx/lifecycle/LifecycleOwner;)V

Add the following compileOptions on your app's build.gradle:

android {
 compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8

From version 7.4.0 onwards, it is mandatory to import UPI SDK dependency if you want to make payments through any of the following UPI options along with the changes mentioned in the Third-Party Payments Support section.

  • UPI Intent
  • Collect
  • Google Pay
  • PhonePe
<uses-permission android:name="android.permission.RECEIVE_SMS" />



Merchants are advised to add this permission in the application’s AndroidManifest.xml to support OTP assist. In case your application supports a minimum SDK of less than 20, do these changes in your surl/furl.

Step 3: Check for Payment Availability

The CheckForPaymentAvailability function in CustomBrowser class. Checks for payment option type availability:

      Activity : activity instance
      PaymentOption : Payment Option type e.g.PaymentOption.SAMSUNGPAY,PaymentOption.PHONEPE
      PayUCustomBrowserCallback : this class provide callbacks 
      paymentOptionHash : Payment Related Details Hash
      merchantKey : PayU Merchant Key
      user_credentials : User credentials or use "default"


Generate PaymentOption Hash

To generate PaymentOption Hash refer to Hash Generation.

Formula :-sha512(key|command|var1|salt)


key= Provide your merchant key here
command= "payment_related_details_for_mobile_sdk" // Api Commands
salt= Provide your merchant salt here
var1= Provide user credentials or use "default"


new CustomBrowser().checkForPaymentAvailability(Activity activity, PaymentOption paymentOption, PayUCustomBrowserCallback payUCustomBrowserCallback, String paymentOptionHash, String merchantKey, String user_credentials)

Step 2: Invoke CustomBrowser

To invoke CustomBrowser:

Create a basic object of CustomBrowserConfig similar to the following code snippet. For more information on configurations supported, refer to CustomBrowser Configurations.


Post Url can be any of the following:

Production - https://secure.payu.in/_payment
Staging - https://test.payu.in/_payment

CustomBrowserConfig customBrowserConfig = new CustomBrowserConfig(merchantKey,txnId);
customBrowserConfig.setPayuPostData(<Post Data>);
customBrowserConfig.setPostUrl(<Post Url>);
  1. Create an object of PayUCustomBrowserCallback.
  2. Call method addCustomBrowser() similar to the following code snippet:


  • Activity: activity instance.
  • CustomBrowserConfig: configuration object of the custom browser.
  • PayUCustomBrowserCallback: this class provides callbacks.
    Activity : activity instance
    CustomBrowserConfig : configuration object of the custom browser
    PayUCustomBrowserCallback : this class provide callbacks


new CustomBrowser().addCustomBrowser( Activity activity, CustomBrowserConfig customBrowserConfig, PayUCustomBrowserCallback cbPayUCustomBrowserCallback)

Sample Post Request


firstname=John&ccnum=5123456789012346&device_type=1&ccvv=123&ccexpyr=2025&key=gt****&[email protected]

Net Banking

&phone=99999*****&pg=NB&furl=https://cbjs.payu.in/sdk/failure&productinfo=Macbook+Pro&key=gt****&[email protected]
pg **mandatory**
String It defines the payment category that the merchant wants the customer to see by default on the PayU’s payment page.
For NetBanking, pg=NB.
bankcode mandatory`String Each payment option is identified with a unique bank code at PayU. The merchant must post this parameter with the corresponding payment option’s bank code value in it. For the list of bank codes that can be used with the bankcode parameter, refer to Net Banking Codes.
Reference: For the test Net Banking credentials, refer to Test Cards, UPI ID, and Wallets.

Kindly refer link for the supported payment method