{
  "slug": "trim-stripe-json-for-mobile-apps",
  "title": "Stripe API Response Too Large: How to Trim JSON Fields for Mobile Apps",
  "metaTitle": "Trim Stripe JSON API Response for Mobile - RealComposer",
  "metaDescription": "Trim Stripe API responses for mobile apps. Strip unused JSON fields at the edge using RealComposer declarative slimmer, cutting payload size up to 94%.",
  "headline": "Cut 90% Bandwidth from Stripe Customer & Invoice Payloads",
  "category": "slimmer",
  "categoryLabel": "Payload Slimmer",
  "urgency": 9,
  "clientPlatform": "Flutter / React Native / Swift",
  "upstreamServices": [
    "Stripe"
  ],
  "searchIntentQuery": "stripe api response too large how to trim json fields for mobile",
  "directAnswerSummary": "Stripes Customer and Invoice objects return 50+ properties and thousands of bytes when mobile screens only need 3 or 4 fields. RealComposer declarative Payload Slimmer projects only the exact fields your app needs at the edge, cutting payload size by up to 94% and speeding up client parse times.",
  "problem": {
    "title": "Mobile JSON Serialization Bottlenecks",
    "explanation": "Parsing megabytes of unneeded JSON keys burns mobile battery, consumes user cellular data, and causes UI stutter on low-end mobile devices.",
    "risks": [
      "High mobile memory consumption and UI jank",
      "Wasted cellular bandwidth for end users",
      "Slow app startup times"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Connect Upstream Endpoint",
      "description": "Point to Stripe customer or invoice endpoint."
    },
    {
      "stepNumber": 2,
      "title": "Pick Fields with Tree Picker",
      "description": "Check only id, email, name, and balance."
    },
    {
      "stepNumber": 3,
      "title": "Receive Slimmed JSON",
      "description": "Mobile app downloads 200 bytes instead of 4KB."
    }
  ],
  "pipelineConfig": {
    "name": "Stripe Payload Slimmer",
    "method": "GET",
    "cacheTtlSeconds": 300,
    "steps": [
      {
        "stepKey": "stripe",
        "upstreamUrlTemplate": "https://api.stripe.com/v1/customers/{{query.id}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.STRIPE_SECRET_KEY}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "id",
          "sourceStep": "stripe",
          "sourcePath": "id"
        },
        {
          "targetPath": "email",
          "sourceStep": "stripe",
          "sourcePath": "email"
        },
        {
          "targetPath": "name",
          "sourceStep": "stripe",
          "sourcePath": "name"
        },
        {
          "targetPath": "balance",
          "sourceStep": "stripe",
          "sourcePath": "balance",
          "type": "number"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "id": "cus_123",
    "object": "customer",
    "balance": 0,
    "created": 1680000000,
    "currency": "usd",
    "email": "user@example.com",
    "name": "John Doe",
    "invoice_prefix": "ABC",
    "delinquent": false,
    "livemode": true,
    "metadata": {},
    "tax_exempt": "none",
    "preferred_locales": [
      "en-US"
    ]
  },
  "sampleSlimmedOutput": {
    "id": "cus_123",
    "email": "user@example.com",
    "name": "John Doe",
    "balance": 0
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/acme/slim-customer?id=cus_123\"",
  "faqs": [
    {
      "question": "How much bandwidth can this save?",
      "answer": "RealComposer typically cuts 85% to 94% of raw Stripe payload bytes."
    }
  ],
  "relatedRecipeSlugs": [
    "call-stripe-from-flutterflow-securely",
    "merge-supabase-and-stripe-into-single-endpoint"
  ],
  "links": {
    "page": "https://realcomposer.com/recipes/trim-stripe-json-for-mobile-apps",
    "markdown": "https://realcomposer.com/recipes/trim-stripe-json-for-mobile-apps.md",
    "json": "https://realcomposer.com/recipes/trim-stripe-json-for-mobile-apps.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=trim-stripe-json-for-mobile-apps&via=agent"
  }
}