我今天花了 9 个小时在 Paypal 上工作,但我遇到了一个找不到解决方案的问题。
我正在使用 Paypal Javascript Buttons用于创建简单的动态页面生成按钮的 github 脚本 立即购买 交易。
按钮示例输出由 PHP 生成(因此是动态的),如下所示(具有沙箱详细信息):
<script src='https://site-addr/includes/js/paypal-button.min.js?merchant=siteemail-facilitator@gmail.com'
data-callback='https://site-addr/account/listener.php'
data-tax='0'
data-env='sandbox'
data-shipping='0'
data-currency='GBP'
data-amount='1.00'
data-quantity='1'
data-custom='$2y$10$BdA/7xN2S/fzRq8X9p4pFOmzYBpia/u7sWsAcWN/4w9NZVXduaUzu'
data-number='20165'
data-size='Large'
data-locale='UK'
data-host='www.sandbox.paypal.com'
data-type='button'
data-cancel_return='https://site-addr/account/basket.php'
data-return='https://site-addr/account/complete.php'
data-name='Site Name Tickets'
data-button='buynow'
async='async'></script>
这会生成一个非常好的简单点击表单,用于通过 Paypal 界面进行购买。
同时,我已经下载了IPN listener from the Paypal Github并根据需要更新详细信息,同时下载
cacert.pem
文件from here .
我已经运行了 Paypal IPN simulator其中给我正确的结果 通过我的
listener.php
文件,提供完整数据的正确提要和 VERIFIED
每次我运行测试。问题
但是,当我使用上述详细信息运行沙盒购买时,购买运行正确,但我没有收到 IPN 监听器的反馈,我的 sandbox Transaction notifications 上也没有交易详细信息。 .但是我做 获取有关购买成功且购买已完成的沙盒 Paypal 帐户的详细信息。
我尝试过的东西
我已经阅读了很多 Paypal 文档,发现他们提供清晰简洁的指南来设置 Paypal 的任何内容的方法非常令人担忧。我已经阅读了大约 40 页他们的文档,包括从 Stack Overflow(他们 P aypal directly reference 提供有用的解决方案而不是提供他们自己的解决方案)中找出各种有用的帖子。
尝试过但失败的解决方案:
web_accept
类型。 data-notify_url
而不是 data-callback
正如 JavascriptButton github 上指定的那样data-notify_url='https://site-addr/account/listener.php'
但以上替换
data-callback
不起作用。交易似乎仍然成功,但没有记录交易或 IPN 数据。data-
实体,没有成功。 进一步的考虑
我相信你们中的一些人会说,我应该使用 SDK 下载来做这种事情,但是 SDK 的范围很大,我的需求相对简单,而且 Paypal 文档还有很多东西要处理设计的。他们(在一系列 Paypal github 存款上)也在使用
MySQL_
请求示例代码以及 addslashes
和其他已经过时的东西。另外值得注意的是,虽然 Javascript 按钮生成器的 Paypal 文档接受帐户电子邮件或帐户代码,但提供帐户代码会导致严重错误并阻止处理付款(真实或沙盒)。
再加上在文档中只找到零碎的指导信息和“循环”,这样我就在一个主题上,它说“哦,如果你想了解如何做到这一点,请点击此链接”,和然后按照链接,它是为非开发人员编写的更详细的文本(在开发人员门户上),然后是指向另一个文本块的链接,然后再返回到文本的链接以开始。
对不起,这变成了 Paypal 的提示,但我希望尽可能避免使用庞大的 SDK 系统来进行直接发送和接收数据的操作。
有解决此问题的有用示例吗?
最后说明:
上个月我在Stripe上做了一个支付系统做完全相同的事情,花了四个小时并且完美地工作。
(我不能在这里使用 Stripe,因为客户有一个现有的 Paypal 账户并且不会改变)。
Solution:
With the help from David Nguyens answer below, I found the issue in my case was that I had set up the IPN and enabled the IPN and given the correct address for it, but this was on the Live account rather than the sandbox account, despite only setting up the sandbox account after all the details on the live one had been applied.
Paypals Live and Sandbox profiles are entirely mutually exclusive and sandbox creation will not import any data from the live account it is associated with.
最佳答案
在 Paypal 上进一步解决问题
关于javascript - Paypal 不会将沙盒交易数据发送到 IPN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37213183/