将表单发送到Windows Phone上使用Cordova的外部Paypal窗口 [英] Post form to external Paypal window on Windows Phone with Cordova

查看:166
本文介绍了将表单发送到Windows Phone上使用Cordova的外部Paypal窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是我上一个问题的延续这里

This question is a continuation to my previous question here.

我试图将信息发送到Paypal。该应用程序目前使用针对Windows Phone 8的Cordova上的Javascript和HTML5构建。

I'm trying to post a form with information to Paypal. The application is currently built using Javascript and HTML5 on Cordova targeting Windows Phone 8.

我已经设法使用Cordova提供的InAppBrowser插件所以外部链接在本地浏览器而不是在应用程序内打开)。但是,我似乎不能以相同的方式张贴表格。我已经在一个单独的窗口中打开Sandbox Paypal URL,但没有发布任何信息。

I've managed to get regular external links to open using the InAppBrowser plugin provided by Cordova (so external links open in the native browser instead of inside the app). However, I can't seem to be able to post a form in the same way. I've gotten as far as being able to open the Sandbox Paypal URL in a separate window, but none of the information is being posted.

这里是一个代码片段: / p>

Here's a code snippet:

$(document).on("click", "#buyNow", function() {
    var form = document.forms[0];
    window.open(form.action, '_system', 'location=yes');
    form.submit();
});

其中 form.action https://www.sandbox.paypal.com/cgi-bin/webscr

上面的代码片段是作为解决方案提供的,但是我只能获取打开操作URL(这是我的情况下的沙箱Paypal URL),没有任何

The above snippet is being offered as the solution, but I can only get as far as opening the action URL (which is the sandbox Paypal URL in my case), without any of the posted data.

任何建议?

推荐答案

完全删除表单元素并将参数直接插入到URL中。我遵循本指南: https://developer.paypal .com / docs / classic / paypal-payments-standard / integration-guide / Appx_websitestandard_htmlvariables /

I solved this by removing the form element completely and inserting the parameters directly into the URL. I followed this guide: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

例如,我安装了一个按钮, code> onclick 事件,并打开一个带有相应Paypal参数的新窗口。

As an example, I rigged a button that detects an onclick event and opens a new window with the corresponding Paypal parameters.

$(document).on("click", "#buyNow", function() {
   window.open(form.action + "?cmd=_xclick&business=your_email_here@email.com&item_name=Test&item_number=1&amount=4&currency_code=EUR", '_system', 'location=yes');
});

这篇关于将表单发送到Windows Phone上使用Cordova的外部Paypal窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆