2011-12-29 58 views
1

我正在嘗試將PayPal按鈕集成到網站中。這是一個非常艱苦的工作,做出如此多的按鈕,但我有些是怎麼做到的,但現在我發現其中一些工作,而其中一些不工作(並且轉到PayPal's主頁。)我無法確定什麼出錯導致了這個錯誤。 該代碼是非常大的適合在這裏,所以我分享到形式,第一個作品第二不將貝寶按鈕集成到網站中

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
<input type="hidden" name="cmd" value="_cart"> 
<input type="hidden" name="business" value="xxxxx"> 
<input type="hidden" name="lc" value="US"> 
<input type="hidden" name="item_name" value="Sumission Order 1- 3 articles "> 
<input type="hidden" name="amount" value="xxx"> 
<input type="hidden" name="currency_code" value="USD"> 
<input type="hidden" name="button_subtype" value="products"> 
<input type="hidden" name="no_note" value="0"> 
<input type="hidden" name="tax_rate" value="0.000"> 
<input type="hidden" name="shipping" value="0.00"> 
<input type="hidden" name="add" value="1"> 
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest"> 
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> 
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></p> 
</form> </p> 
<p>Sumission Order 2- <strong>5 articles</strong></p> 
<p> 
    <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
    <p> 
     <input type="hidden" name="cmd3" value="_cart"> 
     <input type="hidden" name="business2" value="xxxxx"> 
     <input type="hidden" name="lc2" value="US"> 
     <input type="hidden" name="item_name2" value="Sumission Order 2- 5 articles"> 
     <input type="hidden" name="amount2" value="xxxx"> 
     <input type="hidden" name="currency_code2" value="USD"> 
     <input type="hidden" name="button_subtype2" value="products"> 
     <input type="hidden" name="no_note2" value="0"> 
     <input type="hidden" name="tax_rate2" value="0.000"> 
     <input type="hidden" name="shipping2" value="0.00"> 
     <input type="hidden" name="add2" value="1"> 
     <input type="hidden" name="bn2" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest"> 
     <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit2" alt="PayPal - The safer, easier way to pay online!"> 
    <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></p> 
</form> 

請幫幫我。謝謝

+0

不知道這是做什麼的,這條線對我來說很重要:''是cmd2? – djlumley 2011-12-29 06:45:30

+0

嗯我沒有在你的窗體中看到有'type =「submit」'的任何輸入? – 2011-12-29 06:46:45

+0

@djlumley:我將其更改爲cmd2,但它仍然不起作用。 – 2011-12-29 06:48:15

回答

3

您已更改第二種形式的輸入字段的名稱。這些是發送給PayPal的變量。這意味着您現在正在發佈其他變量;貝寶不明白cmd2例如,但它理解cmd。所以重命名第二個表單中的輸入字段爲cmd, business, lc, item_name ..等,它應該工作。

BTW這是不是非法的在HTML標籤重複,只有重複ID的是不允許的。

成功!

1

由於你的按鈕是不同的形式,所以你不需要在末尾用數字標記你輸入的名字。這違反了PayPal的慣例。將cmd2更改爲cmd等。

+0

Thankyou的幫助。 – 2011-12-29 07:27:52