{"record":{"id":"b57a9cb026b55cfc","repo":"nopSolutions/nopCommerce","slug":"country-billingcountry-name-is-not-allowed-for","errorCode":null,"errorMessage":"Country '{billingCountry.Name}' is not allowed for billing","messagePattern":"Country '(.+?)' is not allowed for billing","errorType":"validation","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Orders/OrderProcessingService.cs","lineNumber":553,"sourceCode":"    /// Prepare and validate billing address\r\n    /// </summary>\r\n    /// <param name=\"details\">PlaceOrder container</param>\r\n    /// <returns>A task that represents the asynchronous operation</returns>\r\n    /// <exception cref=\"NopException\">Validation problems</exception>\r\n    protected virtual async Task PrepareAndValidateBillingAddressAsync(PlaceOrderContainer details)\r\n    {\r\n        if (details.Customer.BillingAddressId is null)\r\n            throw new NopException(\"Billing address is not provided\");\r\n\r\n        var billingAddress = await _customerService.GetCustomerBillingAddressAsync(details.Customer);\r\n\r\n        if (!CommonHelper.IsValidEmail(billingAddress?.Email))\r\n            throw new NopException(\"Email is not valid\");\r\n\r\n        details.BillingAddress = _addressService.CloneAddress(billingAddress);\r\n\r\n        if (await _countryService.GetCountryByAddressAsync(details.BillingAddress) is Country billingCountry && !billingCountry.AllowsBilling)\r\n            throw new NopException($\"Country '{billingCountry.Name}' is not allowed for billing\");\r\n    }\r\n\r\n    /// <summary>\r\n    /// Prepare and validate customer\r\n    /// </summary>\r\n    /// <param name=\"details\">PlaceOrder container</param>\r\n    /// <param name=\"processPaymentRequest\">payment info holder</param>\r\n    /// <param name=\"currentCurrency\">The working currency</param>\r\n    /// <returns>A task that represents the asynchronous operation</returns>\r\n    /// <exception cref=\"NopException\">Validation problems</exception>\r\n    protected virtual async Task PrepareAndValidateCustomerAsync(PlaceOrderContainer details, ProcessPaymentRequest processPaymentRequest, Currency currentCurrency)\r\n    {\r\n        details.Customer = await _customerService.GetCustomerByIdAsync(processPaymentRequest.CustomerId);\r\n\r\n        if (details.Customer == null)\r\n            throw new ArgumentException(\"Customer is not set\");\r\n\r\n        //check whether customer is guest\r","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Orders/OrderProcessingService.cs#L535-L571","documentation":"Thrown when the country resolved from the billing address has AllowsBilling=false, meaning the store does not accept billing from that country. This is a business/policy restriction enforced at order placement to prevent orders from regions where the store cannot legally or operationally process payments.","triggerScenarios":"The customer's billing address country is marked as 'not allowed for billing' in Configuration > Countries. The country's AllowsBilling flag was set to false (the default for newly created countries) and was never enabled.","commonSituations":"Admin created a new country record but didn't enable AllowsBilling. A country was disabled for billing due to fraud prevention or regulatory reasons, but existing customers still have addresses there. Fresh install where only a subset of countries have AllowsBilling enabled. Tax/compliance policy change that restricted billing countries.","solutions":["In admin (Configuration > Countries), enable 'Allows billing' for the customer's billing country.","If billing is intentionally blocked for that country, inform the customer and suggest using an address in a supported country.","Add checkout-time filtering so billing address country options only show AllowsBilling countries.","After policy changes, audit customer address books for now-restricted countries and notify affected users."],"exampleFix":"// before (admin): country.AllowsBilling = false\n// after: country.AllowsBilling = true;\nawait _countryService.UpdateCountryAsync(country);","handlingStrategy":"validation","validationCode":"// Before PlaceOrder, check if the billing country allows billing\nvar billingAddress = await _customerService.GetCustomerBillingAddressAsync(customer);\nvar country = await _countryService.GetCountryByAddressAsync(billingAddress);\nif (country != null && !country.AllowsBilling)\n{\n    _notificationService.ErrorNotification(\n        $\"We don't accept billing from {country.Name}. Please choose another address.\");\n    return RedirectToRoute(\"CheckoutBillingAddress\");\n}","typeGuard":"async Task<bool> CountryAllowsBillingAsync(ICountryService svc, Address addr)\n{\n    var c = await svc.GetCountryByAddressAsync(addr);\n    return c == null || c.AllowsBilling;\n}","tryCatchPattern":"try\n{\n    var result = await _orderProcessingService.PlaceOrderAsync(processPaymentRequest);\n}\ncatch (NopException ex) when (ex.Message.Contains(\"is not allowed for billing\"))\n{\n    _notificationService.ErrorNotification(ex.Message);\n    return RedirectToRoute(\"CheckoutBillingAddress\");\n}","preventionTips":["Filter the billing address country dropdown to only show countries where AllowsBilling=true.","When disabling billing for a country, notify affected customers with existing addresses there.","Audit country settings after any policy change to ensure intended countries are enabled.","Add a billing-step validation that blocks proceeding if the selected country doesn't allow billing."],"tags":["nopcommerce","country","billing-restriction","business-rule","order-processing"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}