Post by psjrules » Thu Mar 06, 2025 12:28 am

Hi,

I'm experiencing a problem with my SagePay Direct integration. The checkout process appears to complete successfully (showing a success message to the user), but no transaction is recorded on the Opayo platform, and no funds are transferred.

**Background:**

Initially, I was receiving a "NotificationURL is needed" error. To address this, I modified the file: public_html/catalog/controller/extension/payment/sagepay_direct.php. I noticed that the following code block related to 3D Secure was present, but it did not contain an explicit NotificationURL parameter:

$payment_data['ThreeDSNotificationURL'] = str_replace('&', '&', $this->url->link('extension/payment/sagepay_direct/threeDSnotify', 'order_id=' . $this->session->data['order_id'], true));

**Attempted Solutions and Results:**

*First Attempt: I added the following line:*
$payment_data['ThreeDSNotificationURL'] = str_replace('&', '&', $this->url->link('extension/payment/sagepay_direct/callback', 'order_id=' . $this->session->data['order_id'], true));

Result: This resulted in a success message, but no actual transaction was processed on Opayo.

*Second Attempt:* I removed the previous line and modified the existing ThreeDSNotificationURL (as you had it shown) to:
$payment_data['NotificationURL'] = str_replace('&', '&', $this->url->link('extension/payment/sagepay_direct/threeDSnotify', 'order_id=' . $this->session->data['order_id'], true));

Result: The same issue persists: a success message is displayed, but no transaction or payment is reflected on Opayo.

**Current State:**
The checkout process consistently reports success, but no corresponding transaction appears on the Opayo platform. I've tried two different approaches to setting the NotificationURL, both with the same unsuccessful outcome.

**Request:**
Please advise on how to correctly configure the NotificationURL (or any other relevant setting) to ensure that successful transactions are processed and recorded on Opayo. Any guidance on troubleshooting this issue would be greatly appreciated.

Thanks,

Version 3.0.3.6

New member

Posts

Joined
Fri Jan 11, 2019 6:57 pm

Post by psjrules » Thu Mar 06, 2025 12:44 am

The function it is calling is below:

public function threeDSnotify() {
$this->load->language('extension/payment/sagepay_direct');

$this->load->model('extension/payment/sagepay_direct');
$this->load->model('checkout/order');

if (isset($this->request->get['order_id'])) {
$sagepay_order_info = $this->model_extension_payment_sagepay_direct->getOrder($this->request->get['order_id']);

if ($this->config->get('payment_sagepay_direct_test') == 'live') {
$url = 'https://live.opayo.eu.elavon.com/gatewa ... llback.vsp';
} elseif ($this->config->get('payment_sagepay_direct_test') == 'test') {
$url = 'https://sandbox.opayo.eu.elavon.com/gat ... llback.vsp';
}

$this->request->post['VPSTxId'] = $sagepay_order_info['VPSTxId'];

$response_data = $this->model_extension_payment_sagepay_direct->sendCurl($url, $this->request->post);

$this->model_extension_payment_sagepay_direct->logger('Response Data', $response_data);

if ($response_data['Status'] == 'OK' || $response_data['Status'] == 'AUTHENTICATED' || $response_data['Status'] == 'REGISTERED') {
$message = '';

if (isset($response_data['TxAuthNo'])) {
$message .= 'TxAuthNo: ' . $response_data['TxAuthNo'] . "\n";
} else {
$response_data['TxAuthNo'] = '';
}

if (isset($response_data['AVSCV2'])) {
$message .= 'AVSCV2: ' . $response_data['AVSCV2'] . "\n";
}

if (isset($response_data['AddressResult'])) {
$message .= 'AddressResult: ' . $response_data['AddressResult'] . "\n";
}

if (isset($response_data['PostCodeResult'])) {
$message .= 'PostCodeResult: ' . $response_data['PostCodeResult'] . "\n";
}

if (isset($response_data['CV2Result'])) {
$message .= 'CV2Result: ' . $response_data['CV2Result'] . "\n";
}

if (isset($response_data['3DSecureStatus'])) {
$message .= '3DSecureStatus: ' . $response_data['3DSecureStatus'] . "\n";
}

if (isset($response_data['CAVV'])) {
$message .= 'CAVV: ' . $response_data['CAVV'] . "\n";
}

$order_info = $this->model_checkout_order->getOrder($this->request->get['order_id']);
$sagepay_order_info = $this->model_extension_payment_sagepay_direct->getOrder($this->request->get['order_id']);

$this->model_extension_payment_sagepay_direct->logger('Order Info', $order_info);
$this->model_extension_payment_sagepay_direct->logger('Sagepay Order Info', $sagepay_order_info);

$this->model_extension_payment_sagepay_direct->updateOrder($order_info, $response_data);
$this->model_extension_payment_sagepay_direct->addTransaction($sagepay_order_info['sagepay_direct_order_id'], $this->config->get('payment_sagepay_direct_transaction'), $order_info);
$this->model_checkout_order->addOrderHistory($this->request->get['order_id'], $this->config->get('payment_sagepay_direct_order_status_id'), $message, false);

if ($this->config->get('payment_sagepay_direct_transaction') == 'PAYMENT') {
if (VERSION >= '3.1.1.0') {
// Loop through any products that are subscription items
$subscription_products = $this->cart->getSubscription();

foreach ($subscription_products as $item) {
$this->model_extension_payment_sagepay_direct->recurringPayment($item['subscription'], $payment_data['VendorTxCode']);
}
} else {
$recurring_products = $this->cart->getRecurringProducts();

//loop through any products that are recurring items
foreach ($recurring_products as $item) {
$this->model_extension_payment_sagepay_direct->recurringPayment($item, $sagepay_order_info['VendorTxCode']);
}
}
}

$this->response->redirect($this->url->link('checkout/success', '', true));
} else {
$this->session->data['error'] = $response_data['StatusDetail'];

$this->response->redirect($this->url->link('checkout/checkout', '', true));
}
} else {
$this->response->redirect($this->url->link('account/login', '', true));
}
}

New member

Posts

Joined
Fri Jan 11, 2019 6:57 pm

Post by by mona » Thu Mar 06, 2025 12:47 am

As far as I am aware there is an issue with Protocol 4 => viewtopic.php?t=227404
If you scroll down Paul has a link to his site which may provide a solution.

I am not sure if the extension has been updated => https://www.opencart.com/index.php?rout ... n_id=36557

You can also try this => viewtopic.php?t=232618

Let us know how you get on.

Please put your code in the code quotes using </> in the button bar - thanks

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by psjrules » Thu Mar 06, 2025 1:18 am

Hi Mona,

Thanks for the links. To confirm:
  • 1
] My integration is using Protocol 4 (as discussed in the second forum post).
  • 2
I've updated the URL from sagelive to live.opayo.
I want to reiterate that I previously tried the official Opayo extension. It was extremely buggy, and despite working directly with their developers for an extended period, we couldn't resolve the issues. This forced me to revert to the SagePay Direct integration, which is modified to be compliant with Protocol 4.

The current, and most pressing, problem is that orders are now showing as successful, but no payment is actually processed, and there are no corresponding transactions in the Opayo admin panel. This behavior started after I attempted to fix a "NotificationURL is needed" error which recently popped up. The current setup has been in use since 2022. So, not sure what recently changed that it actually started asking for the NotificationURL.

New member

Posts

Joined
Fri Jan 11, 2019 6:57 pm

Post by by mona » Thu Mar 06, 2025 4:18 am

You can check your error logs but it sounds likely that sagepay have changed things. If Dreamvension are no longer supporting their module there is a paid extension you could purchase or maybe ask for paid support.
https://www.opencart.com/index.php?rout ... 87b4fcac31

It is a long time since I used sagepay as a payment option, you might want to consider something better supported.
Google might have some ideas => https://www.google.com/search?q=sagepay ... icationURL
https://stackoverflow.com/questions/257 ... icationurl

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am
Who is online

Users browsing this forum: No registered users and 7 guests