2010-06-22 63 views
4

以下是我用來測試Paypal網站付款標準上傳thingy的一些簡單代碼。貝寶返回的URL - 使用GET參數?

我返回URL是http://mysite/index.php?module=store&show=order_confirm 我經歷了支付過程,當我到達終點,並返回我的頁面,它不是僅僅返回我的index.php(即沒有額外的參數)。

任何人都知道這個交易是

<form action="https://www.sandbox.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="return" value="http://mysite/index.php?module=store&amp;show=order_confirm" /> 
    <input type="hidden" name="currency_code" value="EUR" /> 

    <input type="hidden" name="business" value="[email protected]"> 

      <input type="hidden" name="item_name_1" value="adaddada" /> 
      <input type="hidden" name="amount_1" value="30.00" /> 

      <input type="hidden" name="quantity_1" value="1" /> 
          <input type="hidden" name="item_name_2" value="wuiui" /> 
      <input type="hidden" name="amount_2" value="50.00" /> 
      <input type="hidden" name="quantity_2" value="1" /> 


    <input type="hidden" name="custom" value="19" /> 

    <input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" alt="PayPal - The safer, easier way to pay online"> 

</form> 

回答

3

我不確定爲什麼貝寶正在做它正在做的事情,但我懷疑他們希望添加自己的GET參數正在消滅你自己。你可能想嘗試這樣的事情,如果mod_rewrite的或類似的東西提供給您:

寫改變的規則:

http://mysite/store/order_confirm/?merchant_return_link=Test+Store 

這個

http://mysite/index.php?merchant_return_link=Test+Store&module=store&show=order_confirm 
+0

謝謝,我的解決方案最終是讓它返回到一個簡單的PHP文件,名爲paypalreturn.php ,它重定向到我想要去的頁面。 – bcoughlan 2010-06-24 12:14:26

3

嘗試逃脫?和返回URL中的&;將它們更改爲%3F和%26。

+0

好主意,我應該說當它返回到index.php它也附加「?merchant_return_link = Test + Store」到最後,所以它不起作用 – bcoughlan 2010-06-22 15:27:44

3

另一種答案是將paypal'rm'[return method]變量設置爲「2」,以便paypal將POST所有自己的返回變量,而不是將它們作爲GET變量發送。