简体   繁体   English

贝宝集成问题

[英]Paypal integration questions

I have some code that i wrote many years ago to integrate Paypal within my site. 我有很多年前编写的代码,用于将Paypal集成到我的网站中。 So a user adds multiple products to their cart and then checks out which then automatically takes the user to the paypal site. 因此,用户将多个产品添加到他们的购物车,然后签出,然后自动将用户带到Paypal网站。 I decided to revisit it today and created the following HTML 我决定今天重新访问它,并创建以下HTML

<form name="myForm" method="POST" action="https://www.sandbox.paypal.com/cgi-bin/webscr" >
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="business" value="myemail-facilitator@myDomain.com"/>
<input type="hidden" name="item_name" value="Product 1"/>
<input type="hidden" name="amount" value="500.00"/>
<input type="hidden" name="quantity" value="1"/>
<input type="hidden" name="upload" value="1"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="hidden" name="return" value="http://XX/paypal/completed.aspx"/>
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cancel_return" value="http://XX/paypal/Cancel.aspx"/>
<input type="hidden" name="shopping_url" value="http://XX/paypal/MyShop"/>
<input type="hidden" name="notify_url" value="http://XX/paypal/MyShop/checkout.aspx"/>
<input type="hidden" name="lc" value="GB"/>
<input type="hidden" name="image_url" value="http://XX/paypal/shop.gif"/>
<input type="hidden" name="no_note" value="1"/>
<input type="hidden" name="invoice" value="ZZZ1234567890"/>
<script type="text/javascript">document.myForm.submit();</script></form>

This came up with an error "Error Detected Your shopping cart is empty". 出现错误“检测到您的购物车为空的错误”。

Logged into my sandbox account and no error listed to determine what ive done wrong. 登录到我的沙盒帐户,未列出任何错误来确定ive错误。 Googled around which suggested to change _cart to _xclick - which resolved the issue, however when i read the documentation at 谷歌搜索建议将_cart更改为_xclick解决了该问题,但是当我阅读以下文档时

https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/ https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

  1. I dont understand why _cart didnt work? 我不明白为什么_cart没有用? Is there a more appropriate way to do this or _xclick fine with my site setup as described above? 如上所述,是否有更合适的方法可以做到这一点?

  2. For multiple items i was looping the item_name and amount and adding each value, but this doesnt work the way i expected ie I've seen sites where they display each product, quantity and amount for each product in the cart and then total - where did i go wrong? 对于多个项目,我正在遍历item_name和数量并添加每个值,但这并不能达到我期望的方式,即,我在网站上看到了它们在购物车中显示每种产品,每种产品的数量和数量,然后在总计中显示的位置。我错了吗?

  3. Finally once a transaction is complete i have set up the IPN value to send the details to my site..... Do i need the site to be using https in order for this to work or would http work? 最后,一旦交易完成,我就设置IPN值以将详细信息发送到我的网站.....我是否需要该网站使用https才能使其正常工作或http是否可以工作?

I tried searching for these answers but some are quite dated or using 3rd part components. 我尝试搜索这些答案,但有些答案已经过时或使用了第三部分组件。

Please make below changes to your HTML codes to make your form work again. 请对您的HTML代码进行以下更改,以使表单重新工作。

 <input type="hidden" name="item_name" value="Product 1"/> <input type="hidden" name="amount" value="500.00"/> <input type="hidden" name="quantity" value="1"/> 
↓↓ ↓↓
 <input type="hidden" name="item_name_1" value="Product 1"/> <input type="hidden" name="amount_1" value="500.00"/> <input type="hidden" name="quantity_1" value="1"/> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM