Add below dependency in your application's build.gradle.
'in.payu:payu-custom-browser:7.10.1'
If you are getting this error,
Default interface methods are only supported starting with Android N (--min-api 24): Landroidx/lifecycle/DefaultLifecycleObserver;onCreate(Landroidx/lifecycle/LifecycleOwner;)V
Add compileOptions on Apps Gradle,
From version 7.4.0 onwards it is mandatory to import UPI sdk in case you want to make payments via any UPI option viz. : UPI Intent, Collect, Google Pay, PhonePe ,SamsungPay along with the changes mentioned .
Merchants are advised to add below permission in application's AndroidManifest.xml to support OTP assist.
In case your application's supports min sdk less than 20 then kindly do these in your surl/furl.
CheckForPaymentAvailability
Function in CustomBrowser class. Checks for payment option type availability.
Input:
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"
//Code Sample
new CustomBrowser().checkForPaymentAvailability(Activity activity, PaymentOption paymentOption, PayUCustomBrowserCallback payUCustomBrowserCallback, String paymentOptionHash, String merchantKey, String user_credentials)
Invoking CustomBrowser
Invoking Custombrowser is just a 3 step procedure.
Post Url can be any of the following:
CustomBrowserConfig customBrowserConfig = new CustomBrowserConfig(merchantKey,txnId);
customBrowserConfig.setPayuPostData(<Post Data>);
customBrowserConfig.setPostUrl(<Post Url>);
3. Call method addCustomBrowser() like below:
Input:
Activity : activity instance
CustomBrowserConfig : configuration object of the custom browser
PayUCustomBrowserCallback : this class provide callbacks
//Code Sample
new CustomBrowser().addCustomBrowser( Activity activity, CustomBrowserConfig customBrowserConfig, PayUCustomBrowserCallback cbPayUCustomBrowserCallback)
Create a basic object of CustomBrowserConfig like below(For more Configurations supported visit ):