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

# Subscriptions

> Set up recurring billing with Khaime.

# Subscriptions

Khaime handles the full subscription lifecycle: creation, billing, renewals, dunning, and cancellation.

## Creating a Subscription

Add `subscription_frequency_key` to your charge or session request:

```bash theme={null}
curl -X POST https://api.khaime.com/api/v1/partner/payments/charge \
  -H "X-API-Key: pk_sandbox_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 4999,
    "currency": "USD",
    "subscription_frequency_key": "monthly",
    "customer": {
      "email": "subscriber@example.com",
      "country": "US"
    }
  }'
```

## Frequencies

| Key        | Billing Cycle  |
| ---------- | -------------- |
| `daily`    | Every day      |
| `weekly`   | Every 7 days   |
| `biweekly` | Every 14 days  |
| `monthly`  | Every month    |
| `3_months` | Every 3 months |
| `6_months` | Every 6 months |
| `yearly`   | Every year     |

## Managing Subscriptions

### List subscriptions

```bash theme={null}
GET /subscriptions?status=active&limit=20
```

### Get details

```bash theme={null}
GET /subscriptions/{subscription_id}
```

### Cancel

```bash theme={null}
PATCH /subscriptions/{subscription_id}/cancel
```

## Webhook Events

* `subscription.created` — First payment succeeded, subscription active
* `subscription.renewed` — Recurring payment succeeded
* `subscription.cancelled` — Subscription cancelled
