{
  "slug": "combine-stripe-customer-and-invoices",
  "title": "Combine Stripe Customer and Invoices into Single REST Call",
  "metaTitle": "Combine Stripe Customer and - RealComposer",
  "metaDescription": "Combine stripe customer and invoices into single rest call. Merge Stripe in one Frontend / Web call with parallel Worker steps.",
  "headline": "One edge call merges Stripe for Frontend / Web",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 9,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Stripe"
  ],
  "searchIntentQuery": "combine stripe customer and invoices into single rest call",
  "directAnswerSummary": "To combine stripe customer and invoices into single rest call, configure parallel steps for Stripe. Frontend / Web performs one authorized GET/POST to RealComposer and receives a merged payload.",
  "problem": {
    "title": "Serial Stripe calls slow Frontend / Web pages",
    "explanation": "Each extra Stripe hop adds hundreds of milliseconds and another OAuth refresh path your UI must manage.",
    "risks": [
      "One slow upstream blocking an entire page",
      "Partial failures leaving UI in inconsistent states",
      "Duplicate auth refresh logic per service"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Store STRIPE_SECRET_KEY in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token."
    },
    {
      "stepNumber": 2,
      "title": "Target the real upstream URL",
      "description": "Point step customer at https://api.stripe.com/v1/customers/{{query.customerId}} 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 Frontend / Web",
      "description": "Allowed origins on the token should list every Frontend / Web host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/combine-stripe-customer-and-invoices', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Combine Stripe Customer and Invoices into Single REST Call",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "customer",
        "upstreamUrlTemplate": "https://api.stripe.com/v1/customers/{{query.customerId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.STRIPE_SECRET_KEY}}"
        },
        "timeoutMs": 3000
      },
      {
        "stepKey": "invoices",
        "upstreamUrlTemplate": "https://api.stripe.com/v1/invoices?customer={{query.customerId}}&limit=5",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.STRIPE_SECRET_KEY}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "customer.customerId",
          "sourcePath": "id",
          "type": "string",
          "sourceStep": "customer"
        },
        {
          "targetPath": "customer.email",
          "sourcePath": "email",
          "type": "string",
          "sourceStep": "customer"
        },
        {
          "targetPath": "invoices.customerId",
          "sourcePath": "id",
          "type": "string",
          "sourceStep": "invoices"
        },
        {
          "targetPath": "invoices.email",
          "sourcePath": "email",
          "type": "string",
          "sourceStep": "invoices"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_combine-",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "combine-stripe-customer-and-invoices"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "customer_customerId": "sample",
    "customer_email": "sample",
    "invoices_customerId": "sample",
    "invoices_email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/combine-stripe-customer-and-invoices\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Does Frontend / Web need CORS changes after adding RealComposer?",
      "answer": "Store STRIPE_SECRET_KEY for combine-stripe-customer-and-invoices. Frontend / Web never sees decrypted values."
    },
    {
      "question": "When does edge caching apply to this recipe?",
      "answer": "combine-stripe-customer-and-invoices forwards client JSON to POST upstreams unchanged; secrets interpolate only in URLs and header templates."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Upstream steps in combine-stripe-customer-and-invoices honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "flutterflow-multiple-apis-page-load",
    "hubspot-api-client-proxy",
    "api-composition-tool-low-code"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/combine-stripe-customer-and-invoices",
    "markdown": "https://realcomposer.com/recipes/combine-stripe-customer-and-invoices.md",
    "json": "https://realcomposer.com/recipes/combine-stripe-customer-and-invoices.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=combine-stripe-customer-and-invoices&via=agent"
  }
}