Connect Ionic with PayU (payment gateway)

Hi guys, I’m trying to setup PayU as payment gateway with Ionic using their tokenization service
http://developers.payulatam.com/en/api/tokenization.html, first I tried to implement a simple call to their API and I found out they don’t receive direct calls from the app, so all calls have to be handled by server language such as PHP. I want to ask you if you guys have some samples of how to do this or if you can guide me on how to setup each step… I found this resource online of how to send data to php http://www.nikola-breznjak.com/blog/codeproject/posting-data-from-ionic-app-to-php-server/ but I’m kind of lost…

Thanks all for the help!!!

HI @juliocastrop did you got any solution?

If you got any solutions means please post this answer, i’m also struggling in this.

1 Like

Hi Guys,
able to integrate payumoney??? Please share if yes.

Hi guys, did u get any solutions about payumoney integration please share us…

HI Harish,
Did you get any solution for integrating payumoney with ionic 2 ?If you could,then can you please share us the details.That will be really helpful

This is relay ,rubbish Ionic no documentation available for it to integrate payu money.

Hi
I have been able to do it partially in ionic 2 .What I did is like below:

-End user select PayUMoney as payment option on my app.
-I take the user to next page(through navCtrl.setRoot ) which display the transaction amount and a continue button. The same html contains transaction request parameters as hidden html type.As soon as end user clicks on continue the user is taken to the PayUMoney server.

But now I am stuck at passing success/failure URL . How would I handle the success/failure case.As soon as the transaction gets completed on PayUMoney the user needs to be redirected to my App again . I don’t know how to do this.
Can anybody help in this case ?

Hello guy’s anyone did Implement it with ionic. Please provide sample code how to pass success/failure URL and handle it on app. So that I can update the DB on the basis of it.

Hi Sunil
I have been able to make it work . In my case when transaction gets complete payumoney redirects to the https://payu.herokuapp.com/success URL . As I have added eventlistener on the inappbrowser window ,on loadstop even as soon as I encounter this success url I consider it as transaction completed and then store the transaction parameter and status on my server.

I hope you have gone through https://github.com/IonicU/payuhybridappintegration.

Let me know if you have further doubt.

Yes,bro I am refering the same URL which you send me. But here how did you get the values back to your function after success response.

function iabLoadStop(event) {
if (event.url.match(“https://payu.herokuapp.com/success”)) {
console.log(iabRef);
iabRef.executeScript({
code: “document.body.innerHTML”
}, function(values) {
//incase values[0] contains result string
var a = getValue(values[0], ‘mihpayid’);
var b = getValue(values[0], ‘status’);
var c = getValue(values[0], ‘unmappedstatus’);
console.log(b);//Not able to get this values here

    });  

}
}
I am opening it in InAppBrowser, after it redirect to

https://payu.herokuapp.com/success

as Html response it provide to me. But not printed it inside iabLoadStop() function.

Are you using ionic 2 ?
Did you check whether iabLoadStop is getting called or not ?
How have you registered event on inappbrowser ?

Please bro, help me in this I am struggling from so long to make it working. but unfortunately I am not able to make it working, I am not sure what is I am missing in this.

Yes, My Ionic version is: 2.2.2
this is the code I am using.

app.controller(“PaymentController”, [’$scope’, function($scope) {
$scope.payuNow = function() {
onDeviceReadyTest();
}
}]);
function onDeviceReadyTest() {
iabRef = window.open(‘payuBiz.html’, ‘_blank’, ‘location=no’);
iabRef.addEventListener(‘loadstart’, iabLoadStart);
iabRef.addEventListener(‘loadstop’, iabLoadStop);
iabRef.addEventListener(‘loaderror’, iabLoadError);
iabRef.addEventListener(‘exit’, iabClose);
}

Did you check whether iabLoadStop is getting called or not ? Also onDeviceReadyTest ?

Will provide working code tonight ,if it can help you.

Ok, Thanks mate. I am still trying to identify what is the issue. Your help will be appreciated bro.

Ya for me also it took to long to understand and implement.Will surely help.

Yes bro, I am also struggling with this its have been 4-5 days, Thanks lot

Yes .
function onDeviceReadyTest() { alert(“yess calling Device Ready…”);

iabRef = window.open('payuBiz.html', '_blank', 'location=no');    
iabRef.addEventListener('loadstart', iabLoadStart);    
iabRef.addEventListener('loadstop', iabLoadStop);    
iabRef.addEventListener('loaderror', iabLoadError);    
iabRef.addEventListener('exit', iabClose);

}
This function get called, as soon as I press PayNow Button. but after it redirect me to .
https://payu.herokuapp.com/success.
It did not called the iabLoadStop () function.

It seems that events are not registered in your case. Till the time payment transaction gets success there will be many time the iabLoadStop function will get called . Not only when redirect to https://payu.herokuapp.com/success .