{
  "slug": "paddle-catalog-stale-while-revalidate",
  "title": "Paddle catalog api stale while revalidate",
  "metaDescription": "Paddle catalog api stale while revalidate. Shield Paddle with 300s GET edge cache; cache key uses query params on paddle-catalog-stale-while-revalidate.",
  "headline": "Pricing pages always fast during API blips",
  "category": "caching",
  "categoryLabel": "Edge Caching & Rate Limits",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Paddle"
  ],
  "searchIntentQuery": "paddle catalog api stale while revalidate",
  "directAnswerSummary": "SWR pattern on Paddle product catalog edge pipeline. For \"paddle catalog api stale while revalidate\", store PADDLE_API_KEY in Secret Vault, call https://api.paddle.com/prices?per_page=20 from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/paddle-catalog-stale-while-revalidate with an rc_live_ client token. Enable 300s GET cache only when query params identify the resource.",
  "problem": {
    "title": "Uncached Paddle spikes cost and latency",
    "explanation": "Every Frontend / Web visitor can trigger a fresh Paddle call. Bursts exhaust per-minute quotas even when data changes slowly.",
    "risks": [
      "Thundering herds after cache expiry on the origin",
      "Analytics skewed by client-side retry storms",
      "Support tickets blaming \"API downtime\" during spikes"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Store PADDLE_API_KEY in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token."
    },
    {
      "stepNumber": 2,
      "title": "Set headers, mapping, and cache TTL",
      "description": "Configure headersTemplate to inject vault secrets, target https://api.paddle.com/prices?per_page=20, and Add output mapping fields that mirror the JSON contract your screen already expects."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/paddle-catalog-stale-while-revalidate', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Paddle catalog api stale while revalidate",
    "method": "GET",
    "cacheTtlSeconds": 300,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "paddle",
        "upstreamUrlTemplate": "https://api.paddle.com/prices?per_page=20",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.PADDLE_API_KEY}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "subscriptionId",
          "sourcePath": "data.id",
          "type": "string",
          "sourceStep": "paddle"
        },
        {
          "targetPath": "status",
          "sourcePath": "data.status",
          "type": "string",
          "sourceStep": "paddle"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_paddle-c",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "paddle-catalog-stale-while-revalidate"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "subscriptionId": "sample",
    "status": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/paddle-catalog-stale-while-revalidate\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Can Frontend / Web call Paddle without holding the production key?",
      "answer": "Store PADDLE_API_KEY for paddle-catalog-stale-while-revalidate. Frontend / Web never sees decrypted values."
    },
    {
      "question": "Does POST traffic get cached?",
      "answer": "paddle-catalog-stale-while-revalidate: only GET requests cache (300s on caches.default). Key is workspace slug plus sorted query params, not Authorization."
    },
    {
      "question": "What happens if an upstream step times out?",
      "answer": "Allowed origins on the paddle-catalog-stale-while-revalidate client token restrict which domains may call the edge URL."
    }
  ],
  "relatedRecipeSlugs": [
    "stale-while-revalidate-third-party-api",
    "cache-paddle-pricing-api-checkout"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/paddle-catalog-stale-while-revalidate",
    "markdown": "https://realcomposer.com/recipes/paddle-catalog-stale-while-revalidate.md",
    "json": "https://realcomposer.com/recipes/paddle-catalog-stale-while-revalidate.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=paddle-catalog-stale-while-revalidate&via=agent"
  }
}