nopSolutions/nopCommerce · warning · NopException

Unable to assign tracking information to orders with the pay

Error message

Unable to assign tracking information to orders with the payment in {order.Status} status

What it means

Thrown inside SetTrackingAsync when the first capture on the PayPal order's purchase unit is not in an acceptable status for tracking assignment. PayPal requires the payment capture to be COMPLETED, PARTIALLY_REFUNDED, or PENDING before tracking can be added. A capture in DENIED, DECLINED, or fully REFUNDED status makes tracking invalid. Note: the error message uses order.Status (order-level) rather than capture.Status, which may be misleading.

Source

Thrown at src/Plugins/Nop.Plugin.Payments.PayPalCommerce/Services/PayPalCommerceServiceManager.cs:2940

            customValues.FillByXml(nopOrder.CustomValuesXml);
            var orderIdKey = await _localizationService.GetResourceAsync("Plugins.Payments.PayPalCommerce.Order.Id");
            if (!customValues.TryGetValue(orderIdKey, out var orderIdValue))
                throw new NopException("Failed to get PayPal order info");

            var order = await _httpClient
                .RequestAsync<GetOrderRequest, GetOrderResponse>(new GetOrderRequest { OrderId = orderIdValue.Value }, settings) as Order;
            if (order.Status?.ToUpper() != OrderStatusType.COMPLETED.ToString())
                throw new NopException($"Unable to assign tracking information to orders in {order.Status} status");

            if (order.PurchaseUnits?.FirstOrDefault() is not PurchaseUnit unit || unit.Shipping is null)
                throw new NopException("No shipping info found for PayPal order");

            if (unit.Payments?.Captures?.FirstOrDefault() is not Capture capture ||
                (capture.Status?.ToUpper() != CaptureStatusType.COMPLETED.ToString() &&
                capture.Status?.ToUpper() != CaptureStatusType.PARTIALLY_REFUNDED.ToString() &&
                capture.Status?.ToUpper() != CaptureStatusType.PENDING.ToString()))
            {
                throw new NopException($"Unable to assign tracking information to orders with the payment in {order.Status} status");
            }

            var shipmentItems = await _shipmentService.GetShipmentItemsByShipmentIdAsync(shipment.Id);
            var items = await shipmentItems.SelectAwait(async shipmentItem =>
            {
                var orderItem = await _orderService.GetOrderItemByIdAsync(shipmentItem.OrderItemId);
                var product = await _productService.GetProductByIdAsync(orderItem.ProductId);
                var sku = await _productService.FormatSkuAsync(product, orderItem.AttributesXml);
                var url = await _nopUrlHelper.RouteGenericUrlAsync(product, _webHelper.GetCurrentRequestProtocol());
                var picture = await _pictureService.GetProductPictureAsync(product, orderItem.AttributesXml);
                var (imageUrl, _) = await _pictureService.GetPictureUrlAsync(picture);

                return new Item
                {
                    Name = CommonHelper.EnsureMaximumLength(product.Name, 127),
                    Description = CommonHelper.EnsureMaximumLength(product.ShortDescription, 127),
                    Sku = CommonHelper.EnsureMaximumLength(sku, 127),
                    Quantity = shipmentItem.Quantity.ToString(),

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Check the capture status in the PayPal dashboard for the specific order
  2. If the capture is DENIED or FAILED, do not attempt tracking sync — resolve the payment issue first
  3. If the capture is REFUNDED, the order should not be shipped — verify with fulfillment team
  4. For PENDING captures, retry tracking sync once the capture settles

Example fix

// before
var (result, error) = await _serviceManager.SetTrackingAsync(settings, shipment);

// after — verify capture status before calling
var capture = paypalOrder.PurchaseUnits?.FirstOrDefault()?.Payments?.Captures?.FirstOrDefault();
if (capture is null)
    return;
var validStatuses = new[] { "COMPLETED", "PARTIALLY_REFUNDED", "PENDING" };
if (!validStatuses.Contains(capture.Status?.ToUpper()))
{
    _logger.Information($"Capture status {capture.Status} not eligible for tracking sync");
    return;
}
var (result, error) = await _serviceManager.SetTrackingAsync(settings, shipment);
Defensive patterns

Strategy: fallback

Try / catch

// HandleFunctionAsync catches internally; use error to decide whether to retry or skip
var (result, error) = await _serviceManager.SetTrackingAsync(settings, shipment);
if (!string.IsNullOrEmpty(error) && error.Contains("payment in"))
{
    // Capture not in an eligible status — check if it is PENDING and retry later
    if (await IsCapturePendingAsync(shipment.OrderId))
        await ScheduleTrackingRetryAsync(shipment.Id, delayMinutes: 60);
    else
        _logger.Warning($"Tracking sync permanently failed for shipment {shipment.Id}: {error}");
}

Prevention

When it happens

Trigger: unit.Payments.Captures is null or empty (no capture exists), or the first capture's status is not COMPLETED, PARTIALLY_REFUNDED, or PENDING — e.g. it is DENIED, REFUNDED, or FAILED.

Common situations: The capture was denied by PayPal risk/fraud check; the order was fully refunded before the shipment was created; the payment is still being reviewed and capture has not yet occurred; a payment dispute or chargeback changed the capture status.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/612c77baa16d5e2d. Report an issue: GitHub.