Recently we encountered an issue with Worldpay Integration. When we searched in Google we couldn’t find any document which can guide one, to properly setup payment call back response. Its actually very simple and should be done in 10 minutes.
Step 1:
Download the file worldpay. This code is taken from worldpay knowledgebase section.
1
<input type="hidden" name="instId" value="xxxxxx">
You need to change the instID value to your installation id which you can get from the Step 2 below.
Step 2:
First login at worldpay test environment. The url should be this. After login go to Installation link from left bar. On the opened page you should see your installation id.
Now click on the Test-Integration setup icon. From next screen click on “Payment Response URL“. There put http://www.yourdomain.tld/response.php.
We’ll create response.php in Step 3 section of the tutorial. Now tick “Enable the Shopper Response“. In response.php we’ll show custom payment response which worldpay doesn’t show by default. To show those values to your customer you need to create and setup response.php properly. Since this would be a custom php page, so you can write your own custom php code to insert those values into database (This is not possible with default worldpay response).
Step 3:
Now create response.php and paste code below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<html> <head><title>Thank you for your payment</title></head> <WPDISPLAY FILE=header.html> Worldpay Transaction id - <?php echo $_POST["transId"]; ?><br /> Payment Status - <?php echo $_POST["transStatus"]; ?><br /> Transaction Time - <?php echo $_POST["transTime"]; ?><br /> Amount - <?php echo $_POST["authCurrency"]; ?> <?php echo $_POST["authAmount"]; ?>.<br /> IP Address - <?php echo $_POST["ipAddress"]; ?> <WPDISPLAY ITEM=banner> <WPDISPLAY FILE=footer.html> </html>
Now let me explain the code. Below 3 lines are default payment template of worldpay, which calls header, worldpay banner and footer. You can keep this intact, so that your customer can understand that they paid via WorldPay.
<WPDISPLAY FILE=header.html>
<WPDISPLAY ITEM=banner><WPDISPLAY FILE=footer.html>WorldPay returns various parameters which can be captured by _POST command.
1 2 3 4 5 6 7 8 9
Worldpay Transaction id - <?php echo $_POST["transId"]; ?><br /> Payment Status - <?php echo $_POST["transStatus"]; ?><br /> Transaction Time - <?php echo $_POST["transTime"]; ?><br /> Amount - <?php echo $_POST["authCurrency"]; ?> <?php echo $_POST["authAmount"]; ?>.<br /> IP Address - <?php echo $_POST["ipAddress"]; ?>
Copyright © 2010 PHP code. net. All Rights Reserved. Designed By: Web Design Company