Hello all!

Today we will be talking about Barclays online payment gateway valled ePDQ.
You can take a look at what they have got to say by clicking here to view Barclays’ site or you could keep reading 🙂
Well, for all you php guys out there, this post if for you!

Barclays ePDQ encrypts your data string of products in your basket and returns a result that is sent with your HTML form on your site.

[code lang=”php”]
$url = ‘https://secure2.epdq.co.uk/cgi-bin/CcxBarclaysEpdqEncTool.e’;
$params = “clientid=myclientid&password=mypassword&oid=4&chargetype=Auth&total=100&currencycode=826”;
$user_agent = “Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work under https
$result=curl_exec($ch);
curl_close($ch);
?>
[/code]

[code lang=”php”]

 

[/code]

As you can see, it all seems quite easy.
You send through your data and it encodes it to look like something like this:

[code lang=”php”]

[/code]

Remember to read the following documents, they are very useful in troubleshooting:
http://www.barclaycard.co.uk/business/documents/pdfs/cpi_integration_guidev11.0.pdf
http://www.barclaycard.co.uk/business/documents/pdfs/user_guideV5.0.pdf

Here are some sample scripts from Barclays themselves:
http://www.barclaycard.co.uk/business/documents/zips/Scripts.zip

Hope that helped someone!

Always feel free to leave a comment or ask a question 🙂