# client.partner_billing

> The partner_billing methods of the morevoice Python SDK: Partner accounts: usage per client organisation at wholesale and at your retail prices, and your wholesale invoices.

Partner accounts: usage per client organisation at wholesale and at your retail prices, and your wholesale invoices. These methods are on `client.partner_billing`, where `client` is a `MoreVoice` client (see [the Python SDK](https://docs.morevoice.ai/sdk/python/#connect)). On `AsyncMoreVoice` the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.

## `invoices.list()`

**List wholesale invoices.** Your partner account's issued wholesale invoices, newest period first, with each client organisation's subtotal. Drafts (the month in progress) are not listed. Test keys get an empty list.

```python
# client.partner_billing.invoices
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, status: _m.PartnerBillingInvoicesListStatus | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.PartnerInvoice]
```

`client.partner_billing.invoices.list()` · `await async_client.partner_billing.invoices.list()` · `GET /partner/invoices` · [API reference](https://docs.morevoice.ai/api/operations/partner_billing_invoices_list/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | no | How many objects to return, 1–100 (default 20). |
| `starting_after` | `string` | no | A cursor (`next_cursor`) or object ID: return the objects after it (older). |
| `ending_before` | `string` | no | A cursor or object ID: return the objects before it (newer). |
| `status` | `"open" \| "paid" \| "failed" \| "void" \| "uncollectible"` | no | Only invoices in this status. |

### Returns

A page of results (`PartnerInvoiceList`): `data`, `has_more` and `next_cursor`.

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

for invoice in client.partner_billing.invoices.list():
    print(invoice)
```

## `invoices.retrieve()`

**Retrieve a wholesale invoice.** One issued wholesale invoice with its lines grouped per client organisation, then your programme fees.

```python
# client.partner_billing.invoices
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.PartnerInvoice
```

`client.partner_billing.invoices.retrieve()` · `await async_client.partner_billing.invoices.retrieve()` · `GET /partner/invoices/{id}` · [API reference](https://docs.morevoice.ai/api/operations/partner_billing_invoices_retrieve/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `str` | yes | A invoice ID (`inv_…`). |

### Returns

`PartnerInvoice`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | A invoice ID (prefix `inv_`). |
| `object` | `"partner_invoice"` | Always `partner_invoice`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `number` | `string \| null` | — |
| `status` | `"open" \| "paid" \| "failed" \| "void" \| "uncollectible"` | — |
| `currency` | `"ILS" \| "USD" \| "EUR"` | — |
| `period_start` | `string` | An ISO-8601 timestamp in UTC. |
| `period_end` | `string` | An ISO-8601 timestamp in UTC. |
| `subtotal` | `Money` | An amount of money in minor units. |
| `tax` | `Money` | An amount of money in minor units. |
| `total` | `Money` | An amount of money in minor units. |
| `issued` | `string \| null` | — |
| `due` | `string \| null` | — |
| `paid` | `string \| null` | — |
| `organizations` | `object[]` | One group per client organisation billed on this invoice. |
| `programme` | `object \| null` | Your programme fee, client organisations beyond those included, and the minimum-commitment true-up. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

partner_invoice = client.partner_billing.invoices.retrieve("inv_7Hk2Lm9Qp")
print(partner_invoice)
```

## `usage.retrieve()`

**Retrieve usage per client organization.** Usage of each of your client organisations for a date range, and for your wholesale clients its price at wholesale (what you pay) and at your retail prices (what you charge). Closed months use their invoice's figures; other months are estimates (`provisional`). Test keys get an empty report.

```python
# client.partner_billing.usage
def retrieve(self, *, from_: str | Unset = UNSET, to: str | Unset = UNSET, group: _m.PartnerBillingUsageRetrieveGroup | Unset = "client", more_voice_version: str | Unset = UNSET) -> _m.PartnerUsageReport
```

`client.partner_billing.usage.retrieve()` · `await async_client.partner_billing.usage.retrieve()` · `GET /partner/usage` · [API reference](https://docs.morevoice.ai/api/operations/partner_billing_usage_retrieve/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | `string` | no | The first day (YYYY-MM-DD, your time zone). Default: the first day of the current month. |
| `to` | `string` | no | The last day, inclusive (up to 400 days after `from`). Default: today. |
| `group` | `"client" \| "kind"` | no | `client` (default): `data` has one row per client organisation; `kind`: one row per usage kind across your clients. |

### Returns

`PartnerUsageReport`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"partner_usage_report"` | Always `partner_usage_report`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `from` | `string` | — |
| `to` | `string` | — |
| `timezone` | `string` | Your time zone: the days and months are its local calendar. |
| `currency` | `"ILS" \| "USD" \| "EUR"` | — |
| `group` | `"client" \| "kind"` | — |
| `provisional` | `boolean` | Some amounts are estimates (a month not invoiced yet, or cut by the range). Closed months with an invoice use the invoice's figures. |
| `data` | `object[]` | — |
| `total` | `object` | The whole range, wholesale clients; your programme fees are on your invoice, not here. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

partner_usage_report = client.partner_billing.usage.retrieve()
print(partner_usage_report)
```
