{
  "slug": "cache-paddle-pricing-api-checkout",
  "title": "Cache paddle pricing api for checkout page",
  "metaDescription": "Cache paddle pricing api for checkout page. Shield Paddle with 120s GET edge cache; cache key uses query params on cache-paddle-pricing-api-checkout.",
  "headline": "Flash sale checkout without Paddle rate spikes",
  "category": "caching",
  "categoryLabel": "Edge Caching & Rate Limits",
  "urgency": 8,
  "clientPlatform": "React",
  "upstreamServices": [
    "Paddle"
  ],
  "searchIntentQuery": "cache paddle pricing api for checkout page",
  "directAnswerSummary": "TTL cache on catalog price endpoints during launches. For \"cache paddle pricing api for checkout page\", store PADDLE_API_KEY in Secret Vault, call https://api.paddle.com/subscriptions/{{query.subscriptionId}} from a Worker, and let React hit only https://realcomposer.com/v1/workspace/cache-paddle-pricing-api-checkout with an rc_live_ client token. Enable 120s GET cache only when query params identify the resource.",
  "problem": {
    "title": "Uncached Paddle spikes cost and latency",
    "explanation": "Every React 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": "Add vault secrets for this pipeline",
      "description": "Store PADDLE_API_KEY in the vault. React never embeds the raw secret, only a revocable rc_live_ client token."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "Configure headersTemplate to inject vault secrets, target https://api.paddle.com/subscriptions/{{query.subscriptionId}}, and Add output mapping fields that mirror the JSON contract your screen already expects."
    },
    {
      "stepNumber": 3,
      "title": "Call from React",
      "description": "Allowed origins on the token should list every React host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/cache-paddle-pricing-api-checkout', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});\nconst data = await res.json();"
    }
  ],
  "pipelineConfig": {
    "name": "Cache paddle pricing api for checkout page",
    "method": "GET",
    "cacheTtlSeconds": 120,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "paddle",
        "upstreamUrlTemplate": "https://api.paddle.com/subscriptions/{{query.subscriptionId}}",
        "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_cache-pa",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "cache-paddle-pricing-api-checkout"
    },
    "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/cache-paddle-pricing-api-checkout\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "What should React store instead of Paddle secrets?",
      "answer": "Log request IDs for cache-paddle-pricing-api-checkout, not raw Paddle payloads, because upstream bodies may include PII."
    },
    {
      "question": "How do I forward JSON bodies to POST upstreams?",
      "answer": "Cache key for cache-paddle-pricing-api-checkout: internal edge-cache path plus sorted query. Identical params hit; vary userId per user."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Upstream steps in cache-paddle-pricing-api-checkout honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "avoid-stripe-api-rate-limit",
    "cache-crypto-pricing-api-edge"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/cache-paddle-pricing-api-checkout",
    "markdown": "https://realcomposer.com/recipes/cache-paddle-pricing-api-checkout.md",
    "json": "https://realcomposer.com/recipes/cache-paddle-pricing-api-checkout.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=cache-paddle-pricing-api-checkout&via=agent"
  }
}