PayPal in-context checkout - Acess Denied - paypal

We are implementing PayPal in-context checkout on our e-commerce site. Everything works fine in Chrome and FF but in IE11 the pop out window hangs on redirecting back to our site. Console show Access Denied error in PayPall app.js script on this piece of code:
if (window.miniBrowser && navigator.userAgent.match(/msie|trident/i)) {
var bridge = window.opener.frames['PayPalBridge'];
if (bridge && typeof(bridge) !== "undefined" && typeof(bridge.returnToParent) !== "undefined") {
bridge.returnToParent(msg);
}
} else {
window.opener.postMessage(msg,"*");
}
I switched all security levels to lowest possible, tried to add both sites (ours and sandbox.paypal.com) to Trusted zone but it didn't help. Any ideas what can be wrong or how can we work around this issue?

This was my bad. Didn't setup PayPal module properly. Environment info was missing so PayPal assumed production while generating IFrame. As I was using sandbox on my test site it resulted with cross-domain operation which was blocked by IE.

Related

Codenameone browser issues with paypal checkout express

So I've been trying to find an API to integrate PayPal Payment into my Codename One App, except that I didn't find enough documentation to use the Purchase builtin feature. So I tried to use a WebView of a page hosted on my server and implemented using the paypal "checkout.js" Api.
When I load the page into Chrome, it works perfectly and the transaction is complete. But when I load it using the codename one BrowserComponent it gets stuck (See screenshot). What is the root of this problem ? Is it the fact that the browser does not support popus ? and Is there a way to fix it ?
Button payButton = new Button("Checkout");
payButton.addActionListener((ActionEvent evt) -> {
Form payForm = new Form("Payment", new BorderLayout());
WebBrowser webBrowser = new WebBrowser("http://localhost/paymentserver/web/app_dev.php/payerParticipation/5");
payForm.add(BorderLayout.CENTER, webBrowser);
payForm.show();
});
Screenshot
Try embedding firebug into the of your page to see if it reports any errors:
<script>
if (!document.getElementById('FirebugLite')){E = document['createElement' + 'NS'] && document.documentElement.namespaceURI;E = E ? document'createElement' + 'NS' : document'createElement';E'setAttribute';E'setAttribute';E'setAttribute';(document'getElementsByTagName'[0] || document'getElementsByTagName'[0]).appendChild(E);E = new Image;E'setAttribute';}
</script>
Thanks for the help everybody,
I finally found a turnaround and implemented this feature on a PHP server using PayPal PHP SDK. I used the browser Navigation Callback in order to check when the payment was successful/failed.
browser.setNavigationCallback((url)->{
if (url.indexOf("success=true")!=-1){
System.out.println("Payment complete");
}
else if (url.indexOf("success=false")!=-1){
System.out.println("Payment failed");
}
return true;
});
I don't have an answer for that but I did implement Braintree support for Codename One which is the official PayPal mobile API. I have a cn1lib for it implemented but I didn't get around to publishing it because of the bootcamp. Keep an eye on the blog I'll probably publish it in the next couple of weeks.

PayPal API login error - "Sorry, we can't log you in.."

I am using the paypal api login with this:
paypal.use( ['login'], function (login) {
login.render ({
"appid":"myAppID",
"authend": "sandbox",
"scopes":"email",
"containerid":"lippButton",
"locale":"en-us",
"returnurl":"myReturnUrl"
});
});
when I click on lippButton paypal opens with forms for email and password. When they are filled in I get the error:
Sorry, we can't log you in. If you think there's a problem with your
account, contact us and we'll help resolve it.
Even though If I redirect the user to login/complete payment it is fine. Any ideas as to what the problem is?
EDIT:
Seems like it may just be the sandbox api is down. I went here:
https://devtools-paypal.com/guide/openid/php?success=true&env=sandbox
and clicked "Try it" then clicked on the link for step 2, which pops up an identical login form that I am using and the error message persists there as well.
EDIT:
Can anyone explain how I can log in to paypal, but not from their sandbox using my paypal credentials?
I found the problem. For anyone in the future with this same problem (I'm assuming many will because it is directly following their walk through), you seem to not be able to log in via "sandbox" mode (even though their provided code sample has authend: "sandbox" in it).
Simply put in your live credentials INSTEAD of your sandbox credentials. The log in should look like this (There should be no 'authend: "sandbox"' now):
paypal.use( ['login'], function (login) {
login.render ({
"appid":"myAppID", //Use your live client ID, not your sandbox client ID.
//No authend needed.
"scopes":"email",
"containerid":"lippButton",
"locale":"en-us",
"returnurl":"myReturnUrl"
});
});
And the login now works and allows you to login.

AgileToolkit OAuth add-on error 500 at facebook's mobile site

I am using the OAuth Facebook controller add-on for ATK4.
It works as expected when authenticating with Facebook from a regular desktop browser.
It works when authenticating using a mobile browser that is telling face book that it's a desktop browser.
It does not work when Facebook detects a mobile browser and redirects to m.facebook.com/dialog/oath.
What's more, is that it works fine for signups from mobile browsers (ie, when Facebook asks the user to give permission to the app).
The login flow stops with an Error 500 at:
https://m.facebook.com/dialog/oauth?redirect_uri={my_url_encoded_landing_page_where_the_OAuth_controller_lives}&scope=email&client_id={fb_app_id}
What the hell is going on here? There isn't some difference between the Facebook mobile service and the regular one that the addon isn't taking care of, or is there?
It must be something I'm doing wrong. In init() on the page that handles the FB, I am doing the following:
function init(){
parent::init();
$f = $this->add("oauth/Controller_OAuth_Facebook", array('sign_method'=>'PLAINTEXT'));
if ($fbtoken = $f->check()) {
$f->setSignatureInfo();
$f->setAuthToken($fbtoken["access_token"], $fbtoken["expires"]);
$s = $this->add("sni/Controller_SNI_Facebook");
$s->setOAuth($f);
// ...
// grab profile from SNI, database lookup, session stuff, etc
// ...
}
}
I've tried all three sign_methods, and tried leaving it alone, but that doesn't make much difference because the user is not making it back to the controller with an access token to use anyway.
I tried creating a new app with Facebook and I get the same issues with a basically vanilla configuration on that. I've only marked and specified the "Website with Facebook Login" site URL integration.
The image below was captured from Chrome after overriding the user agent to a mobile device to trigger the forward to facebook's mobile servers:
Screen shot of request
Facebook closed my bug report with them stating that it's not an issue since no one else is reporting the bug. I am removing the ATK4 tag, as I get the same issue using the example PHP code provided by Facebook on GIT.
Created dedicated example here:
http://demo.ambienttech.lv/d.html?ns=d3
Example is downloadable and includes instructions of setting up facebook app as well. See if that helps.
Try This:
<?php
class page_fb extends Page {
function init(){
parent::init();
$f = $this->add("oauth/Controller_OAuth_Facebook");
$fbtoken = $this->api->recall("fbtoken");
if ($m = $_GET["error_msg"]){
$v=$this->add("View_Error");
$v->add("Text")->setHTML("You can't connect to the application.");
$v->add("Button")->setHTML("Try again")->js("click", $this->js()->univ()->location("fb"));
return;
}
if (!$fbtoken){
if ($fbtoken = $f->check("email")){
$this->api->memorize("fbtoken", $fbtoken);
$this->api->redirect($this->api->url("/index"));
}
} else {
$f->setSignatureInfo();
$f->setAuthToken($fbtoken["access_token"], $fbtoken["expires"]);
$c = $this->add("sni/Controller_SNI_Facebook");
$c->setOAuth($f);
if (!$this->api->recall("fbuserinfo")){
$this->api->memorize("fbuserinfo", $c->getUserProfile());
}
$info = $this->api->recall("fbuserinfo");
$username = $info->username;
$img = $c->customRequest("/" . $username . "/picture?type=large");
$this->api->memorize("userimg", $img);
$this->api->memorize("userinfo", $info);
if (!$this->api->auth->isLoggedIn()){
$this->api->auth->login($info->email);
}
$this->api->redirect($this->api->url("/index"));
}
}
}
I've got the same problem, but using PHP: just using a mobile web browser is not working, giving '500 internal server error'.
I'm just asking myself if exists a parameter for the method getLoginUrl to force return a non-mobile version of the authentication page...
I reported this issue here: https://github.com/atk4/atk4-addons/issues/35
Please stay tuned and if you can, you can always make changes yourself and pull request.
I can't test and fix this because strangely I still don't have smart phone :(
Something changed in FB's mobile OAuth service that is causing the error. I ran a test with my code base on a shorter URL (ie; http://domain.net/fb/ rather than http://development.project.domain.net/fb) and it works fine. I am not entirely sure of what exactly is causing the problem as Facebook refuses to acknowledge the issue as being on their server, but I have a few possible culprits that may be triggering the error on their side, but since they don't care, I don't either, and I am providing my results for anyone else who encounters this bs.
The environment I am developing in uses semi-complex (apparently) naming scheme. The development server has its own hostname under a subdomain. The issue may be caused by the fact that there are multiple components to the host portion of the URL or simply too many characters.
The name servers for the development environment are provided by DynDNS. Facebook's mobile OAuth service may be choking on the idea of a development site being hosted on a non-permanent IP address.
I'm not going to do anymore testing on this because it really is a problem with Facebook, not my code or servers, and it will work in production.

PayPal Sandbox suddenly outputting proxy error for adaptive payments

Edit: For some reason it's working again. I did not need to log in to developer.paypal.com either. If anyone knows why, that would be useful. Thanks!
For the past few months I have been developing a site using PayPal's adaptive payments, specifically the chained payments method. I am using the embedded payment method from a site that uses SSL. The integration had been working perfectly for months until a day or two ago. It was even still working right after I imported my old sandbox accounts to the new developer.paypal.com sandbox.
After submitting the payment from the site's form, the browser spins for a minute or two. The error generated after a few minutes is the following:
The proxy server could not handle the request GET
/webapps/adaptivepayment/flow/corepay Reason: Error during SSL
Handshake with remote server
$API_UserName = "us business account from developer.paypal.com sandbox";
$API_Password = "password from developer.paypal.com sandbox";
$API_Signature = "singature from developer.paypal.com sandbox";
// AppID is preset for sandbox use
// If your application goes live, you will be assigned a value for the live environment by PayPal as part of the live onboarding process
$API_AppID = "APP-80W284485P519543T";
$API_Endpoint = "";
if ($Env == "sandbox")
{
$API_Endpoint = "https://svcs.sandbox.paypal.com/AdaptivePayments";
}
else
{
$API_Endpoint = "https://svcs.paypal.com/AdaptivePayments";
}
If I am not mistaken, I believe the error is being generated when the redirect happens from this function here:
function RedirectToPayPal ( $cmd )
{
// Redirect to paypal.com here
global $Env;
$payPalURL = "";
if ($Env == "sandbox")
{
$payPalURL = 'https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?expType='.$_POST['expType'].$cmd;
}
else
{
$payPalURL = "https://www.paypal.com/webscr?" . $cmd;
}
header("Location: ".$payPalURL);
exit;
}
Edit: I changed the $payPalURL to "https://developer.paypal.com..." as suggested and got the following:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to
maintenance downtime or capacity problems. Please try again later.
After the recent code change this flow now requires you to log in to https://developer.paypal.com first. I am checking to see if this was intentional or is a code bug.
There appears to have been an issue with the sandbox.paypal.com server that disabled adaptive payments for a couple days. Everything seems to be functioning as it had been previously. Thank you to Dennis for his input.
Edit:
This appears to be ongoing and intermittent

Facebook Connect Problems With Grails

I am trying to use the Grails Facebook Authentication plugin but am running into problem. I have (I believe) successfully installed the plugin, put a facebook connect control on a page, and ran the installation script.
When I click on the Facebook Connect button I am correctly brought to Facebook, where I login correctly. At this point the popup closes and nothing happens. I have a custom FacebookAuthService but no breakpoints inside ever get called. I believe I have either 1) hooked up the Service incorrectly or 2) hosed up my Facebook settings so that I am not getting the information back, but I am not sure how to diagnose the problem.
When I run the app locally, it runs on http://localhost:8080/TestApp
In my Facebook App Settings I have tried using "http://localhost", "http://localhost:8080", and "http://localhost:8080/TestApp" as the Site URL and I have "localhost" as the App Domain. What am I missing?
Here is a link to the GitHub Project (I've changed the fb private key).
Any ideas? Thanks.
Button authorize you only on client side, because of Facebook Javascript SDK. Please reload page after susseccful authization, like:
FB.getLoginStatus(function(response) {
if (typeof(response) == 'undefined') {
return
}
if (response.status == 'connected') {
window.location.reload();
}
})
The JS SDK does not currently have support for non-standard ports in this scenario, but come Tuesday, this will be corrected, and it will once again support it.