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

时间:2016-03-09 09:56:03

标签: javascript paypal

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

  

您已申请过期的PayPal版本。经常出现此错误   使用书签的结果。

以下是代码:

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

这是Live:https://jsfiddle.net/rami7250/cojvcr90/

我做错了什么?

1 个答案:

答案 0 :(得分:1)

请更改以下代码

<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变量仅支持以下值: _xclick

_cart

_oe-gift-certificate

_xclick-subscriptions

_xclick-auto-billing

_xclick-payment-plan

_donations

_s-xclick