{"record":{"id":"a284e2ab42983047","repo":"nopSolutions/nopCommerce","slug":"payment-method-is-not-active","errorCode":null,"errorMessage":"Payment method is not active","messagePattern":"Payment method is not active","errorType":"validation","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Orders/OrderProcessingService.cs","lineNumber":1409,"sourceCode":"    /// <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\n                processPaymentResult = await _paymentService.ProcessPaymentAsync(processPaymentRequest);\r\n        }\r\n        else\r\n            //payment is not required\r","sourceCodeStart":1391,"sourceCodeEnd":1427,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Orders/OrderProcessingService.cs#L1391-L1427","documentation":"Thrown after the payment plugin instance was successfully loaded but _paymentPluginManager.IsPluginActive returns false. nopCommerce refuses to process payment through a plugin the store administrator has disabled, even if the customer's session still references it.","triggerScenarios":"An admin disabled/deactivated the payment method in Configuration > Payment methods while customers had active checkouts using it. Also happens in multi-store configs where the method is active in one store but the order is being placed against a store where it is inactive.","commonSituations":"Maintenance window where payment methods were toggled; A/B testing payment options; store migration leaving the method inactive in the destination store; sandbox/live toggle where the live plugin was disabled.","solutions":["Re-enable the payment method in Admin > Configuration > Payment methods (and limit to the correct stores if multi-store).","Before checkout, filter the customer's selectable payment methods through GetActivePluginsAsync so they cannot pick an inactive one.","Invalidate the customer's stored payment method choice when the active set changes."],"exampleFix":"// before\nprocessPaymentRequest.PaymentMethodSystemName = customer.SelectedPaymentMethodSystemName;\n\n// after\nvar active = await _paymentPluginManager.LoadActivePluginsAsync(customer, storeId);\nif (!active.Any(p => p.PluginDescriptor.SystemName == customer.SelectedPaymentMethodSystemName))\n    return Error(\"Selected payment method is no longer available.\");\nprocessPaymentRequest.PaymentMethodSystemName = customer.SelectedPaymentMethodSystemName;","handlingStrategy":"validation","validationCode":"var active = (await _paymentPluginManager.LoadActivePluginsAsync(customer, storeId))\n    .Select(p => p.PluginDescriptor.SystemName)\n    .ToHashSet();\n\nif (!active.Contains(processPaymentRequest.PaymentMethodSystemName))\n    return Error(\"Selected payment method is not active.\");\n\nawait _orderProcessingService.PlaceOrderAsync(processPaymentRequest, details);","typeGuard":"async Task<bool> IsPaymentMethodActiveAsync(string systemName, Customer customer, int storeId)\n{\n    var pm = await _paymentPluginManager.LoadPluginBySystemNameAsync(systemName, customer, storeId);\n    return pm is not null && _paymentPluginManager.IsPluginActive(pm);\n}","tryCatchPattern":"try\n{\n    await _orderProcessingService.PlaceOrderAsync(processPaymentRequest, details);\n}\ncatch (NopException ex) when (ex.Message == \"Payment method is not active\")\n{\n    // refresh payment options and ask customer to reselect\n    return RedirectToAction(\"PaymentMethod\");\n}","preventionTips":["Filter checkout payment options through LoadActivePluginsAsync so inactive methods never appear selectable.","When an admin disables a payment method, invalidate active checkout sessions that reference it.","In multi-store setups, verify the method is active for the specific StoreId."],"tags":["payment","plugin","configuration","multi-store","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}