Example Worldpay PHP/MySQL Callback?

Hello experts,

I am trying to figure out how to work Worldpay's callback (payment response) system, I get that WP blurt all the details back to an address (www.domain.com/callback.php), but I'm at a lost what to do with that information .. more importantly, how to get the data they send into a MySQL db (I have that setup an can connect to it to submit/retrieve data for example).

Worldpay typically not very helpful for beginners (http://www.rbsworldpay.com/support/kb/bg/paymentresponse/payment_response.html)

Any help/examples extremely welcome! Total n00b so please be gentle!
anelson2008Asked:
Who is Participating?
 
virmaiorConnect With a Mentor Commented:
They pass it back as POST data:

http://www.rbsworldpay.com/support/kb/bg/paymentresponse/pr5200.html

this means you can access it in php using $_POST['x'] for whatever the variable names are respectively.


in your script, you would then,

(1) connect to your MySQL db: mysql_connect('host','username','password');
(2) select your db: mysql_select_db('my_db');
(3) send your query mysql_query('INSERT INTO my_table (my_field, my_field_2) VALUES ' . $_POST['my_field'] . ',' . $_POST['my_field']);

for (3), you will need to use single quotes if these are string values and ideally you will need to scrub the data to make sure no one can use a SQL injection attack.
0
 
tbsgadiConnect With a Mentor Commented:
Have a look at the following:

http://www.webmasterworld.com/forum22/1186.htm

Gary
0
 
anelson2008Author Commented:
Spot on! Thank you both very much.
0
 
tbsgadiCommented:
Glad to assist
0
All Courses

From novice to tech pro — start learning today.