{
  "slug": "call-paddle-api-from-react-securely",
  "title": "Call paddle api from react without leaking api key",
  "metaTitle": "Call paddle api from react without - RealComposer",
  "metaDescription": "Call paddle api from react without leaking api key. Proxy Paddle Billing API with restricted client tokens. Keep Paddle keys in RealComposer Vault;.",
  "headline": "SaaS billing lookups without Paddle secrets in React",
  "category": "security",
  "categoryLabel": "Security & Secret Vault",
  "urgency": 10,
  "clientPlatform": "React",
  "upstreamServices": [
    "Paddle"
  ],
  "searchIntentQuery": "call paddle api from react without leaking api key",
  "directAnswerSummary": "Proxy Paddle Billing API with restricted client tokens and vault-held API keys. For \"call paddle api from react without leaking api key\", 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/call-paddle-api-from-react-securely with an rc_live_ client token.",
  "problem": {
    "title": "Paddle keys in React network tabs",
    "explanation": "React ships code or scripts to end-user devices. Any Paddle bearer token in those bundles can be copied from DevTools, proxies, or repackaged apps.",
    "risks": [
      "Shared React projects revealing Paddle tokens",
      "Sudden Paddle quota burn from scripted abuse",
      "Inability to rotate keys without redeploying clients"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Create PADDLE_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Point step paddle at https://api.paddle.com/subscriptions/{{query.subscriptionId}} with GET. Add output mapping fields that mirror the JSON contract your screen already expects. Leave cache TTL at 0 when each response is user-specific (include userId or record id in query params before enabling cache)."
    },
    {
      "stepNumber": 3,
      "title": "Call from React",
      "description": "Call https://realcomposer.com/v1/workspace/call-paddle-api-from-react-securely with a restricted rc_live_ client token. React never sends upstream secrets.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/call-paddle-api-from-react-securely', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});\nconst data = await res.json();"
    }
  ],
  "pipelineConfig": {
    "name": "Call paddle api from react without leaking api key",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "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_call-pad",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "call-paddle-api-from-react-securely"
    },
    "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/call-paddle-api-from-react-securely\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "What should React store instead of Paddle secrets?",
      "answer": "Point React at /recipes/call-paddle-api-from-react-securely edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins."
    },
    {
      "question": "Will Anthropic or Linear prompt bodies be rewritten?",
      "answer": "Cache key for call-paddle-api-from-react-securely: internal edge-cache path plus sorted query. Identical params hit; vary userId per user."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Upstream steps in call-paddle-api-from-react-securely honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "stripe-proxy-react-native",
    "clerk-backend-api-proxy"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/call-paddle-api-from-react-securely",
    "markdown": "https://realcomposer.com/recipes/call-paddle-api-from-react-securely.md",
    "json": "https://realcomposer.com/recipes/call-paddle-api-from-react-securely.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=call-paddle-api-from-react-securely&via=agent"
  }
}