{"record":{"id":"a4030b5e9cfce15a","repo":"nopSolutions/nopCommerce","slug":"cannot-do-capture-for-order","errorCode":null,"errorMessage":"Cannot do capture for order.","messagePattern":"Cannot do capture for order\\.","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Orders/OrderProcessingService.cs","lineNumber":2502,"sourceCode":"            return true;\r\n\r\n        return false;\r\n    }\r\n\r\n    /// <summary>\r\n    /// Capture an order (from admin panel)\r\n    /// </summary>\r\n    /// <param name=\"order\">Order</param>\r\n    /// <returns>\r\n    /// A task that represents the asynchronous operation\r\n    /// The task result contains a list of errors; empty list if no errors\r\n    /// </returns>\r\n    public virtual async Task<IList<string>> CaptureAsync(Order order)\r\n    {\r\n        ArgumentNullException.ThrowIfNull(order);\r\n\r\n        if (!await CanCaptureAsync(order))\r\n            throw new NopException(\"Cannot do capture for order.\");\r\n\r\n        var request = new CapturePaymentRequest();\r\n        CapturePaymentResult result = null;\r\n        try\r\n        {\r\n            //old info from placing order\r\n            request.Order = order;\r\n            result = await _paymentService.CaptureAsync(request);\r\n\r\n            if (result.Success)\r\n            {\r\n                var paidDate = order.PaidDateUtc;\r\n                if (result.NewPaymentStatus == PaymentStatus.Paid)\r\n                    paidDate = DateTime.UtcNow;\r\n\r\n                order.CaptureTransactionId = result.CaptureTransactionId;\r\n                order.CaptureTransactionResult = result.CaptureTransactionResult;\r\n                order.PaymentStatus = result.NewPaymentStatus;\r","sourceCodeStart":2484,"sourceCodeEnd":2520,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Orders/OrderProcessingService.cs#L2484-L2520","documentation":"Thrown by OrderProcessingService.CaptureAsync when CanCaptureAsync(order) returns false. Capture is allowed only when OrderStatus is not Cancelled and not Pending, PaymentStatus is Authorized, and the configured payment method supports capture (SupportCaptureAsync). It blocks capturing funds from orders that are not in an authorized, capturable state or whose payment gateway cannot capture.","triggerScenarios":"Calling CaptureAsync when: order is Cancelled or Pending; order.PaymentStatus != Authorized; or the payment method (PaymentMethodSystemName) does not support capture. Common from admin 'Capture' on a wrong-state order, or an automated capture job run too early/late.","commonSituations":"Payment method plugin misconfigured or not supporting capture; order still Pending because the authorize callback hasn't landed; order already cancelled/refunded; capturing an order that used a manual/authorizing gateway that lacks the capture capability.","solutions":["Guard before calling: if (!await _orderProcessingService.CanCaptureAsync(order)) return; (or surface 'capture not available' to the user).","Verify order.PaymentStatus == PaymentStatus.Authorized and order.OrderStatus is Processing before enabling capture.","Confirm the payment method plugin supports capture via _paymentService.SupportCaptureAsync(order.PaymentMethodSystemName); if not, install/enable one that does.","Wait for the authorize webhook to set the order to Authorized before attempting capture."],"exampleFix":"// before\nvar errors = await _orderProcessingService.CaptureAsync(order);\n\n// after\nif (!await _orderProcessingService.CanCaptureAsync(order))\n    return new[] { \"Capture is not available for this order.\" };\n\nvar errors = await _orderProcessingService.CaptureAsync(order);","handlingStrategy":"validation","validationCode":"if (!await _orderProcessingService.CanCaptureAsync(order))\n    return;\n\nvar errors = await _orderProcessingService.CaptureAsync(order);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only offer Capture when order.PaymentStatus == Authorized and order.OrderStatus is Processing.","Confirm the payment plugin supports capture via SupportCaptureAsync.","Wait for the authorize callback before enabling capture."],"tags":["payment","capture","order-processing","payment-method"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}