## GET /api/v2/billing/activity

**List billing activity**

Return billing transactions or account-credit activity. Use `kind=transaction` for invoice payments and refunds; use `kind=credit` for account-credit movements. Transaction `method` is a canonical machine enum (`card`, `swish`, `bankgiro`, `sepa`, `accountCredit`, `alipay`, `paypal`, `invoice`, `other`, or null). Display text such as `Card payment` is carried separately in `methodLabel`; card-backed hosted checkout and wallet flows are normalized to `method: card`.

### Related Endpoints

- `GET /api/v2/billing/cards`: List saved cards
- `POST /api/v2/billing/cards`: Store saved card
- `GET /api/v2/billing/invoices`: List invoices

### Headers

- `Accept`: application/json
- `Authorization`: Bearer YOUR_API_KEY
- Required API scope: `read:billing`

### Parameters

- `kind` (query, string): `transaction` lists payment/refund rows. `credit` lists account-credit ledger rows.
  Allowed values: transaction, credit
- `page` (query, integer) [min: 0]: Zero-based transaction activity page. Used only for `kind=transaction`.

### Request Example

```bash
curl -X GET "https://cloud.hostup.se/api/v2/billing/activity" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```

### Response Schema

- `kind` (string, optional) Example: `transaction`
  Allowed values: transaction
- `entries` (array<object>, optional)
- `entries[].id` (string, required) Example: `txn_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `entries[].description` (string,null, required) Example: `Payment for invoice 202664056`
- `entries[].method` (string,null, required): Canonical payment method enum. Card-backed hosted checkout and wallet flows are all `card`. Example: `card`
  Allowed values: card, accountCredit, swish, bankgiro, sepa, alipay, paypal, invoice, other, 
- `entries[].methodLabel` (string,null, required): Human-readable display label. Use this for UI text instead of branching on upstream gateway names. Example: `Card payment`
- `entries[].amount` (number, required): Signed amount in major currency units. Payments into the account are positive; outgoing/refund rows may be negative. Example: `98.75`
- `entries[].currencyCode` (string, required) Example: `SEK`
- `entries[].createdAt` (string,null, required) Example: `2026-04-28T09:47:47.000Z`
- `entries[].invoiceId` (string,null, required) Example: `inv_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `entries[].invoiceNumber` (string,null, required) Example: `202664056`
- `hasMore` (boolean, optional) Example: `false`

### Responses

#### 200 - Billing activity page.
```json
{
  "kind": "transaction",
  "entries": [
    {
      "id": "txn_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "description": "Payment for invoice 202664056",
      "method": "card",
      "methodLabel": "Card payment",
      "amount": 98.75,
      "currencyCode": "SEK",
      "createdAt": "2026-04-28T09:47:47.000Z",
      "invoiceId": "inv_01hxa3b4c5d6e7f8g9h0j1k2m3",
      "invoiceNumber": "202664056"
    }
  ],
  "hasMore": false
}
```

#### 400 - Invalid `kind` query parameter.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "Use kind=transaction for payments or kind=credit for credit activity.",
  "code": "invalid_request",
  "instance": "/api/v2/billing/activity",
  "errors": [
    {
      "pointer": "/kind",
      "detail": "Use kind=transaction for payments or kind=credit for credit activity.",
      "code": "invalid_activity_kind"
    }
  ]
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - Not found. The resource does not exist or is not owned by the caller.
```json
{
  "type": "https://developer.hostup.se/errors/not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "not_found",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Too many requests. Retry after the limit resets.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```
