checkout / checkout-magento2-plugin

Checkout.com Magento 2 official extension
MIT License
32 stars 32 forks source link

'Unable to serialize value' on the checkout page #507

Open advcha opened 2 years ago

advcha commented 2 years ago

Hi, I'm using checkoutcom plugin version 2.0.5 on magento 2.3.5. but on the checkout page, I got this error:

1 exception(s):
Exception #0 (InvalidArgumentException): Unable to serialize value.

Exception #0 (InvalidArgumentException): Unable to serialize value.
<pre>#1 Magento\Checkout\Block\Onepage->getSerializedCheckoutConfig() called at [app/design/frontend/Mgs/claue/Magento_Checkout/templates/onepage.phtml:26]
#2 include('/home/satria/Doc...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#3 Magento\Framework\View\TemplateEngine\Php->render(&Magento\Checkout\Block\Onepage\Interceptor#0000000063ed9ba6000000006c093fa4#, '/home/satria/Doc...', array()) called at [vendor/magento/framework/Interception/Interceptor.php:58]

I tried to use the newer version like 2.3.4, 3.0.0 and 3.0.1 but it's not compatible with another needed plugin. When I'm running the another plugin, I got this error from checkoutcom plugin:

<![CDATA[ Fatal Error: 'Uncaught TypeError: Argument 2 passed to CheckoutCom\Magento2\Model\Service\ApiHandlerService::captureOrder() must be of the type float, string given, called in /home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Model/Methods/CardPaymentMethod.php on line 410 and defined in /home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Model/Service/ApiHandlerService.php:188 
Stack trace: #0 /home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Model/Methods/CardPaymentMethod.php(410): CheckoutCom\Magento2\Model\Service\ApiHandlerService->captureOrder(Object(Magento\Sales\Model\Order\Payment\Interceptor), '232') 
#1 /home/satria/Documents/projects/1zillion.live/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(82): CheckoutCom\Magento2\Model\Methods\CardPaymentMethod->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), '232') 
#2 /home/satria/Documents/projects/1zillion.live/vendor/magento/module-sales/Model/Order/Paym' in '/home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Model/Service/ApiHandlerService.php' on line 188 ]]>

I can fix this manually to convert the string to float by putting (float)$amount on captureOrder function. but it'd lead to another error:

<![CDATA[ Fatal Error: 'Uncaught TypeError: Return value of CheckoutCom\Magento2\Helper\Utilities::objectToArray() must be of the type array, null returned in /home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Helper/Utilities.php:64 
Stack trace: #0 /home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Model/Service/ApiHandlerService.php(173): CheckoutCom\Magento2\Helper\Utilities->objectToArray(NULL) 
#1 /home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Model/Methods/CardPaymentMethod.php(411): CheckoutCom\Magento2\Model\Service\ApiHandlerService->isValidResponse(NULL) 
#2 /home/satria/Documents/projects/1zillion.live/vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(82): CheckoutCom\Magento2\Model\Methods\CardPaymentMethod->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), '232') 
#3 /home/satria/Documents/projects/1zillion.live/vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payme' in '/home/satria/Documents/projects/1zillion.live/vendor/checkoutcom/magento2/Helper/Utilities.php' on line 64 ]]>

The 2.0.5 version is working with the another plugin but it shows the Unable to serialize value error on the checkout page. What is the different between 2.0.5 version with the newer ones? How to fix this? I found no captureOrder function on 2.0.5