Library

Transaction enrichment library for Cloudflare Workers

Use TxnKit as a transaction enrichment API from Cloudflare Workers. This page shows the safe request shape, a short code snippet, and the boundary for keeping sensitive data out of the integration.

Target intent

Cloudflare Workers routes that proxy safe descriptor enrichment with server-side secrets.

TxnKit does not require a crawler, queue, or live logo provider inside the Worker.

Raw descriptor

PAYPAL *SPOTIFY

Short Cloudflare Workers API snippet

export default {
  async fetch(request, env) {
    const body = await request.json();
    return fetch("https://api.txnkit.dev/v1/enrich", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${env.TXNKIT_API_KEY}`,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({ raw_description: body.raw_description, country: "CA" })
    });
  }
};

Keep API keys out of browser bundles. For frontend stacks, call a backend route or serverless function that owns the TxnKit request.

API-shaped output

{
  "normalized_merchant": "spotify",
  "display_name": "Spotify",
  "category": "digital_services",
  "subcategory": "music_streaming",
  "website": "https://www.spotify.com",
  "logos": {
    "preferred": {
      "url": "https://cdn.txnkit.dev/logos/curated-seed-20260524/pilot-001/logos/spotify/icon_64-64x64.png",
      "format": "png",
      "width": 64,
      "height": 64,
      "background": "brand",
      "theme": "any",
      "shape": "square",
      "purpose": "transaction_feed_icon",
      "source": "curated",
      "confidence": 0.96
    },
    "variants": [
      {
        "url": "https://cdn.txnkit.dev/logos/curated-seed-20260524/pilot-001/logos/spotify/icon_32-32x32.png",
        "format": "png",
        "width": 32,
        "height": 32,
        "background": "brand",
        "theme": "any",
        "shape": "square",
        "purpose": "transaction_feed_icon",
        "source": "curated",
        "confidence": 0.96
      },
      {
        "url": "https://cdn.txnkit.dev/logos/curated-seed-20260524/pilot-001/logos/spotify/icon_48-48x48.png",
        "format": "png",
        "width": 48,
        "height": 48,
        "background": "brand",
        "theme": "any",
        "shape": "square",
        "purpose": "transaction_feed_icon",
        "source": "curated",
        "confidence": 0.96
      },
      {
        "url": "https://cdn.txnkit.dev/logos/curated-seed-20260524/pilot-001/logos/spotify/icon_64-64x64.png",
        "format": "png",
        "width": 64,
        "height": 64,
        "background": "brand",
        "theme": "any",
        "shape": "square",
        "purpose": "transaction_feed_icon",
        "source": "curated",
        "confidence": 0.96
      },
      {
        "url": "https://cdn.txnkit.dev/logos/curated-seed-20260524/pilot-001/logos/spotify/profile_icon_128-128x128.png",
        "format": "png",
        "width": 128,
        "height": 128,
        "background": "brand",
        "theme": "any",
        "shape": "square",
        "purpose": "merchant_profile_icon",
        "source": "curated",
        "confidence": 0.96
      },
      {
        "url": "https://cdn.txnkit.dev/logos/curated-seed-20260524/pilot-001/logos/spotify/profile_icon_256-256x256.png",
        "format": "png",
        "width": 256,
        "height": 256,
        "background": "brand",
        "theme": "any",
        "shape": "square",
        "purpose": "merchant_profile_icon",
        "source": "curated",
        "confidence": 0.96
      }
    ],
    "warnings": []
  },
  "confidence": 0.94,
  "recurring_hint": false,
  "processor_hint": "paypal",
  "location_hint": null,
  "signals": [
    "applied_processor_paypal_star",
    "reviewed_merchant_match"
  ],
  "warnings": []
}

Low-confidence results should keep fallback labels and warnings visible instead of forcing a guessed logo or website.

When to use

  • You are building in Cloudflare Workers and need one-descriptor merchant cleanup through an HTTP API.
  • Your app can keep the TxnKit API key on the server side or inside a trusted serverless function.
  • You need merchant display names, categories, confidence, signals, warnings, and logo-ready metadata.

When not to use

  • TxnKit does not require a crawler, queue, or live logo provider inside the Worker.
  • Do not use TxnKit to process card numbers, account numbers, full statements, bank credentials, emails, phone numbers, addresses, customer names, or customer PII.
  • Do not use TxnKit when the product requirement is guaranteed merchant identity, every-merchant resolution, or contracted uptime terms.

Proof surfaces

The public contract is POST /v1/enrich, backed by the OpenAPI file, benchmark examples, privacy rules, and deterministic request-path tests.

OpenAPI · Benchmark · Security · Pricing

Related pages