Codenameone浏览器问题与PayPal结帐特快

问题描述:

所以我一直在试图找到一个API来将PayPal支付整合到我的Codename One App中,除了我没有找到足够的文档来使用Purchase builtin功能。所以我尝试使用托管在我的服务器上的页面的WebView,并使用PayPal“checkout.js”Api实现。Codenameone浏览器问题与PayPal结帐特快

当我将页面加载到Chrome中时,它完美地工作并且事务完成。但是,当我使用一个BrowserComponent代码名加载它时,它会卡住(见截图)。这个问题的根源是什么?浏览器是否支持popus?有没有办法解决它?

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

我没有一个答案,但我没有实施代号一个布伦特里支持,这是官方的PayPal移动API。我有一个cn1lib它的实施,但我没有得到周围发布它,因为训练营。请关注博客,我可能会在接下来的几周内发布它。

尝试嵌入萤火虫到您的网页,看看它是否报告任何错误:

 
<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> 

感谢您的帮助大家,

我终于找到了转机,并在实现这一功能使用PayPal PHP SDK的PHP服务器。我使用浏览器导航回叫功能来检查付款是成功还是失败。

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