nopSolutions/nopCommerce · warning · NopException

Recurring payment is not active

Error message

Recurring payment is not active

What it means

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.

Source

Thrown at src/Libraries/Nop.Services/Orders/OrderProcessingService.cs:1896

    }

    /// <summary>
    /// Process next recurring payment
    /// </summary>
    /// <param name="recurringPayment">Recurring payment</param>
    /// <param name="paymentResult">Process payment result (info about last payment for automatic recurring payments)</param>
    /// <returns>
    /// A task that represents the asynchronous operation
    /// The task result contains the collection of errors
    /// </returns>
    public virtual async Task<IEnumerable<string>> ProcessNextRecurringPaymentAsync(RecurringPayment recurringPayment, ProcessPaymentResult paymentResult = null)
    {
        ArgumentNullException.ThrowIfNull(recurringPayment);

        try
        {
            if (!recurringPayment.IsActive)
                throw new NopException("Recurring payment is not active");

            var initialOrder = await _orderService.GetOrderByIdAsync(recurringPayment.InitialOrderId)
                               ?? throw new NopException("Initial order could not be loaded");

            var customer = await _customerService.GetCustomerByIdAsync(initialOrder.CustomerId)
                           ?? throw new NopException("Customer could not be loaded");

            if (await GetNextPaymentDateAsync(recurringPayment) is null)
                throw new NopException("Next payment date could not be calculated");

            //payment info
            var processPaymentRequest = new ProcessPaymentRequest
            {
                StoreId = initialOrder.StoreId,
                CustomerId = customer.Id,
                OrderGuid = Guid.NewGuid(),
                InitialOrder = initialOrder,
                RecurringCycleLength = recurringPayment.CycleLength,

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Confirm the recurring payment is meant to be active - if not, this exception is expected and should be caught/ignored by the recurring task.
  2. If it should be active, set recurringPayment.IsActive = true via _orderService.UpdateRecurringPaymentAsync after verifying cycle counts.
  3. Guard the scheduled task to skip inactive recurring payments before calling ProcessNextRecurringPaymentAsync.

Example fix

// before
var errors = await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);

// after
if (!recurringPayment.IsActive)
    return; // subscription cancelled/paused - skip
var errors = await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);
Defensive patterns

Strategy: validation

Validate before calling

if (!recurringPayment.IsActive)
{
    // expected for cancelled/completed subscriptions - skip silently
    return Array.Empty<string>();
}

return await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);

Type guard

bool ShouldProcessRecurring(RecurringPayment rp)
    => rp is not null && rp.IsActive && rp.CyclesRemaining > 0;

Try / catch

try
{
    var errors = await _orderProcessingService.ProcessNextRecurringPaymentAsync(recurringPayment);
}
catch (NopException ex) when (ex.Message == "Recurring payment is not active")
{
    // benign: subscription was cancelled between scheduling and execution
    _logger.LogInformation("Skipping inactive recurring payment {Id}", recurringPayment.Id);
}

Prevention

When it happens

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

Common situations: Customer cancelled the subscription; admin manually deactivated it; all cycles were already processed; race between the recurring task firing and an admin cancellation.

Related errors


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