# Wallet

> Read the prepaid wallet that pays your orders, and every charge, refund and top-up for reconciliation. Read-only.

Source: https://docs.b7r.app/wallet

Your B7R wallet is prepaid: you top it up in the app, and each order is charged from it when it is placed. The wallet and the invoices of B7R belong to your account, whichever key or seller placed the order. Through the API the wallet is read-only: no top-ups, no withdrawals. The balance is a prepayment, so it carries no VAT; each order charge shows net, VAT and gross (see [Money and VAT](https://docs.b7r.app/money-and-vat)).

## Read the wallet

`GET /v1/wallet`

The balance, and what your unpaid orders wait for. Unpaid orders of every channel count: the wallet is one.

Key: A key with the `wallet:read` area.

Answer:

- `balance` (object, required)
  - `amount` (string, required)
  - `currency` (constant, required): Always `"SAR"`.
- `unpaid_total` (object, required)
  - `amount` (string, required)
  - `currency` (constant, required): Always `"SAR"`.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/wallet \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/wallet", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/wallet",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "balance": {
    "amount": "2355.00",
    "currency": "SAR"
  },
  "unpaid_total": {
    "amount": "0.00",
    "currency": "SAR"
  }
}
```

## List wallet movements

`GET /v1/wallet/transactions`

Every movement, newest first. Each charge and refund names its order in `order_id`, whatever channel the order came from: a Salla or manual order charged to your wallet appears here beside your API orders, and `GET /v1/orders/{order_id}` reads it with the same key. Match `order_charge` and `order_refund` to your orders to reconcile. `type` is `topup`, `order_charge`, `order_refund`, `bonus`, `adjustment` or `other`; treat a type you do not know as `other`, and `order_id` is `null` on a movement with no order. A B7R store order is paid by the shopper (`paid_by: shopper`), so it never charges or refunds your wallet.

Pass `type` to list one type only; `type=other` lists every movement of none of the five named types (your store earnings among them). With the `reports:read` area, `include=details` adds `details` to each movement: `reason`, what it was for, as a code (`auto_clear` is an unpaid order paid by a top-up; `note` is an adjustment B7R explained in its own words, in `note`; `null` when there is nothing to say), and `earnings`, how much of it moved your store earnings.

Key: A key with the `wallet:read` area.

Query:

- `limit` (string)
- `cursor` (string): 1 to 256.
- `type` (string): Only the lines of this type. other: every line of none of the five named types (earnings among them). One of `topup`, `order_charge`, `order_refund`, `bonus`, `adjustment`, `other`.
- `include` (constant): details: add each line's reason and its earnings part. Needs the reports:read area. Always `"details"`.

Answer:

- `data` (array of object, required)
  - `id` (string (uuid), required)
  - `type` (string, required): One of `topup`, `order_charge`, `order_refund`, `bonus`, `adjustment`, `other`.
  - `amount` (object, required)
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `balance_after` (object, required)
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `order_id` (string or null, required)
  - `created_at` (string, required)
  - `details` (object)
    - `reason` (string or null, required): What the line was for: auto_clear (an unpaid order paid by a top-up), partial_reversal, topup_approved, card_topup, order_edit, welcome_bonus, order_earnings, earnings_transfer, earnings_transfer_returned, earnings_charge, or note (an adjustment B7R explained in its own words). null when there is nothing to say.
    - `note` (string or null, required): The words B7R wrote on a manual adjustment; null otherwise.
    - `earnings` (object, required): How much of the line moved your store earnings: negative when earnings left the balance.
      - `amount` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
- `next_cursor` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl "https://api.b7r.app/v1/wallet/transactions?limit=50" \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/wallet/transactions?limit=50", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/wallet/transactions?limit=50",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "7d0e2f5a-6b8c-4d9e-9f0a-2b3c4d5e6f7a",
      "type": "order_charge",
      "amount": {
        "amount": "-145.00",
        "currency": "SAR"
      },
      "balance_after": {
        "amount": "2355.00",
        "currency": "SAR"
      },
      "order_id": "B26112200042",
      "created_at": "2026-11-22T12:30:11.902Z"
    }
  ],
  "next_cursor": null
}
```

## Search wallet movements

`POST /v1/wallet/transactions/search`

Searches your movements as the wallet page does: `search` is matched within each movement's order number and reason, newest first, every movement with its `details`. Narrow it with `type`, and page it with `limit` and `cursor` in the body. The term is never kept in the call's record. Needs both the `wallet:read` and the `reports:read` areas; `reports:read` opens the details, so the search takes no `include` flag.

Key: A key with the `wallet:read` area. Send `Idempotency-Key` and `Content-Type: application/json`.

Body:

- `search` (string, required): Matched within each line's order number and reason, as the wallet page searches. Not kept in the call's record. 1 to 100.
- `type` (string): Only the lines of this type. other: every line of none of the five named types (earnings among them). One of `topup`, `order_charge`, `order_refund`, `bonus`, `adjustment`, `other`.
- `limit` (integer): 1 to 100.
- `cursor` (string): 1 to 256.

Answer:

- `data` (array of object, required)
  - `id` (string (uuid), required)
  - `type` (string, required): One of `topup`, `order_charge`, `order_refund`, `bonus`, `adjustment`, `other`.
  - `amount` (object, required)
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `balance_after` (object, required)
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `order_id` (string or null, required)
  - `created_at` (string, required)
  - `details` (object)
    - `reason` (string or null, required): What the line was for: auto_clear (an unpaid order paid by a top-up), partial_reversal, topup_approved, card_topup, order_edit, welcome_bonus, order_earnings, earnings_transfer, earnings_transfer_returned, earnings_charge, or note (an adjustment B7R explained in its own words). null when there is nothing to say.
    - `note` (string or null, required): The words B7R wrote on a manual adjustment; null otherwise.
    - `earnings` (object, required): How much of the line moved your store earnings: negative when earnings left the balance.
      - `amount` (string, required)
      - `currency` (constant, required): Always `"SAR"`.
- `next_cursor` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `idempotency_key_required` (400), `request_too_large` (413), `unsupported_media_type` (415), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl -X POST https://api.b7r.app/v1/wallet/transactions/search \
  -H "Authorization: Bearer $B7R_API_KEY" \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || node -e 'console.log(crypto.randomUUID())')" \
  -H "Content-Type: application/json" \
  -d '{
    "search": "B261122",
    "type": "order_charge"
  }'
```

```javascript
const res = await fetch("https://api.b7r.app/v1/wallet/transactions/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "search": "B261122",
    "type": "order_charge"
  }),
});
const data = await res.json();
```

```python
import os, requests, uuid

res = requests.post(
    "https://api.b7r.app/v1/wallet/transactions/search",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "search": "B261122",
        "type": "order_charge"
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "7d0e2f5a-6b8c-4d9e-9f0a-2b3c4d5e6f7a",
      "type": "order_charge",
      "amount": {
        "amount": "-145.00",
        "currency": "SAR"
      },
      "balance_after": {
        "amount": "2355.00",
        "currency": "SAR"
      },
      "order_id": "B26112200042",
      "created_at": "2026-11-22T12:30:11.902Z",
      "details": {
        "reason": "auto_clear",
        "note": null,
        "earnings": {
          "amount": "0.00",
          "currency": "SAR"
        }
      }
    }
  ],
  "next_cursor": null
}
```

## Read the last 60 days

`GET /v1/wallet/stats`

What your wallet card shows for the last 60 days: what you topped up, what left the wallet on orders (refunds counted against it, never below zero) and how many orders the wallet paid for (an order refunded in full is not counted). These figures sum recent activity: bonuses, adjustments and older movements are left out, so they do not add up to your balance. Needs the `reports:read` area. If the figures cannot be read, the answer is `503 try_again_later`, never zeros.

Key: A key with the `reports:read` area.

Answer:

- `window_days` (integer, required): The days the figures cover, up to now (the last 60).
- `topped_up` (object, required): Top-ups credited to the wallet inside the window.
  - `amount` (string, required)
  - `currency` (constant, required): Always `"SAR"`.
- `spent_on_orders` (object, required): What left the wallet on orders inside the window, refunds counted against it.
  - `amount` (string, required)
  - `currency` (constant, required): Always `"SAR"`.
- `paid_orders` (integer, required): Orders the wallet paid for inside the window; an order refunded in full is not counted.

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/wallet/stats \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/wallet/stats", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/wallet/stats",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "window_days": 60,
  "topped_up": {
    "amount": "3000.00",
    "currency": "SAR"
  },
  "spent_on_orders": {
    "amount": "645.00",
    "currency": "SAR"
  },
  "paid_orders": 5
}
```

## List top-up requests

`GET /v1/wallet/topups`

Every top-up request of your account, newest first, as your wallet page shows them: `method` is `bank_transfer` or `card`; `status` is `pending` (a transfer waiting for review, or a card payment not finished), `approved` (credited to your wallet), `rejected` (B7R refused the transfer and says why in `rejection_note`) or `cancelled` (the card payment window closed unpaid). Page it with `limit` and `cursor`. Top-ups are made in the app: a key reads them and never makes one.

Key: A key with the `wallet:read` area.

Query:

- `limit` (string)
- `cursor` (string): 1 to 256.

Answer:

- `data` (array of object, required)
  - `id` (string (uuid), required)
  - `method` (string, required): How it is paid: a bank transfer you sent, or a card payment. One of `bank_transfer`, `card`.
  - `status` (string, required): pending: a transfer waiting for review, or a card payment not finished. approved: credited to your wallet. rejected: B7R refused the transfer (see rejection_note). cancelled: the card payment window closed unpaid. One of `pending`, `approved`, `rejected`, `cancelled`.
  - `amount` (object, required): What the request credits to your wallet.
    - `amount` (string, required)
    - `currency` (constant, required): Always `"SAR"`.
  - `rejection_note` (string or null, required): Why B7R refused the transfer, in its own words; null otherwise.
  - `reviewed_at` (string or null, required): When B7R approved or refused it; null while pending.
  - `created_at` (string, required)
- `next_cursor` (string or null, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl "https://api.b7r.app/v1/wallet/topups?limit=50" \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/wallet/topups?limit=50", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/wallet/topups?limit=50",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "data": [
    {
      "id": "5d2f8a10-3c4b-4e6f-9a1b-2c3d4e5f6a7b",
      "method": "bank_transfer",
      "status": "approved",
      "amount": {
        "amount": "3000.00",
        "currency": "SAR"
      },
      "rejection_note": null,
      "reviewed_at": "2026-11-21T08:15:00.000Z",
      "created_at": "2026-11-20T19:42:10.000Z"
    }
  ],
  "next_cursor": null
}
```

## Read a top-up request

`GET /v1/wallet/topups/{id}`

One request, to follow it until it is credited or closed. Another account's request answers `404 not_found`, like one that does not exist.

Key: A key with the `wallet:read` area.

Path:

- `id` (string (uuid), required)

Answer:

- `id` (string (uuid), required)
- `method` (string, required): How it is paid: a bank transfer you sent, or a card payment. One of `bank_transfer`, `card`.
- `status` (string, required): pending: a transfer waiting for review, or a card payment not finished. approved: credited to your wallet. rejected: B7R refused the transfer (see rejection_note). cancelled: the card payment window closed unpaid. One of `pending`, `approved`, `rejected`, `cancelled`.
- `amount` (object, required): What the request credits to your wallet.
  - `amount` (string, required)
  - `currency` (constant, required): Always `"SAR"`.
- `rejection_note` (string or null, required): Why B7R refused the transfer, in its own words; null otherwise.
- `reviewed_at` (string or null, required): When B7R approved or refused it; null while pending.
- `created_at` (string, required)

Errors: `unauthorized` (401), `area_forbidden` (403), `account_inactive` (403), `connection_disabled` (403), `https_required` (403), `not_found` (404), `invalid_request` (400), `rate_limited` (429), `internal_error` (500), `upstream_unavailable` (502), `api_unavailable` (503), `request_expired` (503), `service_unavailable` (503), `upstream_timeout` (504), `try_again_later` (503). See [Errors](https://docs.b7r.app/errors).

Request:

```bash
curl https://api.b7r.app/v1/wallet/topups/5d2f8a10-3c4b-4e6f-9a1b-2c3d4e5f6a7b \
  -H "Authorization: Bearer $B7R_API_KEY"
```

```javascript
const res = await fetch("https://api.b7r.app/v1/wallet/topups/5d2f8a10-3c4b-4e6f-9a1b-2c3d4e5f6a7b", {
  headers: {
    Authorization: `Bearer ${process.env.B7R_API_KEY}`,
  },
});
const data = await res.json();
```

```python
import os, requests

res = requests.get(
    "https://api.b7r.app/v1/wallet/topups/5d2f8a10-3c4b-4e6f-9a1b-2c3d4e5f6a7b",
    headers={
        "Authorization": f"Bearer {os.environ['B7R_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
```

Answer (200 OK):

```json
{
  "id": "5d2f8a10-3c4b-4e6f-9a1b-2c3d4e5f6a7b",
  "method": "bank_transfer",
  "status": "approved",
  "amount": {
    "amount": "3000.00",
    "currency": "SAR"
  },
  "rejection_note": null,
  "reviewed_at": "2026-11-21T08:15:00.000Z",
  "created_at": "2026-11-20T19:42:10.000Z"
}
```
