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 🙂


14 Comments

justin · January 29, 2013 at 10:00

I am getting the following error when trying to use Jersey as delivery country.It works for all others.Doesnt ePDQ support this country?
Any body has encountered this ?

“Sorry, there has been a problem processing your payment.
Billing Country is invalid, received JE.”

Peter · September 21, 2011 at 19:42

How do I get this to work ? Where is the value coming from, can the user input a total or is it based on something else?

    Andrew · September 22, 2011 at 09:46

    The total comes from the encrypted params string:

    $params = “clientid=myclientid&password=mypassword&oid=4&chargetype=Auth&total=100&currencycode=826”;

      Chris · March 3, 2012 at 12:45

      Hi,

      This is the bit I’m stuck on. When I submit the form is says ‘Mandatory information not present.’.

      $params = “clientid=myclientid&password=mypassword&oid=4&chargetype=Auth&total=100&currencycode=826?;

      The above is from your post and is the same as the CURL script from Barclays. Can you explain how I enter my details as the parameters? Where it says clientid=myclientid, do I just change ‘myclientid’ for the 5 digit client id? same with mypassword, do I put the passphrase entered during the admin set up? oid=4? do I change this, it’s not madatory, so can I delete it? the total=100 surely has to change to maybe $cartTotal?

      Please help! It seems easy but there are loads of people over the net asking for help. I’ve found this post very helpful. I was using the php encryption and have changed to use the CURL encryption.

        Admin · March 5, 2012 at 10:46

        Hi Chris,

        I have added some readme’s to the bottom of this post, take a look at them and see if after reading it, it solves your problem.

Andrew · August 22, 2011 at 10:05

@craig:
A lot of the EDPQ process is done via configs on the bank’s remote login, returned data can be seen as follows.

$timestamp=date(“d-m-y–H-i-s”);
$str = “OrderID – “.$_POST[“oid”].”n”;
$str .= “Transaction Status – “.$_POST[“transactionstatus”].”n”;
$str .= “Total – “.$_POST[“total”].”n”;
$str .= “ClientID – “.$_POST[“clientid”].”n”;
$str .= “Transaction Time Stamp – “.$_POST[“datetime”].”n”;
$str .= “ECI Status – “.$_POST[“ecistatus”].”n”;
$str .= “Card Prefix – “.$_POST[“cardprefix”].”n”;
mail(“[email protected]”, “New Order”, $str);

craig · August 16, 2011 at 11:28

Do you have an example of handling the response back from ePDQ?

sam · July 12, 2011 at 06:49

Hi , im looking for Barclay epdq integration.

    Andrew · July 12, 2011 at 06:51

    Have you looked at the barclays site for more information?

jo · April 4, 2011 at 15:04

Hi,
I have a website that has a one page form that collects simple customer details to pay for a booking on a holiday home. I have the website working well but need to integrate Barclays ePDQ. I have sat and read the integration document over several times and am now stuck. I have never really used Perl or PHP so have installed the scripts given by Barclays to do the server side bit.
This is the link given to the help document but (ww.barclaycard.co.uk/business/activate-epdq-cpi)I am not really sure on how the encryption bit works.
Is anyone out there willing to help do a “walkthrough”? I cant imagine its too difficult if you know what your doing.
Thanks in anticipation…
Jo

    Andrew · April 6, 2011 at 15:48

    Hi Jo,

    At what point exactly are you experiencing the problems using the gateway?
    Have you registered your site/application with the link barclays sends to you for authorisation?

nikki · February 4, 2011 at 13:45

Wow! its wonderful! I was looking for this integration…. many many many Thanks

myeasypayment · October 5, 2010 at 08:23

It is very uncomplicated to create a payment by means of MyEasyPayment. Financial institution of America card accounts is accessible 24 hours each day via on the net account access. The web site is clean and simple to use. MyEasyPayment are dedicated to protecting your individual information and facts online to keep it secure and confidential.

Tushar · July 13, 2010 at 09:36

How can i integrate ePDQ and how can i send session data through php html code ? how can i set session value in hidden field.

Leave a Reply

Your email address will not be published. Required fields are marked *