{"record":{"id":"6f9eadfd51934caa","repo":"nopSolutions/nopCommerce","slug":"recurring-payment-is-not-active","errorCode":null,"errorMessage":"Recurring payment is not active","messagePattern":"Recurring payment is not active","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"warning","filePath":"src/Libraries/Nop.Services/Orders/OrderProcessingService.cs","lineNumber":1896,"sourceCode":"    }\r\n\r\n    /// <summary>\r\n    /// Process next recurring payment\r\n    /// </summary>\r\n    /// <param name=\"recurringPayment\">Recurring payment</param>\r\n    /// <param name=\"paymentResult\">Process payment result (info about last payment for automatic recurring payments)</param>\r\n    /// <returns>\r\n    /// A task that represents the asynchronous operation\r\n    /// The task result contains the collection of errors\r\n    /// </returns>\r\n    public virtual async Task<IEnumerable<string>> ProcessNextRecurringPaymentAsync(RecurringPayment recurringPayment, ProcessPaymentResult paymentResult = null)\r\n    {\r\n        ArgumentNullException.ThrowIfNull(recurringPayment);\r\n\r\n        try\r\n        {\r\n            if (!recurringPayment.IsActive)\r\n                throw new NopException(\"Recurring payment is not active\");\r\n\r\n            var initialOrder = await _orderService.GetOrderByIdAsync(recurringPayment.InitialOrderId)\r\n                               ?? throw new NopException(\"Initial order could not be loaded\");\r\n\r\n            var customer = await _customerService.GetCustomerByIdAsync(initialOrder.CustomerId)\r\n                           ?? throw new NopException(\"Customer could not be loaded\");\r\n\r\n            if (await GetNextPaymentDateAsync(recurringPayment) is null)\r\n                throw new NopException(\"Next payment date could not be calculated\");\r\n\r\n            //payment info\r\n            var processPaymentRequest = new ProcessPaymentRequest\r\n            {\r\n                StoreId = initialOrder.StoreId,\r\n                CustomerId = customer.Id,\r\n                OrderGuid = Guid.NewGuid(),\r\n                InitialOrder = initialOrder,\r\n                RecurringCycleLength = recurringPayment.CycleLength,\r","sourceCodeStart":1878,"sourceCodeEnd":1914,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Orders/OrderProcessingService.cs#L1878-L1914","documentation":"Thrown by ProcessNextRecurringPaymentAsync when recurringPayment.IsActive is false. nopCommerce will not bill the next cycle of a recurring payment the administrator has stopped (deactivated) - this short-circuits before computing the next payment date or charging the customer.","triggerScenarios":"A scheduled task (RecurringPaymentTask) or admin action calls ProcessNextRecurringPaymentAsync on a recurring payment whose IsActive flag was set to false (cancelled, paused, or completed all cycles).","commonSituations":"Customer cancelled the subscription; admin manually deactivated it; all cycles were already processed; race between the recurring task firing and an admin cancellation.","solutions":["Confirm the recurring payment is meant to be active - if not, this exception is expected and should be caught/ignored by the recurring task.","If it should be active, set recurringPayment.IsActive = true via _orderService.UpdateRecurringPaymentAsync after verifying cycle counts.","Guard the scheduled task to skip inactive recurring payments before calling ProcessNextRecurringPaymentAsync."],"exampleFix":"// before\nvar errors = await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);\n\n// after\nif (!recurringPayment.IsActive)\n    return; // subscription cancelled/paused - skip\nvar errors = await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);","handlingStrategy":"validation","validationCode":"if (!recurringPayment.IsActive)\n{\n    // expected for cancelled/completed subscriptions - skip silently\n    return Array.Empty<string>();\n}\n\nreturn await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);","typeGuard":"bool ShouldProcessRecurring(RecurringPayment rp)\n    => rp is not null && rp.IsActive && rp.CyclesRemaining > 0;","tryCatchPattern":"try\n{\n    var errors = await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);\n}\ncatch (NopException ex) when (ex.Message == \"Recurring payment is not active\")\n{\n    // benign: subscription was cancelled between scheduling and execution\n    _logger.LogInformation(\"Skipping inactive recurring payment {Id}\", recurringPayment.Id);\n}","preventionTips":["In the recurring-payment scheduled task, filter to IsActive==true before calling ProcessNextRecurringPaymentAsync.","Set IsActive=false promptly when a subscription is cancelled or completes its cycles.","Treat this specific exception as benign in task logging to avoid false alarms."],"tags":["recurring","subscription","scheduled-task","lifecycle","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}