2009-11-19 97 views
14

我有一些項目有2和3級別的自定義。一旦設置用戶將它們添加到我的現場購物車。問題是,如何在結帳時將每件商品發送到PayPal?唯一爲動態按鈕找到的代碼僅支持單個項目。一次用php提交多個項目到paypal購物車

<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal"> 
<input type="hidden" name="cmd" value="_cart"> 
<input type="hidden" name="add" value="1"> 
<input type="hidden" name="business" value="EMAIL"> 
<input type="hidden" name="item_name" value="Item #1"> 
<input type="hidden" name="item_number" value="123456"> 
<input type="hidden" name="amount" value="7.00"> 
<input type="hidden" name="shipping" value="0"> 
<input type="hidden" name="shipping2" value="0"> 
<input type="hidden" name="handling" value="0"> 
<input type="hidden" name="currency_code" value="USD"> 
<input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm"> 
<input type="hidden" name="undefined_quantity" value="1"> 
<input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!"> 
</form> 

我嘗試添加

<input type="hidden" name="item_name_2" value="Item #1"> 
<input type="hidden" name="item_number_2" value="123456"> 
<input type="hidden" name="amount_2" value="7.00"> 

但是,沒有陽性結果。

任何想法?

+0

回答這個問題的是http://stackoverflow.com/questions/3308898/paying-for-multiple-items-at-once-via-paypal/39814713存在#39814713 – 2016-10-02 07:16:02

回答

1

你爲什麼不把你的客戶必須支付的總金額發送給PayPal?

+0

id像他們的paypal reciept,以準確反映什麼是按項目訂購和支付。另一種方法是將它們聚集在一起。 – mrpatg 2009-11-19 08:51:43

+2

確實,您要查找的是上傳選項,必須將其設置爲1. 以下是一些有關此文檔的文檔: http://www.paypal.com/cgi-bin/webscr?cmd=_pdn_howto_checkout_outside# methodtwo 雖然我正在尋找你的答案,你都已經明白了,我猜;) – Ben 2009-11-19 09:12:24

+0

雖然有用的信息。感謝張貼的鏈接。我給你的答案順便說一句。 – mrpatg 2009-11-19 09:49:09

40

下面是解

<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
<input type="hidden" name="cmd" value="_cart"> 
<input type="hidden" name="upload" value="1"> 
<input type="hidden" name="business" value="[email protected]"> 
<input type="hidden" name="item_name_1" value="Item #1"> 
<input type="hidden" name="amount_1" value="1.00"> 
<input type="hidden" name="item_name_2" value="Item #2"> 
<input type="hidden" name="amount_2" value="2.00"> 
<input type="submit" value="PayPal"> 
</form> 
+3

人們不應該再使用這種解決方案。考慮實施PayPal的Express Checkout解決方案,同時處理表單數據非常容易。儘管如此,答案是正確的,但如果你今天看到它,我認爲它不再是理想的解決方案。 – Ben 2012-08-21 12:41:04

+0

偉大的一點,但Paypal也建議對錶單提交的每個項目進行徹底驗證。這是這個產品的正確價格,這是正確的收件人電子郵件,這是正確的總數等。我也使用額外的層,我提交了一個類似的表單提交實際的形式到貝寶驗證頁面。但是,到目前爲止,我已經捕獲了多個IP來嘗試更改表單數據。如果你絕對不能改變,只要確保驗證確實很好。 – 2015-05-18 15:25:43

+0

@使用IPN通知驗證時不擔心。 – 2016-12-27 18:41:23