---
title: "Show orders, invoices and usage"
description: "List an entity's past charges with invoice links, show its metered consumption, and refund an order from the admin tier."
canonical_url: "https://nuxt-backend.dev/docs/billing/subscriptions/orders"
---
# Show orders, invoices and usage

> List an entity's past charges with invoice links, show its metered consumption, and refund an order from the admin tier.

Orders, invoices and metered usage are read live from the provider: there is no local order or usage table, because the provider already is the ledger. Every read returns nothing, rather than an error, when no access token is configured.

## Orders and invoices

`useOrders()` pages the entity's past charges straight from the provider (no local order table), and `<BillingHistory>` renders them with invoice links:

```vue
<script setup lang="ts">
const { orders, invoice, next, previous, hasMore } = useOrders({ limit: 10 })
// invoice(orderId) opens the invoice in a new tab and resolves with its URL —
// null while the provider is still generating the PDF, so offer a retry.
// `{ open: false }` hands the URL back without opening it (a download link);
// `{ redirect: true }` opens it in the same tab.
</script>

<template>
  <BillingHistory :limit="10" />
</template>
```

`useOrders({ limit?, immediate?, api? })` returns `orders` (`undefined` until the first load), `page`, `total` / `pageCount` (when the provider reports them), `hasMore` / `hasPrevious`, `isLoading`, `error` (the last failed load's message — loads never reject), `refresh()`, `next()`, `previous()`, `goTo(page)` and `invoice(orderId, options?)`. Signed-out visitors, and backends that have not deployed `getOrders`, get an empty list rather than an error.

## Usage

`useUsage()` pages one credit meter's consumption, the events your server ingested when it spent credits, and `<UsageHistory>` renders it:

```vue
<script setup lang="ts">
const { events, units, next, previous, hasMore } = useUsage({ meter: 'credits', limit: 20 })
</script>

<template>
  <UsageHistory meter="credits" />
</template>
```

`useUsage({ meter?, limit?, immediate?, api? })` returns `events`, `units` (the page's total, once the server reports units per event), the same paging fields as `useOrders`, `isLoading` and `error`. Without `meter` it reads every metered event.

## Refunds

`refundOrder` moves real money, so it is admin-tier: by default only a caller with the `admin` role passes, and `setupBilling({ requireAdmin })` replaces that check with your own. It takes `orderId`, an `amount` in the currency's minor unit (everything still refundable when omitted), a `reason`, and `revokeBenefits` for a one-time purchase whose benefits should go too.

<page-keys>

- Try it live in the playground: [/playground/platform/history](https://nuxt-backend.dev/playground/platform/history)
- API reference: [/docs/reference/api/use-orders](https://nuxt-backend.dev/docs/reference/api/use-orders)
- Source: [https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-orders.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-orders.ts)

</page-keys>


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
