Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.unprice.dev/llms.txt

Use this file to discover all available pages before exploring further.

const { result, error } = await unprice.wallet.balance({
  customerId: "cus_1234567890"
});

if (error) {
  console.error(error.message);
  return;
}

console.log(result);
{
  "currency": "USD",
  "available": {
    "ledger_amount": 100000000,
    "amount": "1.00000000",
    "currency": "USD",
    "display_amount": "$1.00000000"
  },
  "held": {
    "ledger_amount": 25000000,
    "amount": "0.25000000",
    "currency": "USD",
    "display_amount": "$0.25000000"
  },
  "credits": [
    {
      "id": "wcr_123",
      "source": "credit_line",
      "issued": {
        "ledger_amount": 100000000,
        "amount": "1.00000000",
        "currency": "USD",
        "display_amount": "$1.00000000"
      },
      "available": {
        "ledger_amount": 75000000,
        "amount": "0.75000000",
        "currency": "USD",
        "display_amount": "$0.75000000"
      },
      "expires_at": "2026-06-07T00:00:00.000Z",
      "created_at": "2026-05-07T12:28:35.906Z"
    }
  ]
}
available is the amount the customer can still spend. held is already reserved for accepted usage that is still settling. To inspect one credit from the credits array:
const { result, error } = await unprice.wallet.creditBalance({
  customerId: "cus_1234567890",
  walletId: "wcr_123"
});

Request

customerId
string
required
The customer ID to load wallet state for.
projectId
string
Optional project ID. Only main-project keys can request another project.