{
  "slug": "stitch-hubspot-contact-with-stripe-history",
  "title": "Stitch Hubspot Contact with Stripe Payment History",
  "metaTitle": "Stitch Hubspot Contact with Stripe - RealComposer",
  "metaDescription": "Stitch hubspot contact with stripe payment history. Merge Stripe and HubSpot in one Frontend / Web call with parallel Worker steps.",
  "headline": "Parallel Stripe fetch merged before Frontend / Web hydrates",
  "category": "aggregation",
  "categoryLabel": "Multi-API Aggregation",
  "urgency": 9,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "Stripe",
    "HubSpot"
  ],
  "searchIntentQuery": "stitch hubspot contact with stripe payment history",
  "directAnswerSummary": "Instead of Frontend / Web firing serial fetches to Stripe and HubSpot, one pipeline hits https://api.hubapi.com/crm/v3/objects/contacts/{{query.contactId}} (and sibling steps) in parallel and returns mapped JSON.",
  "problem": {
    "title": "Waterfall latency from multiple Stripe and HubSpot requests",
    "explanation": "Frontend / Web widgets often await Stripe and HubSpot sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.",
    "risks": [
      "Race conditions between parallel manual fetches",
      "Higher mobile data usage from redundant JSON",
      "Timeouts when any upstream exceeds cellular RTT"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Add vault secrets for this pipeline",
      "description": "Store STRIPE_SECRET_KEY, HUBSPOT_ACCESS_TOKEN in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "Configure headersTemplate to inject vault secrets, target https://api.hubapi.com/crm/v3/objects/contacts/{{query.contactId}}, and Add output mapping fields that mirror the JSON contract your screen already expects."
    },
    {
      "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/stitch-hubspot-contact-with-stripe-history', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Stitch Hubspot Contact with Stripe Payment History",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "hubspot",
        "upstreamUrlTemplate": "https://api.hubapi.com/crm/v3/objects/contacts/{{query.contactId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.HUBSPOT_ACCESS_TOKEN}}"
        },
        "timeoutMs": 3000
      },
      {
        "stepKey": "stripe",
        "upstreamUrlTemplate": "https://api.stripe.com/v1/charges?customer={{query.stripeCustomerId}}&limit=5",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.STRIPE_SECRET_KEY}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "hubspot.contactId",
          "sourcePath": "id",
          "type": "string",
          "sourceStep": "hubspot"
        },
        {
          "targetPath": "hubspot.email",
          "sourcePath": "properties.email",
          "type": "string",
          "sourceStep": "hubspot"
        },
        {
          "targetPath": "stripe.customerId",
          "sourcePath": "id",
          "type": "string",
          "sourceStep": "stripe"
        },
        {
          "targetPath": "stripe.email",
          "sourcePath": "email",
          "type": "string",
          "sourceStep": "stripe"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_stitch-h",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "stitch-hubspot-contact-with-stripe-history"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "hubspot_contactId": "sample",
    "hubspot_email": "sample",
    "stripe_customerId": "sample",
    "stripe_email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/stitch-hubspot-contact-with-stripe-history\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "What should Frontend / Web store instead of Stripe secrets?",
      "answer": "Log request IDs for stitch-hubspot-contact-with-stripe-history, not raw Stripe payloads, because upstream bodies may include PII."
    },
    {
      "question": "How do I forward JSON bodies to POST upstreams?",
      "answer": "stitch-hubspot-contact-with-stripe-history vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body."
    },
    {
      "question": "How do I rotate upstream credentials?",
      "answer": "Upstream steps in stitch-hubspot-contact-with-stripe-history honor timeoutMs and optional fallback JSON without leaking secrets."
    }
  ],
  "relatedRecipeSlugs": [
    "merge-airtable-and-shopify",
    "mobile-friendly-api-from-legacy-rest",
    "reduce-json-size-flutter-app"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/stitch-hubspot-contact-with-stripe-history",
    "markdown": "https://realcomposer.com/recipes/stitch-hubspot-contact-with-stripe-history.md",
    "json": "https://realcomposer.com/recipes/stitch-hubspot-contact-with-stripe-history.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=stitch-hubspot-contact-with-stripe-history&via=agent"
  }
}