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

# subscriptions

> What a customer pays, from a billing system that is not connected.

For Paddle, Chargebee or your own billing. A Stripe account connected to the CRM sends its subscriptions itself. Sending one moves the customer's lifecycle the same way a Stripe subscription does.

## subscriptions.upsert

```ts theme={null}
const [subscription, error] = await crm.subscriptions.upsert({
  partyId: contact.id,
  externalId: sub.id,
  description: "Pro plan",
  payingPerMonth: 4900,
  currency: "USD",
  startedAt: sub.startedAt,
});
```

**partyId** `string` *required*

The CRM's id for the customer, from [`contacts.upsert`](https://docs.revenuebee.ai/sdk/upsert-contact) or
[`contacts.resolve`](https://docs.revenuebee.ai/sdk/resolve-contact).

**externalId** `string` *required*

Your billing system's id. Sending the same one again updates it.

**description** `string` *required*

What it is called, such as the plan name.

**payingPerMonth** `number` *required*

Minor units a month: `4900` is USD 49.00. A yearly plan is its price divided by twelve.

**currency** `string` *required*

Three letters, such as `USD`.

**startedAt** `string`

ISO 8601.

**endedAt** `string`

When they stopped paying it. Leave it out while they pay.

**trialEndsAt** `string`

Set while it is on trial. Leaving it out later is the trial converting.

Returns the subscription, with the CRM's `id`.

## subscriptions.delete

```ts theme={null}
await crm.subscriptions.delete({ subscriptionId: subscription.id });
```

**subscriptionId** `string` *required*

The CRM's `id`, from `subscriptions.upsert`.

One from a connected Stripe account cannot be deleted here: it belongs to Stripe.


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