我正在整合貝寶,我已經做對了。我已經設置了返回網址,因此它在url $_GET
中給出了以下結果集。如何驗證PayPal返回數據?
Array ([tx] => 7XV08083GT683520Y [st] => Completed [amt] => 22.16 [cc] => USD [cm] => [item_number] => item_number)
我擔心的是沒有辦法驗證從Paypal返回的數據。我有與其他支付網關的經驗。其他支付網關允許你做hashMatch
,它允許確保通過表單提交的數據沒有被編輯。
我的表格如下。
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" value="[email protected]" name="business">
<!-- Specify a Buy Now button. -->
<input type="hidden" value="_xclick" name="cmd">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" value="AM Test Item" name="item_name">
<input type="hidden" value="22.16" name="amount">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" value="item_number" name="item_number">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
我的PHP代碼輸出
<input type="hidden" value="50.16" name="amount">
但是我用螢火併編輯下面&沒有付款。
<input type="hidden" value="22.16" name="amount">
儘管如此,我得到的結果,因爲它是一個Completed
付款,但它不應該是因爲我已經手動所做的更改。任何有知識的人都可以編輯它們。我怎樣才能確保這是一個有效的付款?我怎樣才能確保表單數據不像我那樣編輯?
非常感謝你。我想知道的是,是否有另一種方式像其他支付網關。像hashMatch – Techie
我認爲你可以發送一些自定義值貝寶,貝寶也會返回這些值,所以你可以做出這些值之間comaprison太,你仍然需要存儲這些值一些在你的網頁(會議或數據庫)。 –
這不是我要找的。無論如何非常感謝 – Techie