2012-07-30 86 views
0

我嘗試創建一個自動填充的貝寶形式的網上商店:貝寶的HTML表單不工作

<form action="https://www.paypal.com/cgi-bin/webscr" class="input-form" method="post" enctype="application/x-www-form-urlencoded; charset=utf-8"> 
    <input type="hidden" value="utf-8" name="charset"> 
    <input type="hidden" value="_s-xclick" name="cmd"> 
    <input type="hidden" value="{somehash}" name="hosted_button_id"> 
    <input type="hidden" value="17" name="item_number"> 
    <input type="hidden" value="kosár és szállítás" name="item_name"> 
    <input type="hidden" value="9990" name="amount"> 
    <input type="hidden" value="HUF" name="currency_code"> 
    <input type="hidden" value="1" name="upload"> 
    <input type="hidden" value="1" name="no_shipping"> 
    <input type="hidden" value="http://www.mydomain.loc/" name="return"> 
    <input type="image" border="0" alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" class="button submit-button image-button"> 
    <img width="1" height="1" border="0" alt="" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"> 
</form> 

的{} somehash給我的PayPal帳戶所有者(我從未有過一個帳戶)。我的問題,我得到這樣的提交後: screenshot 它包含什麼,但項目名稱...

<div id="miniCartContent" class="body clearfix" style="height: 1083px;"> 
    <div class="" id="miniCart"> 
    <h3>Your order summary</h3> 
    <div class="small head wrap"> 
     Descriptions 
     <span class="amount">Amount</span> 
    </div> 
    <ol class="small wrap items "> 
     <li class="seller1"> 
      <ul> 
      <li class="itmdet" id="multiitem1"> 
       <ul class="item1"> 
        <li class="dark"> 
         <span class="name"> 
          <a id="showname0" title="" href="#name0" class="autoTooltip"> 
           kosár és szállítás 
           <span class="accessAid">kosár és szállítás</span> 
          </a> 
         </span> 
         <span class="secondary noamt amount">0</span> 
        </li> 
        <li class="secondary qty"> 
         <p class="group"> 
          <label for="item_price"><span class="labelText">Item price: </span></label> 
          <span class="field"> 
           <input type="text" value="" name="amount" id="item_price" size="6" maxlength="15"> 
          </span> 
         </p> 
        </li> 
        <li class="secondary"> 
         Quantity: 1 
        </li> 
        <li> 
         <div class="action"> 
          <span class="buttonAsLink"> 
           <input type="submit" onclick="PAYPAL.Checkout.Slider.showPanelMsg('cartMsg')" class="action updateSubmit" name="update.x" id="updateTotals0" value="Update"> 
          </span> 
         </div> 
        </li> 
       </ul> 
       <ul></ul> 
      </li> 
     </ul> 
    </li> 
</ol> 
<div class="wrap items totals item1"> 
    <ul> 
     <li class="small heavy"> 
      Item total <span class="amount">0</span> 
     </li> 
    </ul> 
</div> 

我不知道該怎麼辦,我讀了十幾個教程,但沒有成功案例:S 任何想法?

編輯:

測試從開發服務器,本地主機(但我不認爲它計數)...

+0

官方的Paypal網站有一個創建HTML表單代碼的嚮導:https://www.paypal.com/pdn-item – xato 2012-07-30 21:58:15

+0

我沒有paypal帳戶... – inf3rno 2012-07-30 22:29:19

回答

2

變化<input type="hidden" value="_s-xclick" name="cmd"><input type="hidden" value="_xclick" name="cmd"> 而不是<input type="hidden" value="{somehash}" name="hosted_button_id">,使用<input type="hidden" value="{somehash}" name="business">

_s-xclick用於安全和/或所謂的「託管」按鈕,其中按鈕的詳細信息存儲在某人的PayPal賬戶中。
要指定PayPal網站付款標準版(您使用的產品)的資金收件人,您需要使用business參數。

+0

好吧我會試試看。我認爲存儲的按鈕是恆定的金額,並且網店經營的金額和數量有所變化,所以cmd類型真的是錯誤的... – inf3rno 2012-08-01 05:37:30

+0

我95%的確定,這是不可能的存儲按鈕ID我稱爲「{} somehash」。有沒有辦法不給電子郵件地址? (只是客戶ID,或類似的東西?) – inf3rno 2012-08-01 05:50:54

+0

您將需要指定一個接收器;無論是電子郵件地址,還是「安全的PayPal賬戶ID」。或者,您可以使用BMCreateButton API通過API調用自動創建託管按鈕:http://stackoverflow.com/questions/7825694/how-to-send-the-total-amount-to-be-paid-to- paypal/7841854#7841854 – Robert 2012-08-01 16:42:24