# How to Connect Stripe to Retool Securely

> Fix "how to connect stripe to retool securely" by pointing Retool at RealComposer. Vault secrets authenticate https://api.stripe.com/v1/customers/{{query.customerId}}; client tokens gate your public URL.

- Canonical page: https://realcomposer.com/recipes/connect-stripe-to-retool-securely
- Client platform: Retool
- Upstream services: Stripe
- Category: Platforms & Frameworks
- JSON version: https://realcomposer.com/recipes/connect-stripe-to-retool-securely.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=connect-stripe-to-retool-securely&via=agent

## Problem: CORS blocks Stripe in Retool

Low-code Retool tools expose connector tokens in shared workspaces, so Stripe credentials leak to every editor.

- Browser console CORS errors blocking launches
- Editors pasting secrets into reusable components
- Inability to test locally without disabling security

## Solution steps

1. **Store upstream credentials in Secret Vault**: Create STRIPE_SECRET_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.

2. **Configure upstream steps and output mapping**: Use GET against https://api.stripe.com/v1/customers/{{query.customerId}}. 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. **Query from Retool**: Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.

```
// REST resource or JS query
const rows = await fetch('https://realcomposer.com/v1/workspace/connect-stripe-to-retool-securely', {
  headers: { Authorization: 'Bearer rc_live_token' }
}).then(r => r.json());
```

## 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": "How to Connect Stripe to Retool Securely",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "stripe",
      "upstreamUrlTemplate": "https://api.stripe.com/v1/customers/{{query.customerId}}",
      "httpMethod": "GET",
      "headersTemplate": {
        "Authorization": "Bearer {{secrets.STRIPE_SECRET_KEY}}"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "customerId",
        "sourcePath": "id",
        "type": "string",
        "sourceStep": "stripe"
      },
      {
        "targetPath": "email",
        "sourcePath": "email",
        "type": "string",
        "sourceStep": "stripe"
      },
      {
        "targetPath": "name",
        "sourcePath": "name",
        "type": "string",
        "sourceStep": "stripe"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/connect-stripe-to-retool-securely" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_connect-",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "connect-stripe-to-retool-securely"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "customerId": "sample",
  "email": "sample",
  "name": "sample"
}
```

## FAQ

### Can Retool call Stripe without holding the production key?

Use scoped tokens where the vendor allows them on connect-stripe-to-retool-securely. Admin keys stay {{secrets.*}} references only.

### How do I forward JSON bodies to POST upstreams?

connect-stripe-to-retool-securely POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

### How do I rotate upstream credentials?

Upstream steps in connect-stripe-to-retool-securely honor timeoutMs and optional fallback JSON without leaking secrets.
