nopSolutions/nopCommerce · error · Exception

Selected payment method can't be parsed

Error message

Selected payment method can't be parsed

What it means

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.

Source

Thrown at src/Presentation/Nop.Web/Controllers/CheckoutController.cs:1429

            //payment is required
            var paymentMethodModel = await _checkoutModelFactory.PreparePaymentMethodModelAsync(cart, filterByCountryId);

            if (_paymentSettings.BypassPaymentMethodSelectionIfOnlyOne &&
                paymentMethodModel.PaymentMethods.Count == 1 && !paymentMethodModel.DisplayRewardPoints)
            {
                //if we have only one payment method and reward points are disabled or the current customer doesn't have any reward points
                //so customer doesn't have to choose a payment method

                var selectedPaymentMethodSystemName = paymentMethodModel.PaymentMethods[0].PaymentMethodSystemName;
                await _genericAttributeService.SaveAttributeAsync(customer,
                    NopCustomerDefaults.SelectedPaymentMethodAttribute,
                    selectedPaymentMethodSystemName, store.Id);

                var paymentMethodInst = await _paymentPluginManager
                    .LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);
                if (!_paymentPluginManager.IsPluginActive(paymentMethodInst))
                    throw new Exception("Selected payment method can't be parsed");

                return await OpcLoadStepAfterPaymentMethod(paymentMethodInst, cart);
            }

            //customer have to choose a payment method
            return Json(new
            {
                update_section = new UpdateSectionJsonModel
                {
                    name = "payment-method",
                    html = await RenderPartialViewToStringAsync("OpcPaymentMethods", paymentMethodModel)
                },
                goto_section = "payment_method"
            });
        }

        //payment is not required
        await _genericAttributeService.SaveAttributeAsync<string>(customer,

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Re-enable and properly configure the payment plugin in admin (verify it is active for the current store and customer roles).
  2. Clear the customer's stale SelectedPaymentMethodAttribute so a fresh active method is chosen.
  3. Ensure at least one payment plugin is active and not filtered out for the customer's store/role.
  4. Catch the exception and re-render the payment-method selection with a 'method unavailable' message.

Example fix

// before
var paymentMethodInst = await _paymentPluginManager
    .LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);
if (!_paymentPluginManager.IsPluginActive(paymentMethodInst))
    throw new Exception("Selected payment method can't be parsed");
// after (fall back to manual selection)
var paymentMethodInst = await _paymentPluginManager
    .LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);
if (!_paymentPluginManager.IsPluginActive(paymentMethodInst))
{
    await _genericAttributeService.SaveAttributeAsync(customer, NopCustomerDefaults.SelectedPaymentMethodAttribute, null, store.Id);
    return Json(new { error = 1, message = "Selected payment method is no longer available; please choose another." });
}
Defensive patterns

Strategy: validation

Validate before calling

// Verify the selected payment plugin is active for the store/customer before proceeding.
var inst = await _paymentPluginManager.LoadPluginBySystemNameAsync(selectedPaymentMethodSystemName, customer, store.Id);
if (!_paymentPluginManager.IsPluginActive(inst))
{
    await _genericAttributeService.SaveAttributeAsync(customer, NopCustomerDefaults.SelectedPaymentMethodAttribute, null, store.Id);
    return Json(new { error = 1, message = "Selected payment method is unavailable; please choose another." });
}

Type guard

static bool PaymentPluginActive(IPaymentMethod plugin, IPaymentPluginManager mgr, Customer c, Store s) => plugin is not null && mgr.IsPluginActive(plugin).GetAwaiter().GetResult();

Try / catch

try { /* Opc payment auto-select */ }
catch (Exception ex) when (ex.Message == "Selected payment method can't be parsed")
{ /* re-render payment method selection */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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