{"record":{"id":"d6194226b3aa50cc","repo":"nopSolutions/nopCommerce","slug":"selected-payment-method-can-t-be-parsed","errorCode":null,"errorMessage":"Selected payment method can't be parsed","messagePattern":"Selected payment method can't be parsed","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Controllers/CheckoutController.cs","lineNumber":1429,"sourceCode":"\r\n            //payment is required\r\n            var paymentMethodModel = await _checkoutModelFactory.PreparePaymentMethodModelAsync(cart, filterByCountryId);\r\n\r\n            if (_paymentSettings.BypassPaymentMethodSelectionIfOnlyOne &&\r\n                paymentMethodModel.PaymentMethods.Count == 1 && !paymentMethodModel.DisplayRewardPoints)\r\n            {\r\n                //if we have only one payment method and reward points are disabled or the current customer doesn't have any reward points\r\n                //so customer doesn't have to choose a payment method\r\n\r\n                var selectedPaymentMethodSystemName = paymentMethodModel.PaymentMethods[0].PaymentMethodSystemName;\r\n                await _genericAttributeService.SaveAttributeAsync(customer,\r\n                    NopCustomerDefaults.SelectedPaymentMethodAttribute,\r\n                    selectedPaymentMethodSystemName, store.Id);\r\n\r\n                var paymentMethodInst = await _paymentPluginManager\r\n                    .LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);\r\n                if (!_paymentPluginManager.IsPluginActive(paymentMethodInst))\r\n                    throw new Exception(\"Selected payment method can't be parsed\");\r\n\r\n                return await OpcLoadStepAfterPaymentMethod(paymentMethodInst, cart);\r\n            }\r\n\r\n            //customer have to choose a payment method\r\n            return Json(new\r\n            {\r\n                update_section = new UpdateSectionJsonModel\r\n                {\r\n                    name = \"payment-method\",\r\n                    html = await RenderPartialViewToStringAsync(\"OpcPaymentMethods\", paymentMethodModel)\r\n                },\r\n                goto_section = \"payment_method\"\r\n            });\r\n        }\r\n\r\n        //payment is not required\r\n        await _genericAttributeService.SaveAttributeAsync<string>(customer,\r","sourceCodeStart":1411,"sourceCodeEnd":1447,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Controllers/CheckoutController.cs#L1411-L1447","documentation":"Thrown in the one-page checkout payment step when exactly one payment method is auto-selected but the resolved plugin cannot be activated. LoadPluginBySystemNameAsync returns the plugin instance and IsPluginActive returns false (plugin disabled, uninstalled, or restricted by store/customer filter), so checkout aborts with 'Selected payment method can't be parsed'. It means the stored/selected PaymentMethodSystemName no longer maps to an active plugin.","triggerScenarios":"The auto-selected payment method's system name resolves to a plugin that IsPluginActive reports as inactive. Triggered by disabling/uninstalling the only enabled payment plugin after the customer reached payment, by store- or customer-level filter rules excluding it, or by a stale SelectedPaymentMethodAttribute saved earlier.","commonSituations":"Admin disabled the payment plugin while customers were checking out; plugin license expired or configuration incomplete so it self-deactivates; limited-to-store filter excludes the current store; limitedToCustomerRoles filter excludes the customer; leftover SelectedPaymentMethodAttribute from a previous session pointing at a now-inactive method.","solutions":["Re-enable and properly configure the payment plugin in admin (verify it is active for the current store and customer roles).","Clear the customer's stale SelectedPaymentMethodAttribute so a fresh active method is chosen.","Ensure at least one payment plugin is active and not filtered out for the customer's store/role.","Catch the exception and re-render the payment-method selection with a 'method unavailable' message."],"exampleFix":"// before\nvar paymentMethodInst = await _paymentPluginManager\n    .LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);\nif (!_paymentPluginManager.IsPluginActive(paymentMethodInst))\n    throw new Exception(\"Selected payment method can't be parsed\");\n// after (fall back to manual selection)\nvar paymentMethodInst = await _paymentPluginManager\n    .LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);\nif (!_paymentPluginManager.IsPluginActive(paymentMethodInst))\n{\n    await _genericAttributeService.SaveAttributeAsync(customer, NopCustomerDefaults.SelectedPaymentMethodAttribute, null, store.Id);\n    return Json(new { error = 1, message = \"Selected payment method is no longer available; please choose another.\" });\n}","handlingStrategy":"validation","validationCode":"// Verify the selected payment plugin is active for the store/customer before proceeding.\nvar inst = await _paymentPluginManager.LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);\nif (!_paymentPluginManager.IsPluginActive(inst))\n{\n    await _genericAttributeService.SaveAttributeAsync(customer, NopCustomerDefaults.SelectedPaymentMethodAttribute, null, store.Id);\n    return Json(new { error = 1, message = \"Selected payment method is unavailable; please choose another.\" });\n}","typeGuard":"static bool PaymentPluginActive(IPaymentMethod plugin, IPaymentPluginManager mgr, Customer c, Store s) => plugin is not null && mgr.IsPluginActive(plugin).GetAwaiter().GetResult();","tryCatchPattern":"try { /* Opc payment auto-select */ }\ncatch (Exception ex) when (ex.Message == \"Selected payment method can't be parsed\")\n{ /* re-render payment method selection */ }","preventionTips":["Keep at least one payment plugin active and not filtered out by store/customer role.","Clear stale SelectedPaymentMethodAttribute when plugins are disabled/uninstalled.","Verify plugin store/role filters include the current customer."],"tags":["nopcommerce","checkout","payment","plugin","inactive-plugin","opc"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}