# Connect Ionic with PayU (payment gateway)

**URL:** <https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840>\
**Category:** ionic-v1\
**Created:** [December 9, 2015, 2:40pm UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840 "2015-12-09T14:40:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliocastrop](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@juliocastrop](https://forum.ionicframework.com/u/juliocastrop)\
**Post date:** [December 9, 2015, 2:40pm UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/1 "2015-12-09T14:40:55Z")

</div>

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](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/](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!!!

---

<div class="post-metadata">

**Author:** ![ramarajan03](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@ramarajan03](https://forum.ionicframework.com/u/ramarajan03)\
**Post date:** [December 18, 2015, 1:25pm UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/2 "2015-12-18T13:25:10Z")

</div>

HI @juliocastrop did you got any solution?

---

<div class="post-metadata">

**Author:** ![rvkvino](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@rvkvino](https://forum.ionicframework.com/u/rvkvino)\
**Post date:** [January 27, 2016, 7:56am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/3 "2016-01-27T07:56:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ShafeekMsv](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@ShafeekMsv](https://forum.ionicframework.com/u/ShafeekMsv)\
**Post date:** [January 28, 2016, 10:05am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/4 "2016-01-28T10:05:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![harishmss164](https://avatars.discourse-cdn.com/v4/letter/h/cdc98d/32.png) [@harishmss164](https://forum.ionicframework.com/u/harishmss164)\
**Post date:** [March 15, 2016, 9:08am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/5 "2016-03-15T09:08:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ras1kamal](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@ras1kamal](https://forum.ionicframework.com/u/ras1kamal)\
**Post date:** [April 2, 2017, 4:26am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/7 "2017-04-02T04:26:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [April 3, 2017, 7:03am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/8 "2017-04-03T07:03:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ras1kamal](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@ras1kamal](https://forum.ionicframework.com/u/ras1kamal)\
**Post date:** [April 10, 2017, 4:19pm UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/9 "2017-04-10T16:19:55Z")

</div>

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](http://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](http://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 ?

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [May 16, 2017, 9:18am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/10 "2017-05-16T09:18:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ras1kamal](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@ras1kamal](https://forum.ionicframework.com/u/ras1kamal)\
**Post date:** [May 16, 2017, 9:50am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/11 "2017-05-16T09:50:29Z")

</div>

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](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](https://github.com/IonicU/payuhybridappintegration).

Let me know if you have further doubt.

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [May 16, 2017, 9:55am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/12 "2017-05-16T09:55:44Z")

</div>

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](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](https://payu.herokuapp.com/success)

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

---

<div class="post-metadata">

**Author:** ![ras1kamal](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@ras1kamal](https://forum.ionicframework.com/u/ras1kamal)\
**Post date:** [May 16, 2017, 10:02am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/13 "2017-05-16T10:02:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [May 16, 2017, 10:03am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/14 "2017-05-16T10:03:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [May 16, 2017, 10:10am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/15 "2017-05-16T10:10:00Z")

</div>

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);  
}

---

<div class="post-metadata">

**Author:** ![ras1kamal](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@ras1kamal](https://forum.ionicframework.com/u/ras1kamal)\
**Post date:** [May 16, 2017, 10:12am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/16 "2017-05-16T10:12:54Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [May 16, 2017, 10:16am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/17 "2017-05-16T10:16:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ras1kamal](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@ras1kamal](https://forum.ionicframework.com/u/ras1kamal)\
**Post date:** [May 16, 2017, 10:16am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/18 "2017-05-16T10:16:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [May 16, 2017, 10:19am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/19 "2017-05-16T10:19:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunilrawat](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sunilrawat/32/112510_2.png) [@sunilrawat](https://forum.ionicframework.com/u/sunilrawat)\
**Post date:** [May 16, 2017, 10:25am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/20 "2017-05-16T10:25:52Z")

</div>

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](https://payu.herokuapp.com/success).  
It did not called the iabLoadStop () function.

---

<div class="post-metadata">

**Author:** ![ras1kamal](https://avatars.discourse-cdn.com/v4/letter/r/c37758/32.png) [@ras1kamal](https://forum.ionicframework.com/u/ras1kamal)\
**Post date:** [May 16, 2017, 10:31am UTC](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840/21 "2017-05-16T10:31:14Z")

</div>

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](https://payu.herokuapp.com/success) .

[Next page](https://forum.ionicframework.com/t/connect-ionic-with-payu-payment-gateway/38840.md?page=2)
