# Sandbox recurring order retention

The sandbox environment is for testing.
A recurring order in the sandbox environment is canceled 90 days after it is created, unless it is kept or the organization is excluded from the policy.
A recurring order is an order that renews, also called a subscription.

Recurring orders in the live environment are never canceled by this policy.

## When the policy applies

The policy applies from December 8, 2026, 09:00 UTC.
From that time, every sandbox recurring order that is older than 90 days is due for cancellation.
The cancellations are spread over the following days, oldest orders first.

A recurring order created after that date is canceled 90 days after it is created.
The 90 days count from the creation of the order, not from its last renewal.
A reactivation does not restart the 90 days.
A reactivated order that is already older than 90 days is canceled on the first run after one day, unless it is kept.
To keep it, reactivate the order, then press **Keep active** on the order within that day.

## What happens when a sandbox recurring order is canceled

- The order status changes to `canceled`, and then to `churned`.
  The `canceledBy` value is `rebilly`, and the `cancelCategory` value is `sandbox-retention`.
- The `subscription-canceled` and `subscription-churned` webhooks are sent, as with any cancellation.
  For more information, see [Webhooks](/docs/dev-docs/webhooks-configuration).
- No email is sent for this cancellation, including from automations that send an email on the `subscription-canceled` event.
- No further renewal invoices are issued for the order, and its upcoming invoice is voided.
- A postpaid or metered order gets a cancellation invoice, as with any cancellation.
  No email is sent for that invoice.
- Issued invoices, transactions, and the customer are not changed.
- A paused recurring order is canceled on the same schedule, and the cancellation ends the pause.
- An active or paused trial-only recurring order, one that ends after its trial period, has its trial ended instead.
  Its status changes to `trial-ended`.
  A trial that ends before the cancellation date is not affected: the order is no longer active when the date comes.
- A pending order of any type that is older than 90 days is abandoned, and the `order-abandoned` webhook is sent.
  This includes pending one-time orders.
  If a rule sends an email on the `order-abandoned` event, that email is sent.

One-time orders that are not pending, customers, payment instruments, products, and plans are not affected.

Churn and retention reports in the sandbox include these cancellations.
Use reports in the live environment for business decisions.

## View when a sandbox recurring order is canceled

Use this process to view the date on which a sandbox recurring order is canceled.

1. [Log in](https://app-sandbox.rebilly.com/login) to Rebilly.
2. In the left navigation bar, press **Data tables**, then press **Billing**.
3. Press **Active orders**.
4. In the **ID** column, press an order.
5. At the top of the page, view the cancellation date.

## Keep a sandbox recurring order active

Use this process to exclude a sandbox recurring order from automatic cancellation.
An organization can keep up to 50 recurring orders at a time, and a keep beyond that limit is refused.
Only an order that can still bill can be kept.
A kept order that churns or is abandoned is no longer kept.
Keep a recurring order when a person must experience billing in real time, for example to check that a customer gets enough notice to update a payment method.

1. [Log in](https://app-sandbox.rebilly.com/login) to Rebilly.
2. In the left navigation bar, press **Data tables**, then press **Billing**.
3. Press **Active orders**.
4. In the **ID** column, press an order.
5. At the top of the page, press **Keep active**.

To return a kept recurring order to the automatic schedule, see [Revert a kept recurring order to automatic cancellation](#revert-a-kept-recurring-order-to-automatic-cancellation).

## Revert a kept recurring order to automatic cancellation

Use this process to return a kept sandbox recurring order to the automatic cancellation schedule.
If its cancellation date has already passed, it is canceled within one day.

1. [Log in](https://app-sandbox.rebilly.com/login) to Rebilly.
2. In the left navigation bar, press **Data tables**, then press **Billing**.
3. Press **Active orders**.
4. In the **ID** column, press a kept order.
5. At the top of the page, press **Revert**.

## Keep a sandbox recurring order active using the API

In the sandbox environment, a recurring order includes a `sandboxRetention` object.
The `autoCancelTime` value is the date and time when the order is canceled.
This value is `null` when the organization is excluded from the policy, and for an order that can no longer bill.
To keep the order, set `excluded` to `true` when you create or update the order.
Use [Upsert an order](/catalog/all/orders/putorder) for an order, or [Upsert an order (legacy)](/catalog/all/orders-(legacy)/putsubscription) for a legacy order.

```text
PUT https://api-sandbox.rebilly.com/organizations/{organizationId}/orders/{id}

{
  ...,
  "sandboxRetention": {
    "excluded": true
  }
}
```

The response includes the updated object.

```text
{
  "id": "ord_0YV7DES3WPC5J8JD8QTVNZBZNJ",
  "status": "active",
  "sandboxRetention": {
    "autoCancelTime": "2027-03-08T09:00:00+00:00",
    "excluded": true
  }
}
```

If the request body does not include `sandboxRetention`, the value is not updated.
A request that exceeds the limit of 50 kept recurring orders is rejected with a validation error.

In the live environment, orders do not include `sandboxRetention`.
A request that sets it to a value in the live environment is rejected with a validation error.

## Exclude your organization from the policy

To keep more than 50 sandbox recurring orders billing in real time, [contact Rebilly support](/docs/request-support) and ask to exclude your organization from sandbox recurring order retention.
The exclusion applies to every recurring order in the organization in the sandbox environment.
When the exclusion is active, the order page displays no cancellation date.
An order that was kept before the exclusion still displays **Revert**.

## Related topics

- [Orders](/docs/dev-docs/orders)
- [Set up your environment](/docs/dev-docs/set-up-environment)
- [Test transactions in the sandbox](/docs/tutorials/test-transactions-sandbox)
- [Environments](/docs/tutorials/environments)
- [Manage subscriptions](/docs/data-tables/manage-subscriptions)
