Magento – Cartid is a required field error in custom payment

cartmagento-2.1magento2payment

I am using ccavenue payment module in my site. For guest users payment is working fine, it's redirected to the payment page. But for logged in users I am getting this error while placing the order. I checked in headers cartid is passing to the payment. My magento version is Magento ver. 2.1.11

http://test.com/rest/default/V1/carts/mine/billing-address

cartId is a required field

Anybody have an idea?

Best Answer

Have you tried this one?

https://github.com/magento/magento2/issues/1443

It was issue in early release of Magento 2. But after reporting it has been fixed.

Override the file in any custom module

vendor/magento/module-shipping/Model/CarrierFactory.php

Find the function createIfActive after the line

\Magento\Store\Model\ScopeInterface::SCOPE_STORE,

Add $storeId

You function would be like this:

public function createIfActive($carrierCode, $storeId = null)
{
    return $this->_scopeConfig->isSetFlag(
        'carriers/' . $carrierCode . '/active',
        \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
        $storeId
    ) ? $this->create(
        $carrierCode,
        $storeId
    ) : false;
}