POST 到 PayPal 的示例 URL(不带“表单”)

发布于 2024-09-24 23:35:32 字数 994 浏览 0 评论 0原文

在贝宝平台上测试付款交易时,我在将数据发布到特定 URL 时遇到一些问题。尽管在技术上更加了解,但我选择不使用他们的 API 和 NVP 平台,因为需要首先创建交易,然后返回并必须创建重复配置文件(而不是一次全部创建 - 在我看来是愚蠢的设计) 。

最终,我试图将已加密的数据放入特定变量中,并将该数据发布到所选的 URL,而不必将其视为用户单击提交的表单。

我的 HTML 表单有效 - 代码是:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank">';
<input type="hidden" name="cmd" value="_s-xclick"/>';
<input type="hidden" name="encrypted" value="'.$encrypted.'"/>';
<input type="submit" value="Go to checkout" name="submit" class="cartButton" />';
</form>

其中 $encrypted 是我的加密参数。虽然代码有效 - 我不希望用户单击要发送到表单的链接。相反,我希望用户单击一个按钮,该按钮首先运行 PHP 脚本以将数据存储在临时数据库中,然后将所需的元素(CMD 和 ENCRYPTED)推送到帖子 URL(https://www.sandbox.paypal.com) /cgi-bin/webscr)。

有什么想法如何实现这一点?是否可以?我的网站使用 PHP 和 mySQL。 使用任何类型的 Javascript 都不是解决方案。

编辑 1

我已将其设置为使用 cURL 作为发布数据的可能方式,但发生了两件事:1)我没有收到任何响应, 2) 在数据库插入发生后,消费者实际上需要被重定向到包含已发布数据的 paypal 支付页面。

I am having some issue posting data to a specific URL when testing payment transactions on the paypal platform. Although much more technically understood, I chose not to use their API and NVP platform because of the requirement to FIRST create a transaction, then come back and have to create a recurring profile (as opposed to all at once - stupid design in my opinion).

Ultimately, I am trying to take data I have encrypted into a specific variable and post that data to a URL of choice WITHOUT having to treat it as a form where user clicks submit.

My HTML form works - the code is:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank">';
<input type="hidden" name="cmd" value="_s-xclick"/>';
<input type="hidden" name="encrypted" value="'.$encrypted.'"/>';
<input type="submit" value="Go to checkout" name="submit" class="cartButton" />';
</form>

where $encrypted are my encrypted parameters. While the code works - I do not want to have the user click a link to be sent to the form. Instead, I want the user to click a button which first runs a PHP script to store the data in a temporary database THEN push the required elements (CMD and ENCRYPTED) to the post URL (https://www.sandbox.paypal.com/cgi-bin/webscr).

Any ideas how to accomplish this? Is it possible? I use PHP and mySQL for my site. Using Javascript of any kind is not a solution.

EDIT 1

I have it set up to use cURL as a possible way to POST the data but two things are happening: 1) I am getting no response whatsoever, 2) the consumer actually needs to be redirected to the paypal payment pages with the posted data after the database insert has taken place.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

千仐 2024-10-01 23:35:32

这是不可能的,但还有另一种方法:您触发一个异步后台 javascript 事件,该事件触发一个帖子到您自己的服务器以存储数据...以及另一个同步前台事件,该事件将表单发送到 PayPal 进行安全处理。

its not possible but there is another way: you fire one asynchronous background javascript event that fires a post to your own server to store the data... and another synchronous foreground event that sends the form to PayPal for secure processing.

寂寞笑我太脆弱 2024-10-01 23:35:32

您可以使用 cURL 将数据发布到 URL。

You could use cURL to post data to the URL.

放血 2024-10-01 23:35:32

您是否考虑过通过 wget 管道传输数据?

Have you considered piping the data through wget?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文