Stripe Customer Sessions query entitlements and open customer portal
Introduced 2026-08-26 · score 0.97
HOW TO USE IT
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.
const customerSession = await stripe.customerSessions.create({ customer: "<stripe_customer_id>", components: { active_entitlements: { enabled: true }, customer_portal: { enabled: true } } });
res.json({ clientSecret: customerSession.client_secret });let entitlements = try await BillingManager.shared.billing.getActiveEntitlements(forceRefresh: true)let portal = try await BillingManager.shared.billing.getCustomerPortal()
portal.presentCustomerPortal(from: self)WHY THIS HELPS
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.
REQUIREMENTS AND LIMITATIONS
- 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.
FIRST-PARTY EVIDENCE
- https://docs.stripe.com/changelog/dahlia/2026-08-26/customer-session-improvements
- https://docs.stripe.com/billing/subscriptions/manage-ios
Check the installed version and the source before using it. Entry JSON