3

I was integrating the payU payment API in my Ionic app. I was able to get the payment success url of payU but the InAppBrowser excuteScript() method is not returning the innerHtml of the payment success url .

Please provide an relevant solution .

Please find my code below.

onDeviceReadyTest(url) {
    console.log('url passed'+ url);

  //let browser = new InAppBrowser(url,'_blank');

  const browser = this.iab.create(url,'_blank');

  browser.on('loadstart').subscribe(
  (res) => {
    // Handle url checking and body parsing here
    console.log('event start with ' + res.url);
   },
   (error) => {
    // Handle error here
    console.log(error);
   }
   );

   browser.on('loadstop').subscribe(
      (res) => {
    // Handle url checking and body parsing here
    console.log('event stop with ' + res.url);
    if(res.url.match("https://payu.herokuapp.com/success")) {
    console.log('event match with ' + res.url);
     //alert( browser.innerHTML);


    browser.executeScript({code:"document.body.innerText"}),
       function(values){

         alert( values[ 0 ] );
         var a = this.getValue(values[0], 'mihpayid');
         var b = this.getValue(values[0], 'status');
         var c = this.getValue(values[0], 'unmappedstatus');
         console.log(a + b + c);//you can capture values from return 

         }
       }
       },
     (error) => {
    // Handle error here
    console.log(error);
      }
    );

  this.iabRef.addEventListener('loadstart', this.iabLoadStart);
  this.iabRef.addEventListener('loadstop', this.iabLoadStop);
  this.iabRef.addEventListener('loaderror', this.iabLoadError);
  this.iabRef.addEventListener('exit', this.iabClose);
  }`
Sampath
  • 63,341
  • 64
  • 307
  • 441
pushpank
  • 262
  • 3
  • 9

0 Answers0