Ionic and Paypal

Is there anybody here who could make this kind of integration: Ionic and Paypal?

i implemented that with a magento backend and ionic frontend.
But it was a little bit hacky -> you need paypal start-url, success-url, fail-url.

You open a new window with the start-url suing inapp browser plugin
After that, the user sees the mobile paypal version… now you have to listen to the url-change of your created window -> if the success-url is opened you know payment success -> close the window -> success handling in your app.
If the fail-url gets opened -> payment failed -> close the window -> fail handling in your app
something like

var externalPaymentWindow = $window.open(STARTURL, '_blank', 'location=yes,enableViewportScale=yes');

// listen to page load events
externalPaymentWindow.addEventListener('loadstart', function(event) {
    var url = event.url;
    if (url.indexOf(CANCEL_URL) !== -1) {
        externalPaymentWindow.close();
        // failed
    } else if (url.indexOf(SUCCESS_URL) !== -1) {
        externalPaymentWindow.close();
        //success
    }
});

Hi, I’m trying your solution but I cannot get it working when cancelling or finishing the payment, how doy you set up the CANCEL_URL and SUCCESS_URL in the paypal’s sandbox?

thanks in advanced

Uff its a looooong time ago^^.

In the meantime they changed many things.
But you can follow this guide:
http://www.hostknox.com/clients/knowledgebase/116/How-to-set-up-a-PayPal-Sandbox-account.html
To set auto return

I followes this guide:
https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/setup.htm

But i tested this stuff for a customer and not in my paypal account. So i do not have the chance to look it up.
sry.

But maybe it helps.

Thanks, I’ll take a look