nopSolutions/nopCommerce · error · NopException

Order payment info not found

Error message

Order payment info not found

What it means

Thrown in GetOrderAsync when _orderProcessingService.GetProcessPaymentRequestAsync() returns null. The process payment request carries the customer's checkout state across the payment flow; if it is missing, the plugin cannot correlate the PayPal order with the nopCommerce checkout session.

Source

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

    /// <summary>
    /// Get the order by id
    /// </summary>
    /// <param name="settings">Plugin settings</param>
    /// <param name="orderId">Order id</param>
    /// <returns>
    /// A task that represents the asynchronous operation
    /// The task result contains the order; error message if exists
    /// </returns>
    public async Task<(Order Order, string Error)> GetOrderAsync(PayPalCommerceSettings settings, string orderId)
    {
        return await HandleFunctionAsync(async () =>
        {
            if (!IsConfigured(settings))
                throw new NopException("Plugin not configured");

            var paymentRequest = await _orderProcessingService.GetProcessPaymentRequestAsync()
                ?? throw new NopException("Order payment info not found");

            var orderIdKey = await _localizationService.GetResourceAsync("Plugins.Payments.PayPalCommerce.Order.Id");
            if (!paymentRequest.CustomValues.TryGetValue(orderIdKey, out var orderIdValue) ||
                !string.Equals(orderIdValue.Value, orderId, StringComparison.InvariantCultureIgnoreCase))
                throw new NopException("Failed to get PayPal order info");

            var placementKey = await _localizationService.GetResourceAsync("Plugins.Payments.PayPalCommerce.Order.Placement");
            if (!paymentRequest.CustomValues.TryGetValue(placementKey, out var placementValue) ||
                !Enum.TryParse<ButtonPlacement>(placementValue.Value, out var placement))
            {
                throw new NopException("Failed to get PayPal order info");
            }

            var order = await _httpClient.RequestAsync<GetOrderRequest, GetOrderResponse>(new GetOrderRequest { OrderId = orderId }, settings);

            return order;
        });
    }

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Ensure the checkout flow initializes the process payment request before redirecting to PayPal
  2. Check session timeout settings to ensure they are long enough for PayPal redirects
  3. Prevent concurrent checkout sessions that may clear payment state
  4. Redirect the customer to restart checkout if the payment session is lost
Defensive patterns

Strategy: validation

Validate before calling

// Verify payment request exists before calling GetOrderAsync
var paymentRequest = await _orderProcessingService.GetProcessPaymentRequestAsync();
if (paymentRequest is null)
{
    //session lost — restart checkout
    return RedirectToRoute("Checkout");
}

Type guard

static bool HasPaymentRequest(ProcessPaymentRequest request)
    => request is not null;

Try / catch

var (order, error) = await manager.GetOrderAsync(settings, orderId);
if (!string.IsNullOrEmpty(error) && error == "Order payment info not found")
    return RedirectToRoute("Checkout"); // restart checkout flow

Prevention

When it happens

Trigger: GetOrderAsync calls GetProcessPaymentRequestAsync() which returns null, meaning no payment request was initialized for the current checkout session.

Common situations: Checkout session expired before the PayPal redirect returned; the payment request was cleared by a concurrent checkout attempt or session reset; customer opened multiple checkout tabs and one cleared the session; custom checkout flow that does not initialize the process payment request before redirecting to PayPal.

Related errors


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