Jeevan Tomson
Jeevan Tomson

Reputation: 11

How to redirect back to cordova application after successful payment

I am using InAppBrowser to redirect to payment gateway to accept payment. But could not redirect back to the app after payment. Please help.

Upvotes: 1

Views: 1356

Answers (2)

Apoorv
Apoorv

Reputation: 1389

try this code

 let browser = window.open('https://www.payumoney.com/paybypayumoney/#/abcd1234', '_self');
     browser.addEventListener('loadstart',function(event){
      console.log(event)
      if (event["url"] == "http://localhost:3000/capture_successfull_payment") {
         browser.close()
        }
       });

Upvotes: 1

Aftab Dalla
Aftab Dalla

Reputation: 17

There is no way you can achieve it directly. Alternatively, use inappbrowser to open the redirection and success page (which will obviously reside on your server).

Use the exit event of inappbrowser to execute your javascript function of cordova app which internally redirects to success page.

Hope this helps !

Upvotes: 1

Related Questions