> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bevits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscriptions

> Bevits tracks the state of each subscription from the events you already send and summarizes it in customer attributes.

The subscription events you send to `/v1/events` keep, for each customer, the state of each of their subscriptions: status, plan, and next charge. That state becomes customer attributes, ready for segments, the API, and MCP. There is no new field to send and nothing to register first.

## Subscription events

An event is a subscription event when:

* its name starts with `subscription_` (for example `subscription_active`) or is `renewal_upcoming`; and
* `properties.subscription_id` identifies the subscription (text or a number, up to 255 characters).

```json theme={null}
{
  "name": "subscription_active",
  "customer": { "email": "ana@example.com" },
  "properties": {
    "subscription_id": "sub_123",
    "plan_name": "Monthly plan",
    "plan_interval": 1,
    "plan_interval_type": "month",
    "next_charge_at": "2026-12-19"
  },
  "occurred_at": "2026-11-19T10:00:00-03:00"
}
```

## Status

The event name sets the subscription status:

| Event name | Status |
| - | - |
| `subscription_active`, `subscription_activated`, `subscription_reactivated`, `subscription_recovered`, `subscription_resumed`, `subscription_renewed` | Active |
| `subscription_trial_started` | Trialing |
| `subscription_paused` | Paused |
| `subscription_past_due` | Past due |
| `subscription_cancelled`, `subscription_canceled` | Cancelled |
| `subscription_expired` | Expired |
| `subscription_created`, `subscription_started` | `properties.status`, or active |
| Any other `subscription_*` | `properties.status` |

* `properties.status` accepts, case-insensitively: `active`, `trialing` or `trial`, `paused`, `past_due` (or `pastdue`, `past-due`), `cancelled` or `canceled`, `expired`.
* In charge events, such as `subscription_renewed` with `"status": "paid"`, the event name wins: that `status` belongs to the charge.
* `renewal_upcoming`, `subscription_cycle_skipped`, and `subscription_rescheduled` announce an upcoming charge. For a subscription Bevits does not know yet, they record it as active, which also brings in customers who subscribed before the integration. Any event with an explicit status takes precedence over them.

## Subscription details

| Detail | Properties read (the first one present) |
| - | - |
| Next charge | `next_charge_at`, `next_charge_date`, `next_billing_at`, `next_billing_date` |
| Plan | `offer_name`, `plan_name`, `plan` |
| Interval | `plan_interval`, `interval_count` (integer from 1 to 1000) |
| Interval unit | `plan_interval_type`, `interval_unit`, `interval` (for example `month`) |

Each event updates only the details it carries; the others stay as they were.

Accepted date formats:

* `2026-11-30T14:00:00-03:00` or `2026-11-30T17:00:00Z`: that exact instant.
* `2026-11-30`: that day, the same in every Brazilian time zone.
* `2026-11-30 14:00:00` (or with `T`): read in your account's time zone.

## Customer attributes

Bevits adds up all of a customer's subscriptions into three attributes, created the first time they are needed:

| Attribute | Type | Value |
| - | - | - |
| `active_subscriptions` | Number | How many subscriptions are active or trialing. |
| `next_charge_at` | Date | The earliest next charge among the active or trialing subscriptions. |
| `subscription_status` | Text | `active`, `past_due`, `paused`, or `cancelled`, in that order of priority. |

For a segment of active subscribers, filter by `active_subscriptions` greater than `0`. `subscription_status` equal to `past_due` finds customers with no active or trialing subscription and at least one past-due subscription.

## Multiple subscriptions

A customer can have any number of subscriptions, each with its own `subscription_id`. The attributes reflect all of them: the customer stays active while at least one subscription is active, and `next_charge_at` shows the earliest charge.

## Order and retries

The state follows each event's `occurred_at`, not the order in which events arrive. An older event that arrives after a newer one does not move the status back, and sending the same event again changes nothing. Send `occurred_at` whenever you can.

## Loading existing subscriptions

To bring in the subscriptions you already have, send their events with `backfill: true`. The state and attributes are updated as usual, without triggering flows.

## Test mode

Events sent with a test key (`bvt_test_…`) do not change subscription state or customer attributes.

## Next steps

> [card] [Custom events](https://docs.bevits.com/en/api-reference/custom-events.md)
>
> Learn how to send events and link them to customers.

> [card] [Recommended events](https://docs.bevits.com/en/api-reference/recommended-events.md)
>
> See the suggested event names and properties.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.