Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adaptive Payments without modal box or popups?

Is it possible to launch the payflow entirely inline (a la Express Checkout)? How?

We're using chained payments and everything works on non-iOS-mobile devices (and in Chrome for iOS), but we're making a web app, so we need this to work on phones. Testing on the iPhone, we have this problem with PayPal's code that I've already asked about, as well as the fact that when I get around that bug by doing a location.replace with the URL to PayPal (or loading it in a lightbox of my own design), iOS and mobile Safari kill the "Log In" popup (without giving the user an opportunity to view it if they so choose).

In short, is there any way I can use Adaptive Payments without ridiculous 1990s-era popups???

like image 536
Ben Y Avatar asked Jun 24 '13 19:06

Ben Y


1 Answers

Here's what I'm doing to use PayPal's mobile web flow. I'm testing on Android and it's working well. The only hang up is the callbackFunction is not firing in mobile browsers and works fine in desktop browsers. (I'm still working on this part. Let me know if you solve it.) Here's an example on how to do it using expType=mini to launch the PayPal mini browser experience.

First include the Javascript for the Mini flow:

<script src="http://www.paypalobjects.com/js/external/apdg.js"></script>

Then a link to launch the redirect:

<a id="payPalRedirect" href="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?paykey={paykey}&expType=mini" target="_blank">Complete PayPal Payment</a>
<br /><br />
<div id="resultDiv"></div>

And some Javascript to initiate the Mini Flow process and the callbackFunction:

        var returnFromPayPal = function () {
           alert("Returned from PayPal");
           var div = document.getElementById('resultDiv');
           div.innerHTML = "Returned from PayPal!";
           // Here you would need to pass on the payKey to your server side handle to call the PaymentDetails API to make sure Payment has been successful or not
           // based on the payment status- redirect to your success or cancel/failed urls
       }
       var dgFlowMini = new PAYPAL.apps.DGFlowMini({ trigger: 'payPalRedirect', expType: 'mini', callbackFunction: 'returnFromPayPal' });

More insights and solution options to this issue can be found here:

Paypal Embedded Flow not using returnUrl or cancelUrl

like image 69
James Avatar answered Oct 25 '22 14:10

James