2015-05-27 31 views
0

我創建了一個表格:如何在PayPal賬單後使用POST返回?

<form name="_xclick" action="https://www.sandbox.paypal.com/webscr" method="post"> 
    <input type="hidden" name="cmd" value="_xclick"> 
    <input type="hidden" name="business" value="[email protected]"> 
    <input type="hidden" name="currency_code" value="USD"> 
    <input type="hidden" name="item_name" value="Subscription"> 
    <input type="hidden" name="return" value="http://www.my_website.com/<%= params[:locale] %>/success"> 
    <input type="hidden" name="amount" value="1"> 
    <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> 
</form> 

但它通過GET請求重定向到我的網站。付款後如何通過POST請求重定向到我的網站?

當我創建我的PayPal按鈕工廠按鈕:

<form action="https://www.sandbox.paypal.com/webscr" method="post" target="_top"> 
    <input type="hidden" name="cmd" value="_s-xclick"> 
    <input type="hidden" name="hosted_button_id" value="SOME_VALUE"> 
    <input type="image" src="https://www.paypalobjects.com/en_US/IL/i/btn/btn_buynowCC_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"> 
</form> 

當我點擊PayPal按鈕,我已經建立了成功,當我點擊PayPal按鈕取消重定向,但下面的錯誤是顯示:

PayPal cannot process this transaction because of a problem with the seller's website. Please contact the seller directly to resolve this problem. 

那麼,我該如何更改我的第一個代碼,它將在計費後執行POST重定向?

+0

爲什麼要重定向到帖子?而不是在重定向頁面上,你可以編寫隱藏的表單並通過javascript自動提交。 – Anuja

回答