{"record":{"id":"87a500a13ce3c727","repo":"nopSolutions/nopCommerce","slug":"payment-method-couldn-t-be-loaded-87a500","errorCode":null,"errorMessage":"Payment method couldn't be loaded","messagePattern":"Payment method couldn't be loaded","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Libraries/Nop.Services/Payments/PaymentService.cs","lineNumber":65,"sourceCode":"    /// <returns>\r\n    /// A task that represents the asynchronous operation\r\n    /// The task result contains the process payment result\r\n    /// </returns>\r\n    public virtual async Task<ProcessPaymentResult> ProcessPaymentAsync(ProcessPaymentRequest processPaymentRequest)\r\n    {\r\n        if (processPaymentRequest.OrderTotal == decimal.Zero)\r\n        {\r\n            var result = new ProcessPaymentResult\r\n            {\r\n                NewPaymentStatus = PaymentStatus.Paid\r\n            };\r\n            return result;\r\n        }\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        return await paymentMethod.ProcessPaymentAsync(processPaymentRequest);\r\n    }\r\n\r\n    /// <summary>\r\n    /// Post process payment (used by payment gateways that require redirecting to a third-party URL)\r\n    /// </summary>\r\n    /// <param name=\"postProcessPaymentRequest\">Payment info required for an order processing</param>\r\n    /// <returns>A task that represents the asynchronous operation</returns>\r\n    public virtual async Task PostProcessPaymentAsync(PostProcessPaymentRequest postProcessPaymentRequest)\r\n    {\r\n        //already paid or order.OrderTotal == decimal.Zero\r\n        if (postProcessPaymentRequest.Order.PaymentStatus == PaymentStatus.Paid)\r\n            return;\r\n\r\n        var customer = await _customerService.GetCustomerByIdAsync(postProcessPaymentRequest.Order.CustomerId);\r\n        var paymentMethod = await _paymentPluginManager\r\n                                .LoadPluginBySystemNameAsync(postProcessPaymentRequest.Order.PaymentMethodSystemName, customer, postProcessPaymentRequest.Order.StoreId)\r","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Payments/PaymentService.cs#L47-L83","documentation":"Thrown by PaymentService.ProcessPaymentAsync when the payment method plugin selected for the order cannot be loaded by LoadPluginBySystemNameAsync. This happens for non-zero totals (zero totals short-circuit to Paid). It means processPaymentRequest.PaymentMethodSystemName does not resolve to an installed, active plugin for that customer/store, so the actual payment processing cannot run. This is a checkout-critical failure.","triggerScenarios":"Placing an order / processing payment with a PaymentMethodSystemName that is null, empty, misspelled, uninstalled, disabled, or restricted to a different store/customer. Reachable on the final checkout step or any direct ProcessPaymentAsync call.","commonSituations":"Payment plugin uninstalled or disabled after orders were placed against it; LimitToStores/LimitedToRoles excluding the current customer/store; PaymentMethodSystemName not set on the process payment request; a renamed plugin whose old system name is stored on the order; environment mismatch (plugin present in dev, missing in prod).","solutions":["Ensure the payment plugin matching PaymentMethodSystemName is installed, enabled, and active for the current store/customer.","Set processPaymentRequest.PaymentMethodSystemName to a valid, active method before calling ProcessPaymentAsync.","Check LimitToStores and LimitedToRoles on the plugin so it covers the checkout context.","Add a pre-checkout guard: verify _paymentPluginManager.IsPluginActive(systemName, customer, storeId) before submitting payment."],"exampleFix":"// before\nawait _paymentService.ProcessPaymentAsync(request);\n\n// after\nvar pm = await _paymentPluginManager.LoadPluginBySystemNameAsync(request.PaymentMethodSystemName, customer, request.StoreId);\nif (pm is null)\n    throw new InvalidOperationException($\"Payment method '{request.PaymentMethodSystemName}' is not available.\");\n\nawait _paymentService.ProcessPaymentAsync(request);","handlingStrategy":"validation","validationCode":"var pm = await _paymentPluginManager.LoadPluginBySystemNameAsync(request.PaymentMethodSystemName, customer, request.StoreId);\nif (pm is null)\n    throw new InvalidOperationException($\"Payment method '{request.PaymentMethodSystemName}' is not available.\");\n\nawait _paymentService.ProcessPaymentAsync(request);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the selected payment plugin is installed and active for the current store/customer.","Set a valid PaymentMethodSystemName on the request before checkout.","Verify IsPluginActive(systemName, customer, storeId) before submitting payment."],"tags":["payment","plugin","checkout","configuration"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}