Paypal IPN
生活随笔
收集整理的這篇文章主要介紹了
Paypal IPN
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
網上已經有很多paypay ipn的文章了,只不過他們都是用paypal的購物車。因為我只是用來作為一個付款渠道,因此,我得先生成訂單,然后引導客戶去paypal付款。
1.轉去付款頁面
代碼????<form?id="payForm"?method="post"?action="<%Response.Write(URL);%>">????????<input?type="hidden"?name="cmd"?value="<%Response.Write(cmd);%>"?/>
????????<input?type="hidden"?name="business"?value="<%Response.Write(business);%>"?/>
????????<input?type="hidden"?name="item_name"?value="<%Response.Write(item_name);%>"?/>?
????????<input?type="hidden"?name="amount"?value="<%Response.Write(amount);%>"?/>
????????<input?type="hidden"?name="no_shipping"?value="<%Response.Write(no_shipping);%>"?/>
????????<input?type="hidden"?name="return"?value="<%Response.Write(return_url);%>"?/>
????????<input?type="hidden"?name="rm"?value="<%Response.Write(rm);%>"?/>
????????<input?type="hidden"?name="notify_url"?value="<%Response.Write(notify_url);%>"?/>
????????<input?type="hidden"?name="cancel_return"?value="<%Response.Write(cancel_url);%>"?/>
????????<input?type="hidden"?name="currency_code"?value="<%Response.Write(currency_code);%>"?/>
????????<input?type="hidden"?name="custom"?value="<%Response.Write(request_id);%>"?/>
????</form>
????<script??type="text/javascript"?language="javascript">
????document.forms["payForm"].submit();
????</script>
url 就是付款的網址
notify_url用于paypal更新狀態的網址,最好使用https,當然了http也行
return 用于返回的網址,個人覺得沒啥太大用處,還不如指回到訂單頁面
custom用于傳遞特殊的值,paypal回調notify_url的時候會傳遞,可以驗證請求有效性,是隱藏傳遞的。
?
2.付款確認的頁面
?將參數加上"&cmd=_notify-validate"回傳回付款網址
如果response的值是VERIFIED的時候,表示請求是從paypal出來的
然后用他的request里面的變量判斷數據是否正確,比如金額,產品價格、收款人等等
如果這些都對的話,那么就放心的更新訂單的付款狀態了。
3.paypal只有在確認付款后, payment_status才會等于Completed
?
轉載于:https://www.cnblogs.com/wildfish/archive/2010/06/02/1750014.html
總結
以上是生活随笔為你收集整理的Paypal IPN的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一个工具箱工具
- 下一篇: NHibernateLinq简单的CRU