# Paddle api proxy for flutter mobile subscriptions

> Paddle customer and subscription fetches without APK secret scanning risk. For "paddle api proxy for flutter mobile subscriptions", store PADDLE_API_KEY in Secret Vault, call https://api.paddle.com/subscriptions/{{query.subscriptionId}} from a Worker, and let FlutterFlow hit only https://realcomposer.com/v1/workspace/paddle-api-proxy-flutter with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/paddle-api-proxy-flutter
- Client platform: FlutterFlow
- Upstream services: Paddle
- Category: Security & Secret Vault
- JSON version: https://realcomposer.com/recipes/paddle-api-proxy-flutter.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=paddle-api-proxy-flutter&via=agent

## Problem: Why FlutterFlow leaks Paddle credentials

Attackers routinely extract Paddle secrets from FlutterFlow builds. Direct browser calls also expose internal error payloads with hostnames.

- Production Paddle keys copied from FlutterFlow bundles
- Compliance violations after credential leaks
- Attackers replaying vault-grade scopes from a laptop

## Solution steps

1. **Bind vault keys to the Worker**: Add PADDLE_API_KEY to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.

2. **Configure upstream steps and output mapping**: Use GET against https://api.paddle.com/subscriptions/{{query.subscriptionId}}. Allowed origins on the client token should match leave cache ttl at 0 when each response is user-specific (include userid or record id in query params before enabling cache).

3. **Wire the FlutterFlow API Call**: Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

```
// FlutterFlow API Call
URL: https://realcomposer.com/v1/workspace/paddle-api-proxy-flutter
Header Authorization: Bearer rc_live_your_token
```

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Paddle api proxy for flutter mobile subscriptions",
  "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"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/paddle-api-proxy-flutter" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_paddle-a",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "paddle-api-proxy-flutter"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "subscriptionId": "sample",
  "status": "sample"
}
```

## FAQ

### Which Paddle credential belongs in the vault for this pipeline?

Log request IDs for paddle-api-proxy-flutter, not raw Paddle payloads, because upstream bodies may include PII.

### What cache key does RealComposer use?

paddle-api-proxy-flutter vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body.

### What happens if an upstream step times out?

Allowed origins on the paddle-api-proxy-flutter client token restrict which domains may call the edge URL.
