Hi to all,
I have a question - how can I use in the checkout custom Payment module for an Order with zero Total Amount? In the module I put 0 as minimum total amount.
Zero Subtotal Checkout is not an option for me. I want to use another module. Is it some configuration or something more complicated?
Regards!
PS - it looks I find the way - set minimum total amount in the custom module to 0, then just disable Zero Subtotal Checkout.
Regards!
PPS - ok, my module is visible and works, but when it come time for redirect to Success page, I got an error - The requested Payment Method is not available.
How can my module be not available, after I saw it and use it?
And more info:
I got 400 when Magento call domain/rest/default/V1/carts/mine/set-payment-information
with response:
message: The requested Payment Method is not available.
trace: #0 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\PaymentMethodManagement->set(97, Object(Magento\Quote\Model\Quote\Payment\Interceptor))#1 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\PaymentMethodManagement\Interceptor->___callParent('set', Array)#2 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\PaymentMethodManagement\Interceptor->Magento\Framework\Interception\{closure}(97, Object(Magento\Quote\Model\Quote\Payment\Interceptor))#3 /srv/html/magentover2/generated/code/Magento/Quote/Model/PaymentMethodManagement/Interceptor.php(26): Magento\Quote\Model\PaymentMethodManagement\Interceptor->___callPlugins('set', Array, Array)#4 /srv/html/magentover2/vendor/magento/module-checkout/Model/PaymentInformationManagement.php(132): Magento\Quote\Model\PaymentMethodManagement\Interceptor->set(97, Object(Magento\Quote\Model\Quote\Payment\Interceptor))#5 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Model\PaymentInformationManagement->savePaymentInformation(97, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address))#6 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callParent('savePaymentInfo...', Array)#7 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->Magento\Framework\Interception\{closure}(97, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address))#8 /srv/html/magentover2/generated/code/Magento/Checkout/Model/PaymentInformationManagement/Interceptor.php(39): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callPlugins('savePaymentInfo...', Array, Array)#9 [internal function]: Magento\Checkout\Model\PaymentInformationManagement\Interceptor->savePaymentInformation(97, Object(Magento\Quote\Model\Quote\Payment\Interceptor), Object(Magento\Quote\Model\Quote\Address))#10 /srv/html/magentover2/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)#11 /srv/html/magentover2/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))#12 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))#13 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)#14 /srv/html/magentover2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))#15 /srv/html/magentover2/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)#16 /srv/html/magentover2/vendor/magento/framework/App/Http.php(137): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))#17 /srv/html/magentover2/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()#18 /srv/html/magentover2/vendor/magento/framework/App/Bootstrap.php(261): Magento\Framework\App\Http\Interceptor->launch()#19 /srv/html/magentover2/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))#20 {main}
Soo, the problem was - ZeroTotal total check.
We can override it with a Plugin:
in the di.xml:
<type name="Magento\Payment\Model\Checks\ZeroTotal"> <plugin name="some_name" type="Test\Test\Plugin\ZeroTotal" /> </type>
then in Model/Plugin:
namespace Test\Test\Plugin; class ZeroTotal { public function afterIsApplicable($subject, $result) { return true; } }
And you have working 0 Total Order checkout for a custom payment module.