Buckaroo Return To Webshop Not Working

Hi there,

I am using Buckaroo Ideal as payment method. I have got the connection set up succesfully. I am in test mode. But at the redirect back to the shop, something is not working. I get a 404 page. What am I missing? Where should I look?

http://testserver-nulvijf.nl/

Dear Lianne,

I would suggest Pay.nl instead of Buckaroo, they offer just about everything a Dutch web store needs. Ask for Andy Pieters.

Yours truly,

Anthony Katgert

Dear Lianne,

I would suggest Pay.nl instead of Buckaroo, they offer just about everything a Dutch web store needs. Ask for Andy Pieters.

Yours truly,

Anthony Katgert

Thanks for the suggestion. But that is not an option for my client.

Did you try to contact Buckaroo ? If you are using their plugin / addon for CS Cart then it is theirs to fix

Did you try to contact Buckaroo ? If you are using their plugin / addon for CS Cart then it is theirs to fix

The code comes with CS Cart.

But every day I am getting better in answering my own questions :-)

The thing (=bug?) is:

Buckaroo returns the $_REQUEST with uppercase characters, while the code in ideal_xml.php expects lower case. So I fixed it to add this piece of code in \app\payments\ideal_xml.php:

if ($mode == 'notify') {
$pp_response = array();

foreach($_REQUEST as $ky => $vl) {
$lower_key = strtolower($ky);
$_REQUEST[$lower_key] = $vl;

}

​etc.

But I am still not where I want. Because I am getting returned to the checkout page on "succes", because somehow it returns "failed". And the session is still running, so the cart is still filled.

Something is going wrong with the $_signature. It doesn't match (yet).

I'll keep on searching.

Try to delete uppercase values from the request

   foreach($_REQUEST as $ky => $vl) {
     unset($_REQUEST[$ky]);
     $lower_key = strtolower($ky);
     $_REQUEST[$lower_key] = $vl;
   }

As far as I can see from the code, the system uses both uppercase and lowercase values to calculate signature. As a result, you receive wrong result

Try to delete uppercase values from the request

   foreach($_REQUEST as $ky => $vl) {
     unset($_REQUEST[$ky]);
     $lower_key = strtolower($ky);
     $_REQUEST[$lower_key] = $vl;
   }

As far as I can see from the code, the system uses both uppercase and lowercase values to calculate signature. As a result, you receive wrong result

I also tried that. But that is not all, so it seems. The (returned) signatures are not matching yet. I am still on it. To be continued...

ok. Found the solution. Disregard my previous solution.

In the if{} section of the code change the $_REQUEST params to uppercase. And unset it in the fn_buckaroo_calculate_signature function.

...

if ($mode == 'notify') {
$pp_response = array();

$order_info = fn_get_order_info($_REQUEST['BRQ_INVOICENUMBER']);
$processor_data = fn_get_payment_method_data($order_info['payment_id']);
$pp_response["transaction_id"] = $_REQUEST['BRQ_TRANSACTIONS'];
$pp_response["reason_text"] = urldecode($_REQUEST['BRQ_STATUSMESSAGE']);
$_REQUEST['BRQ_WEBSITEKEY'] = $processor_data['processor_params']['merchant_id'];

$_signature = fn_buckaroo_calculate_signature($_REQUEST, $processor_data["processor_params"]["merchant_key"]);
if (in_array($_REQUEST['BRQ_STATUSCODE'], array('190')) && $_REQUEST['BRQ_SIGNATURE'] == $_signature) {
$pp_response['order_status'] = 'P';
} elseif (in_array($_REQUEST['BRQ_STATUSCODE'], array('791', '492'))) {
$pp_response['order_status'] = 'O'; // still waiting for the response
} else {
$pp_response['order_status'] = 'F';
}
fn_finish_payment($_REQUEST['BRQ_INVOICENUMBER'], $pp_response, false);
$route = $order_info['repaid'] ? 'repay' : 'route';
fn_order_placement_routines($route, $_REQUEST['BRQ_INVOICENUMBER']);
}

etc.

function fn_buckaroo_calculate_signature($params, $secret_key)
{
unset($params['brq_signature']);
unset($params['BRQ_SIGNATURE']);

etc.