> This is a page from the ElevenLabs documentation. For an index of the documentation, fetch https://elevenlabs.io/docs/llms.txt.

# सब्सक्रिप्शन और बिलिंग

हर ग्राहक वर्कस्पेस के पास आपके बेचे जाने वाले टियर का एक सब्सक्रिप्शन हो सकता है। आपका रीसेलर कार्ड हर वर्कस्पेस के इनवॉइस का भुगतान करता है। वर्कस्पेस का मौजूदा सब्सक्रिप्शन `workspaces.list` के `subscription` फ़ील्ड में `has_payment_issue` के साथ मिलता है।

## प्लान असाइन करें

जिस वर्कस्पेस के पास अभी कोई प्लान नहीं है, उसे सब्सक्राइब करें। `billing_period` `monthly_period` (डिफ़ॉल्ट) या `annual_period` होता है।

```python
from elevenlabs import ElevenLabs

elevenlabs = ElevenLabs()

elevenlabs.reception.subscriptions.assign(
    "8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7",
    tier_id="smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0",
    billing_period="annual_period",
    idempotency_key="assign-8f1c2a7e-2026-11-03",
)
```

```typescript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const elevenlabs = new ElevenLabsClient();

await elevenlabs.reception.subscriptions.assign("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7", {
  tierId: "smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0",
  billingPeriod: "annual_period",
  idempotencyKey: "assign-8f1c2a7e-2026-11-03",
});
```

```bash
curl -X POST "https://api.elevenlabs.io/v1/reception/reseller/workspaces/8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7/subscription" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "tier_id": "smbtier_4401k8r2c6hxe9tq3vz7m5wd1nb0", "billing_period": "annual_period", "idempotency_key": "assign-8f1c2a7e-2026-11-03" }'
```

हर असाइनमेंट या बदलाव पर आपके द्वारा जनरेट की गई `idempotency_key` भेजें। अगर किसी अनुरोध का टाइम आउट हो जाए, तो उसी कुंजी के साथ दोबारा कोशिश करने पर वर्कस्पेस दो बार सब्सक्राइब या चार्ज नहीं होगा।

`has_payment_issue` के `true` होने पर प्लान असाइन या बदलने से मना कर दिया जाता है। दोबारा कोशिश करने से पहले ग्राहक को बकाया इनवॉइस दिखाएं या उसके `pay_url` से भुगतान करें।

## प्लान बदलें

`subscriptions.change` का बॉडी `assign` जैसा ही होता है।

* अपग्रेड तुरंत लागू होता है।
* डाउनग्रेड या उसी स्तर के टियर पर बदलाव बिलिंग अवधि के आखिर में लागू होता है। तब तक सब्सक्रिप्शन में नया टियर `pending_downgrade_tier` में और तारीख `pending_downgrade_at_unix` में दिखती है।

वर्कस्पेस को उसके मौजूदा टियर पर रखने के लिए `subscriptions.cancel_pending_downgrade` से शेड्यूल किया गया डाउनग्रेड हटाएं।

```python
elevenlabs.reception.subscriptions.change(
    "8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7",
    tier_id="smbtier_4401k8r2d3pfw8ys6bq2n9ja7kc5",
)

elevenlabs.reception.subscriptions.cancel_pending_downgrade("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7")
```

```typescript
await elevenlabs.reception.subscriptions.change("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7", {
  tierId: "smbtier_4401k8r2d3pfw8ys6bq2n9ja7kc5",
});

await elevenlabs.reception.subscriptions.cancelPendingDowngrade("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7");
```

```bash
curl -X PATCH "https://api.elevenlabs.io/v1/reception/reseller/workspaces/8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7/subscription" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "tier_id": "smbtier_4401k8r2d3pfw8ys6bq2n9ja7kc5" }'

curl -X POST "https://api.elevenlabs.io/v1/reception/reseller/workspaces/8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7/subscription/cancel-downgrade" \
  -H "xi-api-key: $ELEVENLABS_API_KEY"
```

डाउनग्रेड लागू होने पर नए प्लान की सीमा से अधिक रिसेप्शनिस्ट और फ़ोन नंबर निष्क्रिय हो जाते हैं और टीम साइज़ से अधिक टीम मेंबर्स सस्पेंड हो जाते हैं।

## प्लान खत्म करें

`subscriptions.unassign` मौजूदा बिलिंग अवधि के आखिर में सब्सक्रिप्शन खत्म करता है। तब तक `cancel_at_unix` में खत्म होने का समय दिखता है और `subscriptions.restore` कैंसलेशन को रद्द कर देता है, ताकि प्लान सामान्य रूप से रिन्यू हो।

```python
elevenlabs.reception.subscriptions.unassign("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7")

elevenlabs.reception.subscriptions.restore("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7")
```

```typescript
await elevenlabs.reception.subscriptions.unassign("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7");

await elevenlabs.reception.subscriptions.restore("8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7");
```

```bash
curl -X DELETE "https://api.elevenlabs.io/v1/reception/reseller/workspaces/8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7/subscription" \
  -H "xi-api-key: $ELEVENLABS_API_KEY"

curl -X POST "https://api.elevenlabs.io/v1/reception/reseller/workspaces/8f1c2a7e4b9d4e6fa3c5b2d1e0f9a8b7/subscription/restore" \
  -H "xi-api-key: $ELEVENLABS_API_KEY"
```

## इनवॉइस

आपके कार्ड पर होने वाला हर शुल्क एक वर्कस्पेस के इनवॉइस का भुगतान करता है। `billing.list_invoices` इन्हें सबसे नए से शुरू करके, एक बार में एक पेज में लौटाता है। इनवॉइस का `status` इनमें से एक होता है:

| स्टेटस | मतलब                                                                                        |
| ------ | ------------------------------------------------------------------------------------------- |
| `paid` | कार्ड पर शुल्क लिया गया।                                                                    |
| `open` | कार्ड पर अभी भी दोबारा शुल्क लेने की कोशिश हो रही है। `pay_url` पेमेंट पेज से लिंक करता है। |
| `void` | दोबारा कोशिशें खत्म हो गईं और वर्कस्पेस का प्लान खत्म कर दिया गया।                          |

`billing.get_invoice` इनवॉइस की `lines` जोड़ता है। नकारात्मक `amount_cents` वाली लाइन प्रोरेशन क्रेडिट होती है और सभी लाइनों का कुल हमेशा शुल्क के बराबर होता है।

```python
page = elevenlabs.reception.billing.list_invoices(page_size=25)
for invoice in page.invoices:
    print(invoice.workspace_name, invoice.status, invoice.amount_cents / 100, invoice.currency)

detail = elevenlabs.reception.billing.get_invoice(page.invoices[0].invoice_id)
for line in detail.lines:
    print(line.kind, line.description, line.amount_cents)
```

```typescript
const page = await elevenlabs.reception.billing.listInvoices({ pageSize: 25 });
for (const invoice of page.invoices) {
  console.log(invoice.workspaceName, invoice.status, invoice.amountCents / 100, invoice.currency);
}

const detail = await elevenlabs.reception.billing.getInvoice(page.invoices[0].invoiceId);
for (const line of detail.lines) {
  console.log(line.kind, line.description, line.amountCents);
}
```

```bash
curl "https://api.elevenlabs.io/v1/reception/reseller/billing/invoices?page_size=25" \
  -H "xi-api-key: $ELEVENLABS_API_KEY"
```

## आगामी पेमेंट्स

`billing.list_upcoming_payments` हर वर्कस्पेस के अगले रिन्यूअल का अनुमान देता है, सबसे पहले होने वाले रिन्यूअल से शुरू करके। `plan_usd` वह प्लान है जिसका शुल्क रिन्यूअल पर पहले लिया जाता है; डाउनग्रेड शेड्यूल होने पर यह डाउनग्रेड किए गए टियर की कीमत होती है। `overage_so_far_usd` इस अवधि में अब तक शामिल मिनट्स से अधिक का उपयोग है। इसका शुल्क रिन्यूअल पर लिया जाता है और तब तक बढ़ता रहता है।

```python
upcoming = elevenlabs.reception.billing.list_upcoming_payments()
for payment in upcoming.payments:
    print(
        payment.workspace_name,
        payment.subscription.billing_period_end_unix,
        payment.plan_usd + payment.overage_so_far_usd,
    )
```

```typescript
const upcoming = await elevenlabs.reception.billing.listUpcomingPayments();
for (const payment of upcoming.payments) {
  console.log(
    payment.workspaceName,
    payment.subscription.billingPeriodEndUnix,
    payment.planUsd + payment.overageSoFarUsd
  );
}
```

```bash
curl "https://api.elevenlabs.io/v1/reception/reseller/billing/upcoming" \
  -H "xi-api-key: $ELEVENLABS_API_KEY"
```