Add below dependency in your application's build.gradle.
'com.payu.custombrowser:payu-custom-browser:7.6.3'
From version 7.4.0 onwards it is mandatory to import UPI sdk dependency in case you want to make payments via any UPI option viz. : UPI Intent, Collect, Google Pay, PhonePe ,SamsungPay along with the changes mentioned here.
Merchants are advised to add below permission in application's AndroidManifest.xml to support OTP assist.
<uses-permission android:name="android.permission.RECEIVE_SMS" />
In case your application's supports min sdk less than 20 then kindly do these changes in your surl/furl.
Function in CustomBrowser class. Checks for payment option type availability.
Input:Activity : activity instancePaymentOption : Payment Option type e.g.PaymentOption.SAMSUNGPAY,PaymentOption.PHONEPEPayUCustomBrowserCallback : this class provide callbackspaymentOptionHash : Payment Related Details HashmerchantKey : PayU Merchant Keyuser_credentials : User credentials or use "default"//Code Samplenew CustomBrowser().checkForPaymentAvailability(Activity activity, PaymentOption paymentOption, PayUCustomBrowserCallback payUCustomBrowserCallback, String paymentOptionHash, String merchantKey, String user_credentials)
Invoking Custombrowser is just a 3 step procedure.
Create a basic object of CustomBrowserConfig like below(For more Configurations supported visit here):
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>);
2. Create an object of PayUCustomBrowserCallback.
3. Call method addCustomBrowser() like below:
Input:Activity : activity instanceCustomBrowserConfig : configuration object of the custom browserPayUCustomBrowserCallback : this class provide callbacks//Code Samplenew CustomBrowser().addCustomBrowser( Activity activity, CustomBrowserConfig customBrowserConfig, PayUCustomBrowserCallback cbPayUCustomBrowserCallback)