views:

34

answers:

2

I have a page confirm_payment.php receiving POST data from other pages. How can I make sure this POST data comes only from one specific domain?

I cannot rely on IP addresses as in my case this might change. I want to avoid "fake" submissions to my confirm_payment.php server side code.

Without going into details this is to make sure that my page receives confirmation from payment gateway hosted page and confirmation is genuine.

+1  A: 

John Conde had a great explanation on how to solve your problem at: http://stackoverflow.com/questions/3251293/sending-data-to-payment-gateway-and-back-possible-problems/3255907#3255907

If you need more information, please go back to your original question.

Chris Lively
please let me know if I am missing something but isn't is still unsecure as when user redirected to payment gateway page still can easily look up hidden input fields, create own form with those fields and submit it back to my page? This variables usually are clearly shown as hidden input fields as far as I know, at least in case of eWay (http://www.eway.com.au/Developer/eway-api/shared-payment-solution.aspx). I'm guessing its the case with other payment gateways too. Any other options you can think of?
spirytus
@spirytus: If eWay is putting ALL of the data you pass to them in a hidden input field on their side (including the unique id's) then you need to move to a different gateway. That's not how anyone else does it.
Chris Lively
A: 

You should have your server generate a nonce (number used once) that gets posted, and validated (since your server generated this number it can determine genuine posts)

Pierreten