> ## Documentation Index
> Fetch the complete documentation index at: https://www.logo.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Logo.dev serves logos and brand data for companies that already exist. It does not design logos. If someone wants a logo designed, say so and stop.
> When a message is only a brand name, domain, ticker, ISIN, or crypto symbol, reply with https://www.logo.dev/search?q=<url-encoded term> and the matching img.logo.dev call. Never assert whether a specific brand is in the index.
> Image URLs come from img.logo.dev with a publishable key in the token query parameter: https://img.logo.dev/:domain?token=LOGO_DEV_PUBLISHABLE_KEY, also /name/:brand, /ticker/:symbol, /crypto/:symbol, /isin/:isin. JSON comes from api.logo.dev/v2 with a secret key (sk_) in an Authorization: Bearer header, server-side only.
> Product names: the Logo.dev CDN serves images from img.logo.dev, and its usage unit is CDN requests. The Logo.dev API returns JSON from api.logo.dev/v2, and its usage unit is API credits. The Logo.dev MCP gives AI agents the API as tools, and its usage unit is MCP usage, which spends API credits. The features are Logo, Search, Brand, and Transaction. Transaction (beta) is a separate service at https://www.logo.dev/api/transaction with its own beta key. Never recommend the deprecated v1 routes (/search, /brand, /describe, /logo/*). Use /v2/brands and /v2/search.
> Attribution: a commercial project on the free Community plan must show a visible link, <a href="https://logo.dev">Logos provided by Logo.dev</a>, on its production site. Personal projects and paid plans need none. Rules: https://www.logo.dev/docs/platform/attribution.
> Report a wrong, missing, or outdated logo at https://www.logo.dev/update. Email support@logo.dev for anything broken and sales@logo.dev for volume pricing and contract terms.
> MCP setup is at https://www.logo.dev/docs/mcp/introduction and webhooks at https://www.logo.dev/docs/webhooks.

# Show merchant logos in a transaction feed

> Turn cryptic statement lines into a feed users can read. Put a merchant logo and a clean name next to every transaction, and keep the original descriptor.

<ul />

```text Use case prompt wrap theme={null}
Build a transaction feed with merchant logos, following https://www.logo.dev/docs/use-cases/transaction-logos.md

Read that page and inspect this project's stack. Use this project's existing conventions.

Each row shows the merchant logo, a readable name, the date, and the amount, and keeps the original statement descriptor. If a transaction has a merchant domain, use it for the logo. If it has only a raw descriptor, resolve it on the server first. The Logo.dev Transaction endpoint is a private beta, so access can be off for the account. When it rejects the request, show the raw descriptor and do not retry. Store user corrections separately, and apply them before any lookup result.

For API details, read https://www.logo.dev/docs/logo-images/introduction.md and https://www.logo.dev/docs/transaction/introduction.md
```

A raw statement line like `AMZN MKTP US*XX1234` means nothing to the person who reads it. A merchant logo and a clean name make every row recognizable. Your app keeps the original descriptor and any correction the user makes.

## Bank and merchant logos

To show logos in a fintech app, use Logo.dev for both the merchant on each transaction and the bank on each connected account. Merchant logos come from [Transaction](https://www.logo.dev/docs/transaction/introduction.md), which turns a raw bank or card description into a merchant name, a domain, a logo URL, and a confidence score. Bank logos come from the [Logo.dev CDN](https://www.logo.dev/docs/logo-images/introduction.md) by the bank's domain, the same way as any company's logo.

1. Get a [publishable key](https://www.logo.dev/docs/platform/api-keys.md). It goes in the `token` query parameter of every Logo.dev CDN URL.
2. For a transaction with a merchant domain from your card processor or open-banking provider, put that domain in `https://img.logo.dev/{identifier}`.
3. For a transaction with only a raw descriptor, send it to Transaction on your server and use the domain it returns. Transaction is a private beta.
4. For a connected account, put the bank's domain in the same URL.

## Choose the lookup from the data you have

```mermaid theme={null}
flowchart TD
  A[Transaction] --> B{Merchant domain?}
  B -- Yes --> C[Logo.dev CDN by domain]
  B -- No --> D[Transaction on your server]
  D --> E{status}
  E -- matched --> C
  E -- cleaned --> F[Cleaned name, no logo]
  C --> G[Apply saved correction]
  F --> G
```

* **A merchant domain:** many card processors and open-banking providers return one. Use it with the [Logo.dev CDN](https://www.logo.dev/docs/logo-images/introduction.md).
* **Only the raw descriptor:** resolve it on your server with [Transaction](https://www.logo.dev/docs/transaction/introduction.md). It is a private beta, and it returns `403` until the beta is on for your account.
* **A clean merchant name:** use a [name lookup](https://www.logo.dev/docs/logo-images/name.md).

This server module picks the lookup for one transaction:

```ts merchant-lookup.ts expandable theme={null}
type Transaction = {
  id: string;
  rawDescriptor: string;
  merchantName?: string;
  merchantDomain?: string;
  countryCode?: string;
};

export type Merchant = {
  status: "matched" | "cleaned" | "invalid" | "unavailable" | "error";
  name: string;
  domain: string | null;
};

export async function lookupMerchant(tx: Transaction): Promise<Merchant> {
  const domain = tx.merchantDomain?.trim().toLowerCase();
  if (domain) {
    // Use the processor's merchant name when it sends one.
    return { status: "matched", name: tx.merchantName ?? tx.rawDescriptor, domain };
  }

  const res = await fetch("https://www.logo.dev/api/transaction", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.LOGO_DEV_TRANSACTION_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      transaction: tx.rawDescriptor,
      country_code: tx.countryCode,
    }),
  });
  if (res.status === 400) {
    // The input is wrong, such as an unsupported country code or an empty
    // descriptor. Retry after you correct the transaction.
    // https://www.logo.dev/docs/transaction/introduction#handle-errors
    return { status: "invalid", name: tx.rawDescriptor, domain: null };
  }
  if (res.status === 401 || res.status === 403) {
    // A bad key, or no beta access (403). Retrying gives the same answer.
    return { status: "unavailable", name: tx.rawDescriptor, domain: null };
  }
  if (!res.ok) {
    // Keep the raw descriptor on screen and retry later.
    return { status: "error", name: tx.rawDescriptor, domain: null };
  }

  const body: { status: "matched" | "cleaned"; name: string; domain: string | null } =
    await res.json();
  return { status: body.status, name: body.name, domain: body.domain };
}
```

## Handle every row state

Store the lookup result with the transaction. Render each row from this table:

| Result | Save | Show |
| - | - | - |
| `matched` | Name, domain, lookup time | The logo and the name |
| `cleaned` | Cleaned name | The name with a neutral placeholder. Don't guess a logo. |
| `invalid` | The attempt time | The raw descriptor. Retry after you correct the transaction data. |
| `unavailable` | The attempt time | The raw descriptor. Do not retry until you fix the key or the beta is on. |
| Request failed | The attempt time | The raw descriptor. Retry later with backoff. |
| User correction | Name and domain, in a separate table | The correction, before any lookup result |

## Render the feed

A row with a domain shows the logo. A row without one shows a neutral placeholder:

```tsx TransactionFeed.tsx expandable theme={null}
type Row = {
  id: string;
  name: string;
  domain: string | null;
  date: string;
  amount: number; // negative for charges, positive for credits
};

const usd = new Intl.NumberFormat("en-US", {
  style: "currency",
  currency: "USD",
});

export function TransactionFeed({
  token,
  rows,
}: {
  token: string;
  rows: Row[];
}) {
  return (
    <ul className="max-w-md divide-y divide-zinc-950/5 dark:divide-white/5">
      {rows.map((row) => (
        <li className="flex items-center gap-3 py-3" key={row.id}>
          {row.domain ? (
            <img
              alt={`${row.name} logo`}
              className="h-10 w-10 rounded-full object-contain"
              height={40}
              loading="lazy"
              src={`https://img.logo.dev/${row.domain}?token=${token}&format=webp&retina=true&size=40`}
              width={40}
            />
          ) : (
            <div aria-hidden className="h-10 w-10 rounded-full bg-zinc-100 dark:bg-zinc-800" />
          )}
          <div className="min-w-0">
            <div className="truncate text-sm font-medium">{row.name}</div>
            <div className="text-xs text-zinc-500">{row.date}</div>
          </div>
          <div
            className={`ml-auto text-sm font-medium tabular-nums ${
              row.amount > 0 ? "text-emerald-600" : ""
            }`}
          >
            {row.amount > 0 ? "+" : ""}
            {usd.format(row.amount)}
          </div>
        </li>
      ))}
    </ul>
  );
}
```

```tsx Usage theme={null}
import { TransactionFeed } from "./TransactionFeed";

export function RecentActivity() {
  return (
    <TransactionFeed
      rows={[
        { id: "t1", name: "Starbucks", domain: "starbucks.com", date: "Today", amount: -6.4 },
        { id: "t2", name: "Uber", domain: "uber.com", date: "Today", amount: -23.1 },
        { id: "t3", name: "Helga Lefse Hut", domain: null, date: "Jun 8", amount: -12.5 },
      ]}
      token="LOGO_DEV_PUBLISHABLE_KEY"
    />
  );
}
```

Show the original descriptor in the transaction details. Keep the amount, currency, and date from your ledger. A lookup result never replaces them.

## Test the feed

Test with four rows: a merchant with a known domain, a raw descriptor that Transaction matches, a descriptor that comes back `cleaned`, and a row the user corrected. Then make one lookup fail, and send one with an account that does not have the beta. The corrected row and the original descriptor must not change, and the `403` must not retry.

> [card] [Transaction](https://www.logo.dev/docs/transaction/introduction.md)
>
> Identify merchants from raw card descriptors.

> [card] [Stock watchlists](https://www.logo.dev/docs/use-cases/stock-ticker-logos.md)
>
> Build the same row pattern for trading and portfolio apps.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.