我們使用IPN方式來建立通知機制
其中最重要的是設定notify_url
notify_url可以從帳號設定或是跟著付款按鈕設定,(通常在最後步驟的自訂變數)
Paypal收到使用者結帳會發出一個post到這個notify_url網址
相關參數可以參考這裡
其中比較重要的像是
txn_id代表交易id
option_selection1代表使用者第一選擇選項
payer_email使用者信箱
使用sandbox會更清楚
建立IPN驗證機制
一個範例如https://myweb.mydomain.com/paypal_ipn?secret=mysecret
這裡的secret可以自由設定成一個防止使用者誤連的一個變數,
只保存在paypal和自己的server中來做確認
使用IPN驗證還有一種方式,就是把得到的資料post回paypal,
由paypal來辨識這個post的正確性,回傳結果
在網站頁面內的自訂變數可以使用custom,這是可以給使用者看到的變數
用Paypal Sandbox確認金流機制
設定完成之後使用paypal sandbox網站來確認金流機制
先建立測試使用者、測試網站商家等
然後建立測試按鈕放到網站上
可以參考Paypal Sandbox文件
Website Payments with Buy Now Button
You can use the Sandbox to familiarize yourself with the PayPal Buy Now button, with which you can associate PayPal with a specific item you sell on your website.
To create a test Buy Now button:
1.
From the Test Accounts tab, select a business account and click Enter Sandbox Test Site.
2.
Go to the Merchant Services tab.
3.
Select the Buy Now Buttons link under the Key Features heading to get to the Button Factory. You can also search the Help for “Button Factory.”
4.
Follow the online instructions to create a Buy Now button. For more information, see the Website Payments Standard Integration Guide.
5.
Copy and paste the code into your web page file wherever you would like the button image to appear. Typically, the button should be located next to the description of the item or service. Your web page does not have to be published to your web server for you to check the button placement; it can be on you own local hard drive.
IMPORTANT:
You must change the form action to redirect to the Sandbox, using the following URL:
https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"
IPN文件可以參考Paypal文件
沒有留言:
張貼留言