{
  "slug": "stripe-customer-sessions-query-entitlements-and-open-customer-portal-47269324db93",
  "title": "Stripe Customer Sessions query entitlements and open customer portal",
  "tools": [
    "stripe"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-08-26T00:00:00.000Z",
  "announced_at": "2026-08-26T00:00:00.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "For subscription access and billing management in an iOS app, create a Customer Session for the authenticated user with `active_entitlements` and/or `customer_portal` enabled. Return its `client_secret` to the app, then use BillingSDK to check entitlements or present the portal.",
    "examples": [
      "const customerSession = await stripe.customerSessions.create({ customer: \"<stripe_customer_id>\", components: { active_entitlements: { enabled: true }, customer_portal: { enabled: true } } });\nres.json({ clientSecret: customerSession.client_secret });",
      "let entitlements = try await BillingManager.shared.billing.getActiveEntitlements(forceRefresh: true)",
      "let portal = try await BillingManager.shared.billing.getCustomerPortal()\nportal.presentCustomerPortal(from: self)"
    ],
    "gotchas": [
      "customer (required): Stripe Customer ID for the authenticated user.",
      "components.active_entitlements.enabled: Set to `true` to enable active entitlement retrieval for the Customer Session.",
      "components.customer_portal.enabled: Set to `true` to enable customer portal access for the Customer Session.",
      "components.active_entitlements: Enables the active entitlements component; can be enabled together with `customer_portal`.",
      "components.customer_portal: Enables the customer portal component; can be enabled together with `active_entitlements`.",
      "client_secret (required): Customer Session secret returned by the server and used by the client SDK to authenticate.",
      "forceRefresh: When true, forces an entitlement refresh to obtain the latest data from the server.",
      "Prerequisite: Use Stripe API version `2026-08-26.dahlia` or later for the iOS BillingSDK flow.",
      "Prerequisite: Provide a backend server to create Customer Sessions; the iOS guide also requires iOS 15+, macOS 12+, and Xcode 15+.",
      "Prerequisite: The customer portal requires an active authenticated session.",
      "These components don't change the behavior of the Payment Element."
    ]
  },
  "why_it_matters": "When implementing subscription access and billing management in an application, enable the relevant Customer Session components and use the session client secret in the client.",
  "sources": [
    "https://docs.stripe.com/changelog/dahlia/2026-08-26/customer-session-improvements",
    "https://docs.stripe.com/billing/subscriptions/manage-ios"
  ],
  "rank": 0.9704,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave1b-tools-20261017",
    "verdict_id": "wave1b-tools-20261017:wave1b-tools-20261017-f0c9ca074704dc2e-0:gate",
    "evidence_hash": "622b39242eb76ec73255ebe564c6dabf8982b8d422566184bb713830652777b3"
  },
  "review": {
    "draft_hash": "e348687f37a65ce3c09f34458c08e8b8936e5a6d06166e07a9796e8b1b9709c4",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave1b-tools-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.97 >= 0.9; 2 needed) and Jev gave 0.74 (>= 0.6 needed)."
  }
}
