Authorize and Capture Payment Action Not Completing Order in Magento EE
If you’re facing issues with the “Authorize and Capture” payment action not completing orders as expected in your Magento Enterprise Edition (EE) installation, you’re not alone. This problem is a common one that many developers encounter during module creation or upgrade processes.
Understanding the “Authorize Only” and “Authorize and Capture” Actions
Before we dive into the solution, let’s quickly recap these two payment actions:
-
Authorize Only: The payment gateway reserves the funds from your customer’s account but does not actually process (capture) the transaction. This is useful for scenarios where you want to ensure the funds are available before processing.
-
Authorize and Capture: In this scenario, the payment gateway both reserves and immediately processes the transaction. The funds are debited from the customer’s account right away.
Why “Authorize and Capture” Isn’t Working in Magento EE 10.0.0
The issue you’re experiencing is likely due to a known bug in Magento EE 10.0.0 that affects the handling of these payment actions. The bug causes the order status to remain as “pending” even after a successful transaction, instead of updating it to “complete.”
This is an isolated problem that has been fixed in later versions of Magento EE, including version 10.1.0.
Steps to Resolve the Issue
Since this is a known issue with your current version of Magento EE, there are a few potential solutions you can try:
Update Your Magento Installation
The most straightforward solution is to update your Magento installation to version 10.1.0 or later. This version includes the fix for this specific problem, ensuring that the “Authorize and Capture” action works correctly.
To upgrade, follow the official Magento upgrade guide: How to Upgrade Magento
Apply a Hotfix
If you’re unable to update your installation immediately, you can apply a specific hotfix that addresses this issue. Adobe typically releases hotfixes for critical bugs like these.
Check the Magento Issue Tracker to see if there’s an available hotfix for your specific version of Magento.
Custom Code Patch
As a last resort, you can create a custom code patch that manually updates the order status after a successful transaction. This involves modifying core files, which should be done with extreme caution and only as a temporary solution until you can upgrade to a later version.
Here’s a basic example of how you might modify the sales_order_service_v1 API controller:
public function execute()
{
$result = parent::execute();
if ($order->getState() == 'processing' && $payment->getIsTransactionPending()) {
$order->setStatus('complete');
$order->save();
}
return $result;
}
This code checks if the order is in the “processing” state and the payment transaction is pending. If both conditions are met, it manually sets the order status to “complete.”
Remember, this is a temporary workaround that should not be used as a long-term solution.
Conclusion
The problem you’re experiencing with the “Authorize and Capture” action not completing orders in Magento EE 10.0.0 is a known bug that has been fixed in later versions of the platform.
Our recommended solution is to update your installation to version 10.1.0 or later, which includes this specific fix. If an upgrade isn’t immediately possible, applying a hotfix or creating a custom code patch can serve as temporary solutions until you can upgrade.
Always remember to backup your data before performing any upgrades or modifications to core files.
For more information on Magento EE updates and best practices, visit Laravel Company.
Happy coding!