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
  • Include the SDK in your Application
  • Initiate the SDK
  • Override these Callbacks

Was this helpful?

  1. Android
  2. PayU OTP Parser

Integration

Integration with the PayU OTP Parser SDK in 3 steps:

  1. Include the SDK in your application.

  2. Initiate the SDK.

  3. Override these callbacks

Include the SDK in your Application

Add below dependency in the application's build.gradle.

implementation 'in.payu:native-otp-reader:1.1.3'

Initiate the SDK

OtpParser otpParser = OtpParser.Companion.getInstance(ComponentActivity activity);
otpParser.startListening(OtpCallback otpCallback)
    
    OtpCallback otpCallback = new OtpCallback() {
           @Override
           public void onOtpReceived(@NotNull String otp) {
             //When user gets the OTP  
           }

           @Override
           public void onUserDenied() {
//User user denied the permission
           }
       };
 val otpParser = OtpParser.getInstance(activity: ComponentActivity)
 otpParser?.startListening(otpCallback: OtpCallback)
 
   val otpCallback= object:  OtpCallback {
            override fun onOtpReceived(otp: String) {
         //When user gets the OTP  
               }

            override fun onUserDenied() {
           //User user denied the permission
             }

        }
 

Override these Callbacks

You need to override these ActivityCompat callbacks and call OtpParser methods.

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   
             otpParser.onRequestPermissionsResult(requestCode, permissions, grantResults);
//calling OtpParser onRequestPermissionsResult
   }
     
     @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
      
          otpParser.onActivityResult(requestCode, resultCode, data);
        //calling OtpParser onActivityResult

    }

   
  override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
       
         otpParser?.onRequestPermissionsResult(requestCode, permissions, grantResults)
   //calling OtpParser onRequestPermissionsResult
     }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
       
         otpParser?.onActivityResult(requestCode,resultCode,data)
    //calling OtpParser onActivityResult
    }
 
PreviousPayU OTP ParserNextFAQ Android

Last updated 3 years ago

Was this helpful?