phpintegrationworldpay

Worldpay Payment Gateway - Make submission more secure


Hi i'm currently trying to integrate worldpays payment gateway to a website.

However I can't seem to submit the form in a secure way.

This is an example form:

<form method="POST" name="BuyForm" action="https://secure- test.worldpay.com/wcc/purchase">
<input type="hidden" value="yourinstid" name="instId">
<input type="hidden" value="yourcartid" name="cartId">
<input type="hidden" value="GBP" name="currency">
<input type="hidden" value="100" name="amount">
<input type="hidden" value="Product 1" name="desc">
<input type="hidden" value="100" name="testMode">
<input type=submit value="Buy Now">    
</form>

Is there anyway to submit this in php to stop end user being able to inspect and change amount ie Changing amount from £100.00 to £1.00 and submitting the order and paying £1 for £100's worth of goods?

I've tried curl however from what i've read you cant redirect the user to the page you've submitted the data to?

Thanks in advance, Jordan


Solution

  • With the architecture you have, no. Because the user is sending data from the page directly to worldpay.com without first going through your server, no you cannot stop the user from inspecting what's about to be sent or from changing values. Even if you locked down the browser with javascript, what's to stop me from loading a page, then copying the information and sending it directly to worldpay with a cURL request from my command line? This is a losing battle for you.

    Look at WorldPay documentation for how to securely submit a transfer. Payment systems have usually worked this out. Here are some techniques I've seen.

    The bottom line is: you cannot stop a user from changing what she submits directly to worldpay, so if your security has this requirement, it will fail. Do your research into worldpay secure payment flows.