cancel
Showing results for 
Search instead for 
Did you mean: 

oeCommerce and NOCHEX

nickc
Newbie
Posts: 4
Registered: 20-08-2007

oeCommerce and NOCHEX

i'd like to set up an oeCommerce based shop with NOCHEX as the card agent. I'm a relative newbie with cgi and php and wonder if anyone else has succesfully achieved this on F9.

Also of course some pointers would be handy. I'm pretty well up on SQL so MySQL shouldn't baffle me too much Smiley

Gratefull for any info,

Cheers

Nick Coe
www.alphacos.co.uk
5 REPLIES
N/A

oeCommerce and NOCHEX

I have got that working with NOCHEX. Got it to confirm the transaction as soon as it happens so that I update stock allocation on confirmation of payment (cant remember what its called, tis like the NOCHEX equivalent of PayPal API... or something like that).

Will post the code for that this weekend, I'm at work at the moment!

Please note that although I have tested and not found any problems, I cannot guarantee its bug-free as I have not let it loose on the public Smiley

Jarv
nickc
Newbie
Posts: 4
Registered: 20-08-2007

oeCommerce and NOCHEX

Thanks Jarv.

There is a contributed module for Nochex on the oeCommerce site which looks like it does the job. Posts notification and ACS? in the right order from what I've read.

Looks like a big job to get it all hackling right... :?

My concern is in trying to find a live shop on F9 and to find out what sort of problems were experienced.

Cheers
N/A

oeCommerce and NOCHEX

nar its not that bad

<?php 


session_start();
header("Cache-control: private");

$post = $_POST;
$_SESSION['post_stuff'] = $post;
$url = "https://www.nochex.com/nochex.dll/apc/apc";
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // times out after 10s
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); // add POST fields
$result = curl_exec($ch); // run the whole process
echo $result; //contains response from server
//nochex variables
$transaction_id = $_POST['transaction_id'];
$transaction_date = $_POST['transaction_date'];
$order_id = $_POST['order_id'];
$amount = $_POST['amount'];
$from_email = $_POST['from_email'];
$to_email = $_POST['to_email'];
$security_key = $_POST['security_key'];

//}

//if (($result) OR ($bypass)) {
if ($result) {
if (($result == "AUTHORISED") OR ($bypass)) {
$NochexResponse = "AUTHORISED";
//do authorised stuff here, check amount against order total etc and allocate stock to customer in your MySQL tables...
} elseif ($result == "DECLINED") {
$NochexResponse = "DECLINED";
$recipient = "youremailaddress@yourdomain.com";
$subject = "nochex payment APC decline";
$mailheader = "From: valid@mail.address\n";
$order_date = date("l, d F Y");
$message = "Date: $order_date please investigate\n\n";
if (mail($recipient, $subject, $message, $mailheader)) {
echo "<!-- mail sent -->";
}
}
} else {
echo $NochexResponse = "NO RESPONSE";
}

$entry_line = "date: $transaction_date | nochex response: $NochexResponse | order_no: $order_id | transaction_id: $transaction_id | amount: $amount | from e-mail: $from_email | to e-mail: $to_email | security key: $security_key\n\n";

$fp = fopen("/files/home/xxxxxxxxxxxxxx/nochexlog.txt", "a");
fputs($fp, $entry_line);
fclose($fp);

?>

I had to adapt an example on php.net of some of the curl functions, to do the same as the provided ASP example given by NOCHEX at the time i wrote that.

When I did test my site (www.sunnydaysgifts.co.uk and click on online shop) it worked fine! I have never put it live though, but I'm confident it woudld stand up fine if I did.

When a user returns from the nochex payment pages I have all the data I need to present the customer with notifications of reserved items ready for dispatch, and warnings of any items that could not be reserved (because someone made a purchase while they were in the nochex pages). My basket automatically checks itself against stock totals at the time of clicking checkout to try and prevent orders not going through.

To be honest I did this more as a learning exercise, I doubt that the shop will ever be in an 'open' state. The shop is viewable but in the admin you can set if the shop is open (checkout allowed) or closed (checkout not allowed, but viewing/adding to basket still allowed). Check it out.

Im not sure what kind of problems you mean really, but if you have any specific Qs I'll try and answer.

Jarv
nickc
Newbie
Posts: 4
Registered: 20-08-2007

oeCommerce and NOCHEX

Hi Jarv,

A few stumbles due to me but I've got the oecomm default site up and running. I'm going to leave Nochex implementation for later.

I need some pointers on using ssl since from what I can see you can't use ssl in the cgi webspace. I would like to ssl at least customer login, address details and such like. Any thoughts?

Cheers
Nick
N/A

oeCommerce and NOCHEX

Yes this issue I could do nothing about. Unfortunately I have not solved this one (without moving to another host). The best I could do was to get nochex to take a customer's details, as there was no secure way of me obtaining them on force9. Had forgotten about that one... I have been suggesting SSL on the CGI platform update, but they dont seem interested in providing this. Obviously this means you cannot provide a nice interface for customers to view their orders Sad

http://portal.f9.net.uk/central/forums/viewtopic.php?t=4739
is the thread if you fancy adding your thoughts.


Cheers,
Jarv