如何使用沙箱测试 Paypal 订阅按钮?
经过 5 个小时的研究和阅读过时的 paypal 文档后,我终于放弃了!
我需要使用贝宝沙箱测试一个简单的贝宝订阅按钮。
按钮代码:
<form action="https://www.sandbox.paypal.com/us/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="34CXHXVU2J8BY">
<input type="image"
src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_subscribeCC_LG.gif"
border="0" name="submit"
alt="PayPal — The safer, easier way to pay online."
style="border:none;padding:0;height:auto;width:auto">
<img alt="" border="0"
src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif"
width="1" height="1">
</form>
但是当我尝试发送表单时,我在 paypal 网站上收到此错误:
提前致谢, 菲利普
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
问题是您已在实时 PayPal 网站中生成了“托管”PayPal 按钮,但您正在将此数据发送到沙盒。
由于沙盒中无法识别
hosted_button_id
,因此它会返回错误。您需要:
www.sandbox.paypal 在 Sandbox 中创建一个新的“托管”按钮.com >简介> PayPal 按钮。
TL;DR:沙箱与 Live PayPal 网站 100% 分离。在 Live 中生成的托管按钮在 Sandbox 中不起作用。
The problem is that you've generated a 'hosted' PayPal button in the live PayPal website, but you're sending this data to the Sandbox.
Since the
hosted_button_id
isn't recognized in the Sandbox, it returns an error.You'd need to either:
www.sandbox.paypal.com > Profile > PayPal Buttons.
TL;DR: Sandbox is 100% separated from the Live PayPal website. A hosted button generated in Live, doesn't work in Sandbox.
只需简单添加如何在沙箱中创建托管按钮:
https://developer.paypal.com/
记住密码,并确保密码包含数字或
您将无法使用它登录。
当然你不要停留太久,它在没有告诉我的情况下就让我退出了
当我第一次摆弄按钮时,我得到了一个空白的代码字段。
希望这可以节省您一些时间:)
Just a short add how to make the hosted button in the sandbox:
https://developer.paypal.com/
remember the password, and make sure the password contain numbers or
you will not be able to log in with it.
sure you dont dwell too long, it logged me out without telling me so
and I got a blank code field first time I fiddled with my button.
Hopefully this saved you some time :)
也许这会有所帮助: https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ButtonMgrAPIIntro
Perhaps this will help: https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ButtonMgrAPIIntro
是的,确实如此,PayPal 确实这么认为 在单独的沙箱系统中创建另一个按钮相当于“测试”。嗯,不,贝宝测试的目的是测试实际的东西,而不是你在另一个系统中从头开始制作的东西的副本。如果某些事情以不同的方式完成(错误地完成,这是测试的重点)或者在其他系统中进行设置时出现错误怎么办?这不是测试。这是在做一个试验。
所以在回答这个问题时,你不能用沙箱测试PayPal按钮,你只能进行试验。实际测试 PayPal 按钮的唯一方法是在测试时将价格降低到较小的水平,例如一美分,或者只是付款然后退款。
Yes, it's true, PayPal actually thinks creating another button in a separate sandbox system is equivalent to "testing". Erm, no, the point of testing, PayPal, is to test the actual thing, not a copy of the thing you make from scratch in another system. What if something is done differently (by mistake, which is the point of testing) or goes wrong when setting it up in the other system? This is not testing. This is doing a trial.
So in answer to the question, you can't test a PayPal button with sandbox, you can only do trials. The only way to actually test a PayPal button, is to reduce the price to something small while testing, like a cent, or just pay for it and then refund.
是的,您还可以通过以下步骤在沙盒上进行测试:
希望这些步骤对您有用。
Yes, you can test also on sandbox with following steps:
Hope, These steps are useful to you.
现在是:
该按钮现在可能已被弃用,因为开发人员网站似乎不再有它。
This is now:
It is possible this button is now deprecated because the developer site does not seem to have it anymore.
REST API 应用程序
单击所需的APP
沙盒帐户
&客户端 ID
沙盒帐户
并点击管理(3点)
,然后查看/编辑帐户
系统生成的密码
或更改密码
沙盒帐户
登录 +系统生成的密码
P-2BPE0RQ33UO7KJ5A8GV0AE08
$clientId
替换为 (3)Client ID
代码:导航至https://developer.paypal.com/dashboard/accounts再次
This是时候找到您的
个人帐户
,而不是企业帐户
复制电子邮件地址
点击
管理(3 点)
,然后点击查看/编辑帐户
复制您的
系统生成的密码
或更改密码
使用此
个人帐户
测试您的按钮如果一切顺利,您将收到订阅警报
REST API apps
click your desiredAPP
Sandbox Account
&Client ID
Sandbox Account
and clickManage (3 Dots)
thenView/Edit Account
System Generated Password
orChange Password
Sandbox Account
+System Generated Password
P-2BPE0RQ33UO7KJ5A8GV0AE08
$clientId
with yourClient ID
from (3)Navigate to https://developer.paypal.com/dashboard/accounts again
This time locate your
Personal Account
, not theBusiness Account
Copy the email address
Click
Manage (3 Dots)
thenView/Edit Account
Copy your
System Generated Password
orChange Password
Test your button using this
Personal Account
If everything goes well you will get a Subscribed alert