Html 如何使用沙盒测试 Paypal 订阅按钮?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8683483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 12:13:46  来源:igfitidea点击:

How do I test Paypal subscription buttons with sandbox?

htmlpaypalsubscriptionpaypal-sandboxpaypal-subscriptions

提问by stdclass

after 5 hours of research and reading outdated paypal documentation I finally give up!

经过 5 个小时的研究和阅读过时的贝宝文档,我终于放弃了!

I need to test a simple paypal subscription button with the paypal sandbox.

我需要使用贝宝沙箱测试一个简单的贝宝订阅按钮。

Button Code:

按钮代码:

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

But when I try to send the form, I get this error on the paypal website:

但是当我尝试发送表格时,我在贝宝网站上收到此错误:

http://i.stack.imgur.com/AVuTz.png

http://i.stack.imgur.com/AVuTz.png

Thanks in Advance, Phillip

提前致谢,菲利普

回答by Robert

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_idisn't recognized in the Sandbox, it returns an error.

问题是您在实时 PayPal 网站中生成了一个“托管”PayPal 按钮,但您正在将此数据发送到沙箱。
由于hosted_button_id沙箱中无法识别 ,因此会返回错误。

You'd need to either:

你需要:

  • Create a non-hosted button, and change the 'action' and 'business' parameters to match Sandbox details
  • Create a new 'hosted' button in Sandbox via www.sandbox.paypal.com > Profile > PayPal Buttons.
  • 创建一个非托管按钮,并更改“操作”和“业务”参数以匹配沙箱详细信息
  • 通过在 Sandbox 中创建一个新的“托管”按钮 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.

TL;DR:Sandbox 与 Live PayPal 网站 100% 分离。在 Live 中生成的托管按钮在 Sandbox 中不起作用。

回答by Paul

Just a short add how to make the hosted button in the sandbox:

只需简短添加如何在沙箱中制作托管按钮:

  1. Create and log in to your sandbox account on https://developer.paypal.com/
  2. Choose "Test Accounts".
  3. Create a "Preconfigured" test account for a seller, make sure you remember the password, and make sure the password contain numbers or you will not be able to log in with it.
  4. Click the yellow button "Enter Sandbox Test Site".
  5. My Account >> Profile >> Selling Preferences >> My Saved Buttons
  6. Edit your button. (There are 3 "saved" pre-made buttons there.) Make 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.
  1. https://developer.paypal.com/上创建并登录您的沙盒帐户
  2. 选择“测试帐户”。
  3. 为卖家创建一个“预配置”测试账户,确保您记住密码,并确保密码包含数字,否则您将无法登录。
  4. 单击黄色按钮“进入沙盒测试站点”。
  5. 我的账户 >> 个人资料 >> 销售偏好 >> 我保存的按钮
  6. 编辑您的按钮。(那里有 3 个“已保存”的预制按钮。)请确保您不要停留太久,它没有告诉我就将我注销了,并且我第一次摆弄按钮时得到了一个空白代码字段。

Hopefully this saved you some time :)

希望这为您节省了一些时间:)

回答by Dmitry Negoda

Perhaps this will help: https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ButtonMgrAPIIntro

也许这会有所帮助:https: //cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ButtonMgrAPIIntro

Not all merchants in every country can use all the buttons that can be created. For example, German merchants cannot use Subscribe buttons even though they can be created through the API

并非每个国家的所有商家都可以使用所有可以创建的按钮。例如,德国商家不能使用订阅按钮,即使它们可以通过 API 创建

回答by Nigel B. Peck

Yes, it's true, PayPal actually thinkscreating another buttonin 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.

是的,确实如此,PayPal实际上认为在单独的沙箱系统中创建另一个按钮相当于“测试”。呃,不,PayPal 的测试点是测试实际的东西,而不是你在另一个系统中从头开始制作的东西的副本。如果某些事情做了不同的事情(错误地,这是测试的重点)或在其他系统中设置时出错怎么办?这不是测试。这是在做试验。

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.

所以在回答这个问题时,你不能用沙箱测试 PayPal 按钮,你只能做试验。实际测试 PayPal 按钮的唯一方法是在测试时将价格降低到很小的值,例如一分钱,或者只是支付然后退款。

回答by kishan Radadiya

Yes, you can test also on sandbox with following steps:

是的,您也可以通过以下步骤在沙箱上进行测试:

  1. Create a new sandbox business account.
  2. Login to the business account.
  3. Go with profile > My setting tools.
  4. Click on Paypal buttons > Update.
  5. Click on "Create new button".
  6. Fill up all following details you required.
  7. At last, you can get the form code with "hosted_id".
  8. You can paste the code in your website and you can test it.
  1. 创建一个新的沙盒企业帐户。
  2. 登录到企业帐户。
  3. 使用配置文件 > 我的设置工具。
  4. 单击 Paypal 按钮 > 更新。
  5. 单击“创建新按钮”。
  6. 填写您需要的所有以下详细信息。
  7. 最后,您可以获得带有“hosted_id”的表单代码。
  8. 您可以将代码粘贴到您的网站中并进行测试。

Hope, These steps are useful to you.

希望,这些步骤对你有用。