Question

I am working on Worldpay payment module to enable Worldpay payment method in my magento 2 website but i got following error while click on place order.

i am using Worldpay module from https://github.com/Worldpay/worldpay-magento2

public function setupWorldpay() {
    $service_key = $this->config->getServiceKey();
    $worldpay = new \Worldpay\Worldpay($service_key); //(line no 221)

    $worldpay->setPluginData('Magento2', '2.0.25');
    \Worldpay\Utils::setThreeDSShopperObject([
        'shopperIpAddress' => \Worldpay\Utils::getClientIp(),
        'shopperSessionId' => $this->customerSession->getSessionId(),
        'shopperUserAgent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '',
        'shopperAcceptHeader' => '*/*'
    ]);
    return $worldpay;
}

Fatal error: Class 'Worldpay\Worldpay' not found in /public_html/app/code/Worldpay/Payments/Model/Methods/WorldpayPayments.php on line 221

Was it helpful?

Solution

That module depends on worldpay php library. So first intall that library using below command and then try that payment module again.

composer require worldpay/worldpay-lib-php

Once this library is installed, you will not get that error.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top