### Credit a subscriber wallet

`POST /api/v1/users/{id}/deposit`

Moves money into the subscriber's wallet and writes the matching ledger line. Idempotent on request_id through a unique constraint on the ledger itself, so the charge and the record of it cannot disagree.

- Authentication: manager session (JWT) or API token
- Permission: `prm_users_deposit` (Deposit to user wallet)
- Risk: danger
- Rate limit bucket: `t_mutate`
- Idempotent on `request_id`: retrying with the same id returns the original result

#### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Subscriber id. |
| `amount` | body | number | yes | Major units, a bare JSON number. 150.50, not "150.50" and not 15050. |
| `request_id` | body | string | yes | Idempotency key. |
| `issue_invoice` | body | boolean | no | Also record an invoice document. Skipped on a replay. |

#### Request

```json
{
  "amount": 250.00,
  "request_id": "b41cf0a2-33de-4b57-8a7a-9e3c5d1f0c77"
}
```

#### Response — 200 OK

```json
{
  "data": {
    "journal_id": 90412,
    "balance": 250.00,
    "debt": 0.00,
    "replay": false
  }
}
```

#### Errors

| Code | Status | When |
| --- | --- | --- |
| `ERR_VALIDATION` | 400 | request_id missing, too long or reserved |
| `ERR_CONFLICT` | 409 | the request_id is already held by a different ledger line |

#### Note

replay true means this exact request already happened and nothing moved this time. It is a success, and the balance shown is the one from the original operation.

