javascript - 我如何通过 Paypal 提交多个产品复选框?

标签 javascript paypal

我有基于查看购物车 方法的 Paypal 表格。 我转换了代码以收集多个复选框信息并通过 paypal 提交总和。 当我尝试通过单击“立即购买”来处理请求时,我从 paypal 收到一条错误消息:

You have requested an outdated version of PayPal. This error often results from the use of bookmarks.

代码如下:

<form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post" id="submit" name="submit">
<!-- If using a Business or Company Logo Graphic, include the "cpp_header_image" variable in your View Cart code. -->
<input type="hidden" name="cpp_header_image" value="http://coreneto.com/picturish/assets/images/logo_light.png">
<p>
<input type="hidden" name="cmd" value="_submit">
<input type="hidden" name="display" value="1">
<!-- Replace "business" value with your PayPal Email Address or Account ID -->
<input type="hidden" name="business" value="user@gmail.com">
<!-- Replace value with the web page you want the customer to return to -->
<input type="hidden" name="shopping_url" value="http://www.yourwebsite.com/Script_02.html">
</p>
</form>
<!-- End of the viewcart FORM -->

<!-- Start of Form -->
<!-- Note: target="paypal" was replaced with the variable target="_self" -->
<!-- Note: shopping_url also added to code -->
<!-- These two changes allow better functionality with IE and Firefox -->
<FORM onsubmit="this.target='_self';&#10; return ReadForm(this, true);" action=https://www.paypal.com/cgi-bin/webscr method=post>
<!-- If using a Business or Company Logo Graphic, include the "cpp_header_image" variable in your View Cart code. -->
<input type="hidden" name="cpp_header_image" value="http://coreneto.com/picturish/assets/images/logo_light.png">
<input type="hidden" name="cmd" value="_submit">
<input type="hidden" name="add" value="1">
<!-- Replace "business" value with your PayPal Email Address or Account ID -->
<input type="hidden" name="business" value="user@gmail.com">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="amount" value="">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn/btn_cart_LG.gif:NonHosted">
<!-- Replace value with the web page you want the customer to return to -->
<input type="hidden" name="shopping_url" value="http://www.yourwebsite.com/Script_02.html">
<!-- Replace value with the web page you want the customer to return to after a successful transaction -->
<input type="hidden" name="return" value="http://www.yourwebsite.com/ThankYou.html">
<!-- Replace value with the web page you want the customer to return to after item cancellation -->
<input type="hidden" name="cancel_return" value="http://www.yourwebsite.com/Cancel.html">
<input type="hidden" value="0.00" name="baseamt">
<input type="hidden" value="@0.00" name="basedes">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add some notes">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">


Add Toppings
<br><br>  
<input onclick="ReadForm (this.form, false);" type=checkbox value="Pepp +1.50"> Pepperoni - Add $1.50
<br><br>
<input onclick="ReadForm (this.form, false);" type=checkbox value="It Saug +1.50"> It Saugsage - Add $1.50
<br><br>
<input onclick="ReadForm (this.form, false);" type=checkbox value="Ons +10.10"> Onions - Add $10.10
<br><br>
<input onclick="ReadForm (this.form, false);" type=checkbox value="Mush +10.25"> Mushrooms - Add $10.25
<br><br>
<input onclick="ReadForm (this.form, false);" type=checkbox value="Gr Peppers +10.15"> Green Peppers - Add $10.15

<br>

<!-- <input class=nbor size=6 value=$0.00 name=tot>  -->
<div class="display-amount">$0.00</div>

<br><br>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

<input type=image alt="cart add" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" name=submit>
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">

<br><br>
<input onclick="document.forms.viewcart.target = '_self';&#10; document.forms.viewcart.submit ();&#10; return false;" type=image alt="cart view" src="https://www.paypalobjects.com/en_US/i/btn/btn_viewcart_LG.gif">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> 
</form>

现场直播:https://jsfiddle.net/rami7250/cojvcr90/

我做错了什么?

最佳答案

请更改以下代码

来自

<input type="hidden" name="cmd" value="_submit">

<input type="hidden" name="cmd" value="_xclick">

引用https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/ , cmd 变量只支持以下值: _x点击

_购物车

_oe-礼品证书

_xclick-订阅

_xclick-自动计费

_xclick-付款计划

_捐赠

_s-xclick

关于javascript - 我如何通过 Paypal 提交多个产品复选框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35888230/

相关文章:

javascript - 从 Angular 应用程序范围之外调用 AngularJS 函数

javascript - 使用 React JS 检测固定高度 div 的滚动结束

php - 捕获重复的 PayPal IPN 付款

java - 如何从新的 Paypal Sync Api 获取销售 ID

python - 模板语法错误 : No module named braintree in paypal template?

javascript - 聊天/聊天盒系统的最佳技术是什么?普通JS,JQuery,Websocket或其他?

JavaScript 错误(Microsoft JScript 运行时错误 : Object expected)

javascript - 使用 jQuery 查找 XML 节点并使用其值

PayPal:image_url 与 cpp_header_image

用于使用 REST API 的 PayPal 托管 JavaScript 库?