如何使用沙箱测试贝宝订阅按钮?

时间:2022-10-14 17:30:18

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

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

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:

但是当我尝试发送表格时,我在贝宝网站上看到了这个错误:

如何使用沙箱测试贝宝订阅按钮?

Thanks in Advance, Phillip

谢谢你提前,菲利普

5 个解决方案

#1


31  

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.

问题是你在贝宝网站上创建了一个“托管”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.
  • 通过www.sandbox.paypal.com >个人资料> PayPal按钮在Sandbox中创建一个新的“托管”按钮。

TL;DR: Sandbox is 100% separated from the Live PayPal website. A hosted button generated in Live, doesn't work in Sandbox.

沙箱与贝宝网站是100%分离的。实时生成的托管按钮不能在沙箱中工作。

#2


10  

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. 在https://developer.paypal.com/上创建并登录到沙箱帐户
  3. Choose "Test Accounts".
  4. 选择“测试账户”。
  5. 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.
  6. 为卖家创建一个“预配置”测试帐户,确保您记住了密码,并确保密码包含数字,否则您将无法使用它登录。
  7. Click the yellow button "Enter Sandbox Test Site".
  8. 点击黄色按钮“进入沙箱测试站点”。
  9. My Account >> Profile >> Selling Preferences >> My Saved Buttons
  10. 我的账号>>配置>>出售偏好>>我保存的按钮
  11. 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.
  12. 编辑你的按钮。(那里有3个“保存”的预制按钮。)确保你不要停留太久,它在没有告诉我的情况下登出了我的日志,而且我第一次摆弄我的按钮时得到了一个空白的代码字段。

Hopefully this saved you some time :)

希望这能帮你节省一些时间。

#3


2  

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

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创建订阅按钮,德国商人也不能使用订阅按钮

#4


0  

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.

所以回答这个问题,你不能用沙箱测试贝宝按钮,你只能做试验。真正测试贝宝按钮的唯一方法,是在测试时把价格降低到很小的程度,比如一分钱,或者只是付钱然后退款。

#5


-1  

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

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

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

Hope, These steps are useful to you.

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

#1


31  

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.

问题是你在贝宝网站上创建了一个“托管”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.
  • 通过www.sandbox.paypal.com >个人资料> PayPal按钮在Sandbox中创建一个新的“托管”按钮。

TL;DR: Sandbox is 100% separated from the Live PayPal website. A hosted button generated in Live, doesn't work in Sandbox.

沙箱与贝宝网站是100%分离的。实时生成的托管按钮不能在沙箱中工作。

#2


10  

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. 在https://developer.paypal.com/上创建并登录到沙箱帐户
  3. Choose "Test Accounts".
  4. 选择“测试账户”。
  5. 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.
  6. 为卖家创建一个“预配置”测试帐户,确保您记住了密码,并确保密码包含数字,否则您将无法使用它登录。
  7. Click the yellow button "Enter Sandbox Test Site".
  8. 点击黄色按钮“进入沙箱测试站点”。
  9. My Account >> Profile >> Selling Preferences >> My Saved Buttons
  10. 我的账号>>配置>>出售偏好>>我保存的按钮
  11. 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.
  12. 编辑你的按钮。(那里有3个“保存”的预制按钮。)确保你不要停留太久,它在没有告诉我的情况下登出了我的日志,而且我第一次摆弄我的按钮时得到了一个空白的代码字段。

Hopefully this saved you some time :)

希望这能帮你节省一些时间。

#3


2  

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

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创建订阅按钮,德国商人也不能使用订阅按钮

#4


0  

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.

所以回答这个问题,你不能用沙箱测试贝宝按钮,你只能做试验。真正测试贝宝按钮的唯一方法,是在测试时把价格降低到很小的程度,比如一分钱,或者只是付钱然后退款。

#5


-1  

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

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

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

Hope, These steps are useful to you.

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