nopSolutions/nopCommerce · error · NopException
Cannot do capture for order.
Error message
Cannot do capture for order.
What it means
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.
Source
Thrown at src/Libraries/Nop.Services/Orders/OrderProcessingService.cs:2502
return true;
return false;
}
/// <summary>
/// Capture an order (from admin panel)
/// </summary>
/// <param name="order">Order</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains a list of errors; empty list if no errors
/// </returns>
public virtual async Task<IList<string>> CaptureAsync(Order order)
{
ArgumentNullException.ThrowIfNull(order);
if (!await CanCaptureAsync(order))
throw new NopException("Cannot do capture for order.");
var request = new CapturePaymentRequest();
CapturePaymentResult result = null;
try
{
//old info from placing order
request.Order = order;
result = await _paymentService.CaptureAsync(request);
if (result.Success)
{
var paidDate = order.PaidDateUtc;
if (result.NewPaymentStatus == PaymentStatus.Paid)
paidDate = DateTime.UtcNow;
order.CaptureTransactionId = result.CaptureTransactionId;
order.CaptureTransactionResult = result.CaptureTransactionResult;
order.PaymentStatus = result.NewPaymentStatus;
View on GitHub (pinned to 64bdf2ff08)
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.
Example fix
// before
var errors = await _orderProcessingService.CaptureAsync(order);
// after
if (!await _orderProcessingService.CanCaptureAsync(order))
return new[] { "Capture is not available for this order." };
var errors = await _orderProcessingService.CaptureAsync(order); Defensive patterns
Strategy: validation
Validate before calling
if (!await _orderProcessingService.CanCaptureAsync(order))
return;
var errors = await _orderProcessingService.CaptureAsync(order); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Cannot do refund for order.
- Cannot do void for order.
- You can't mark this order as paid
- You can't refund this order
- Cannot do partial refund for order.
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/a4030b5e9cfce15a.
Report an issue: GitHub.