{
  "slug": "stripe-proxy-react-native",
  "title": "How to Call Stripe API from React Native Without Leaking Secret Key",
  "metaTitle": "Call Stripe from React Native Securely - RealComposer",
  "metaDescription": "Call Stripe from React Native without leaking secret keys. RealComposer stores secrets server-side on Cloudflare Workers and returns slimmed responses.",
  "headline": "Zero-Backend Stripe Proxy for React Native & Expo Mobile Apps",
  "category": "security",
  "categoryLabel": "Security & Secret Vault",
  "urgency": 10,
  "clientPlatform": "React Native / Expo",
  "upstreamServices": [
    "Stripe"
  ],
  "searchIntentQuery": "call stripe api from react native without leaking secret key",
  "directAnswerSummary": "React Native APK and IPA bundles can be disassembled with standard decompilers, exposing hardcoded environment variables. Use RealComposer to store your Stripe Secret Key server-side on Cloudflare Workers and return only safe, slimmed responses to your mobile app.",
  "problem": {
    "title": "Decompiled Mobile Bundles Reveal All Constants",
    "explanation": "React Native javascript bundles (index.android.bundle) are plain text inside mobile installation packages.",
    "risks": [
      "Plaintext key extraction from mobile APKs",
      "Fraudulent charge generation",
      "Compromised customer data"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store Secret in Vault",
      "description": "Encrypted with AES-256-GCM in RealComposer."
    },
    {
      "stepNumber": 2,
      "title": "Call from Expo / React Native",
      "description": "Fetch edge endpoint with public bearer token."
    }
  ],
  "pipelineConfig": {
    "name": "React Native Stripe Proxy",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "steps": [
      {
        "stepKey": "sub",
        "upstreamUrlTemplate": "https://api.stripe.com/v1/subscriptions/{{query.subId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.STRIPE_SECRET_KEY}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "id",
          "sourceStep": "sub",
          "sourcePath": "id"
        },
        {
          "targetPath": "status",
          "sourceStep": "sub",
          "sourcePath": "status"
        },
        {
          "targetPath": "currentPeriodEnd",
          "sourceStep": "sub",
          "sourcePath": "current_period_end",
          "type": "number"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "id": "sub_123",
    "status": "active",
    "current_period_end": 1712000000,
    "plan": {}
  },
  "sampleSlimmedOutput": {
    "id": "sub_123",
    "status": "active",
    "currentPeriodEnd": 1712000000
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/acme/sub-status?subId=sub_123\"",
  "faqs": [
    {
      "question": "Is Hermes byte-code decompilation safe?",
      "answer": "No, Hermes bytecode can be easily decompiled to extract string literals."
    }
  ],
  "relatedRecipeSlugs": [
    "call-stripe-from-flutterflow-securely",
    "trim-stripe-json-for-mobile-apps"
  ],
  "links": {
    "page": "https://realcomposer.com/recipes/stripe-proxy-react-native",
    "markdown": "https://realcomposer.com/recipes/stripe-proxy-react-native.md",
    "json": "https://realcomposer.com/recipes/stripe-proxy-react-native.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=stripe-proxy-react-native&via=agent"
  }
}