{"record":{"id":"bc977ab13db6dc72","repo":"nopSolutions/nopCommerce","slug":"payment-method-couldn-t-be-loaded","errorCode":null,"errorMessage":"Payment method couldn't be loaded","messagePattern":"Payment method couldn't be loaded","errorType":"validation","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Orders/OrderProcessingService.cs","lineNumber":1405,"sourceCode":"    /// Get process payment result\r\n    /// </summary>\r\n    /// <param name=\"processPaymentRequest\">Process payment request</param>\r\n    /// <param name=\"details\">Place order container</param>\r\n    /// <returns>\r\n    /// A task that represents the asynchronous operation\r\n    /// The task result contains the \r\n    /// </returns>\r\n    protected virtual async Task<ProcessPaymentResult> GetProcessPaymentResultAsync(ProcessPaymentRequest processPaymentRequest, PlaceOrderContainer details)\r\n    {\r\n        //process payment\r\n        ProcessPaymentResult processPaymentResult;\r\n        //check if is payment workflow required\r\n        if (await IsPaymentWorkflowRequiredAsync(details.Cart))\r\n        {\r\n            var customer = await _customerService.GetCustomerByIdAsync(processPaymentRequest.CustomerId);\r\n            var paymentMethod = await _paymentPluginManager\r\n                                    .LoadPluginBySystemNameAsync(processPaymentRequest.PaymentMethodSystemName, customer, processPaymentRequest.StoreId)\r\n                                ?? throw new NopException(\"Payment method couldn't be loaded\");\r\n\r\n            //ensure that payment method is active\r\n            if (!_paymentPluginManager.IsPluginActive(paymentMethod))\r\n                throw new NopException(\"Payment method is not active\");\r\n\r\n            if (details.IsRecurringShoppingCart)\r\n            {\r\n                //recurring cart\r\n                processPaymentResult = (await _paymentService.GetRecurringPaymentTypeAsync(processPaymentRequest.PaymentMethodSystemName)) switch\r\n                {\r\n                    RecurringPaymentType.NotSupported => throw new NopException(\"Recurring payments are not supported by selected payment method\"),\r\n                    RecurringPaymentType.Manual or\r\n                        RecurringPaymentType.Automatic => await _paymentService.ProcessRecurringPaymentAsync(processPaymentRequest),\r\n                    _ => throw new NopException(\"Not supported recurring payment type\"),\r\n                };\r\n            }\r\n            else\r\n                //standard cart\r","sourceCodeStart":1387,"sourceCodeEnd":1423,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Orders/OrderProcessingService.cs#L1387-L1423","documentation":"Thrown inside GetProcessPaymentResultAsync when _paymentPluginManager.LoadPluginBySystemNameAsync returns null for the requested PaymentMethodSystemName. This means nopCommerce could not resolve any installed/configured payment plugin matching the system name stored on the payment request, so payment processing cannot proceed.","triggerScenarios":"PlaceOrderAsync with processPaymentRequest.PaymentMethodSystemName that is empty, mistyped, or refers to an uninstalled/disabled plugin. Also triggered when the plugin assembly is missing from /Plugins or the plugin record was deleted from the DB while the customer's session still references it.","commonSituations":"Plugin was uninstalled but customers have stale checkout sessions pointing at it; configuration moved between environments without deploying plugins; a payment provider was renamed across versions; multi-store setup where the plugin is not enabled for the current store.","solutions":["Verify the payment method is installed and marked active in Admin > Configuration > Payment methods for the relevant store.","Check processPaymentRequest.PaymentMethodSystemName is non-empty and matches the plugin's exact system name (case-sensitive).","Redeploy the plugin assembly to the Plugins directory if it was removed during deployment.","Clear stale customer sessions/checkout state that reference an uninstalled method."],"exampleFix":"// before\nvar pm = await _paymentPluginManager.LoadPluginBySystemNameAsync(processPaymentRequest.PaymentMethodSystemName, customer, storeId);\n\n// after\nif (string.IsNullOrWhiteSpace(processPaymentRequest.PaymentMethodSystemName))\n    return Error(\"No payment method selected.\");\nvar pm = await _paymentPluginManager.LoadPluginBySystemNameAsync(processPaymentRequest.PaymentMethodSystemName, customer, storeId);\nif (pm is null || !_paymentPluginManager.IsPluginActive(pm))\n    return Error($\"Payment method '{processPaymentRequest.PaymentMethodSystemName}' is unavailable.\");","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(processPaymentRequest.PaymentMethodSystemName))\n    return Error(\"Select a payment method.\");\n\nvar pm = await _paymentPluginManager\n    .LoadPluginBySystemNameAsync(processPaymentRequest.PaymentMethodSystemName, customer, storeId);\nif (pm is null)\n    return Error($\"Payment method '{processPaymentRequest.PaymentMethodSystemName}' is unavailable.\");\n\nawait _orderProcessingService.PlaceOrderAsync(processPaymentRequest, details);","typeGuard":"async Task<bool> PaymentMethodResolvesAsync(string systemName, Customer customer, int storeId)\n{\n    if (string.IsNullOrWhiteSpace(systemName)) return false;\n    var pm = await _paymentPluginManager.LoadPluginBySystemNameAsync(systemName, customer, storeId);\n    return pm is not null;\n}","tryCatchPattern":"try\n{\n    await _orderProcessingService.PlaceOrderAsync(processPaymentRequest, details);\n}\ncatch (NopException ex) when (ex.Message == \"Payment method couldn't be loaded\")\n{\n    return BadRequest(\"The selected payment method is no longer available. Please choose another.\");\n}","preventionTips":["Render only active, resolvable payment methods at checkout via LoadActivePluginsAsync so customers cannot select a dead one.","Persist PaymentMethodSystemName only from the validated active set, never trust a stale session value.","After deploying/uninstalling a plugin, clear checkout sessions that reference it."],"tags":["payment","plugin","checkout","configuration","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}