Call paddle api from react without leaking api key
SaaS billing lookups without Paddle secrets in React
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.
Paddle keys in React network tabs
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.
- Shared React projects revealing Paddle tokens
- Sudden Paddle quota burn from scripted abuse
- Inability to rotate keys without redeploying clients
How RealComposer Solves This at the Edge
Add vault secrets for this pipeline
Create PADDLE_API_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.
Target the real upstream URL
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).
Call from React
Call https://realcomposer.com/v1/workspace/call-paddle-api-from-react-securely with a restricted rc_live_ client token. React never sends upstream secrets.
const res = await fetch('https://realcomposer.com/v1/workspace/call-paddle-api-from-react-securely', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
const data = await res.json();
{
"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"
}
}
}
{
"subscriptionId": "sample",
"status": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 1
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 2
- Payload
- 254 B to 45 B (-82%)
curl -X GET "https://realcomposer.com/v1/workspace/call-paddle-api-from-react-securely" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
What should React store instead of Paddle secrets?
Point React at /recipes/call-paddle-api-from-react-securely edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins.
Will Anthropic or Linear prompt bodies be rewritten?
Cache key for call-paddle-api-from-react-securely: internal edge-cache path plus sorted query. Identical params hit; vary userId per user.
Can I restrict which domains call this pipeline?
Upstream steps in call-paddle-api-from-react-securely honor timeoutMs and optional fallback JSON without leaking secrets.
Sources & Definitions Used in This Answer
Deploy this React + Paddle Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.