# stripe/stripe-ios architecture

> Architecture diagram of the GitHub repository stripe/stripe-ios, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stripe/stripe-ios
- Repository: https://github.com/stripe/stripe-ios

## Overview

Stripe iOS SDK is a modular client library for collecting payment and identity data, invoking Stripe APIs, and presenting native authentication or connected-account flows. The primary payment path is an app embedding PaymentSheet (or custom UI), collecting details, then using StripePayments/StripeCore to communicate with Stripe and invoking authentication when required. README documents the broad capabilities; sampled source confirms selected internal behavior, but most module relationships are represented only at module level, not as verified call chains.

Main entry points: [`StripeCore/StripeCore/Source/API Bindings/STPAPIClient.swift`](https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/API%20Bindings/STPAPIClient.swift) (API client), [`StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet.swift`](https://github.com/stripe/stripe-ios/blob/master/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet.swift) (PaymentSheet), [`StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift`](https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift) (Document capture), [`StripeCameraCore/StripeCameraCore/Source/Coordinators/CameraSession.swift`](https://github.com/stripe/stripe-ios/blob/master/StripeCameraCore/StripeCameraCore/Source/Coordinators/CameraSession.swift) (Camera session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_payment_ui["Payment experiences"]
  node_payment_sheet["PaymentSheet<br/>[PaymentSheet.swift]"]
  node_flow_controller["Sheet flow controller"]
  node_payments_ui["Payment form UI"]
  node_link["Link"]
end

subgraph group_payment_runtime["Payments runtime"]
  node_payments_api["Payments API"]
  node_payment_method["Payment method model"]
  node_confirmation_auth["Intent authentication"]
  node_three_ds["3DS2 authentication"]
  node_apple_pay["Apple Pay"]
end

subgraph group_account_flows["Account experiences"]
  node_financial_connections["Financial Connections"]
  node_financial_web["Connections web flow"]
  node_connect["Connect components"]
  node_issuing["Issuing"]
end

subgraph group_identity_scan["Identity and scanning"]
  node_identity["Identity flow"]
  node_document_capture["Document capture"]
  node_document_upload["Document upload"]
  node_selfie_capture["Selfie capture"]
  node_scanner_output["Document scan output"]
  node_camera_session["Camera session"]
  node_card_scan["Card scanning<br/>[ScannedCard.swift]"]
end

subgraph group_shared_core["Shared SDK core"]
  node_stripe_api["API client<br/>[STPAPIClient.swift]"]
  node_api_config["API configuration<br/>[StripeAPI.swift]"]
  node_analytics["Analytics client"]
  node_json_decoder["JSON decoding"]
  node_ui_core["UI controls<br/>[Button.swift]"]
end

node_app(("Integrating app"))
node_stripe_external{{"Stripe services"}}
node_apple_services{{"Apple Pay services"}}

node_app -->|"presents"| node_payment_sheet
node_app -->|"builds custom UI"| node_payments_ui
node_app -->|"integrates"| node_apple_pay
node_payment_sheet -.->|"uses APIs"| node_stripe_api
node_flow_controller -.->|"coordinates"| node_payment_sheet
node_payment_sheet -.->|"offers"| node_link
node_payments_api -.->|"exposes"| node_payment_method
node_payments_api -.->|"uses client"| node_stripe_api
node_stripe_api -.->|"sends requests"| node_stripe_external
node_stripe_api -.->|"uses settings"| node_api_config
node_confirmation_auth -.->|"launches"| node_three_ds
node_apple_pay -->|"authorizes"| node_apple_services
node_financial_connections -.->|"uses API"| node_stripe_api
node_financial_connections -.->|"offers web flow"| node_financial_web
node_connect -.->|"loads components"| node_stripe_external
node_identity -.->|"coordinates capture"| node_document_capture
node_document_capture -->|"starts scanning"| node_camera_session
node_document_capture -.->|"processes frames"| node_scanner_output
node_document_capture -.->|"uploads images"| node_document_upload
node_identity -.->|"coordinates capture"| node_selfie_capture
node_selfie_capture -.->|"uses camera"| node_camera_session
node_card_scan -.->|"uses camera"| node_camera_session
node_ui_core -.->|"supports UI"| node_payment_sheet
node_analytics -->|"sends telemetry"| node_stripe_external
node_json_decoder -.->|"decodes responses"| node_stripe_api

click node_payment_sheet "https://github.com/stripe/stripe-ios/blob/master/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet.swift"
click node_flow_controller "https://github.com/stripe/stripe-ios/blob/master/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFlowController.swift"
click node_payments_ui "https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/StripePaymentsUI/Source"
click node_link "https://github.com/stripe/stripe-ios/blob/master/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Link/LinkController.swift"
click node_payments_api "https://github.com/stripe/stripe-ios/tree/master/StripePayments/StripePayments/Source/API%20Bindings"
click node_payment_method "https://github.com/stripe/stripe-ios/blob/master/StripePayments/StripePayments/Source/API%20Bindings/Models/PaymentMethods/STPPaymentMethod.swift"
click node_confirmation_auth "https://github.com/stripe/stripe-ios/blob/master/StripePayments/StripePayments/Source/Internal/IntentConfirmationChallengeViewController.swift"
click node_three_ds "https://github.com/stripe/stripe-ios/tree/master/Stripe3DS2/Stripe3DS2"
click node_apple_pay "https://github.com/stripe/stripe-ios/blob/master/Stripe/StripeiOS/Source/STPApplePayContextDelegate.swift"
click node_stripe_api "https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/API%20Bindings/STPAPIClient.swift"
click node_api_config "https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/API%20Bindings/StripeAPI.swift"
click node_analytics "https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/Analytics/STPAnalyticsClient.swift"
click node_json_decoder "https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/Coder/StripeJSONDecoder.swift"
click node_financial_connections "https://github.com/stripe/stripe-ios/blob/master/StripeFinancialConnections/StripeFinancialConnections/Source/Native/NativeFlowController.swift"
click node_financial_web "https://github.com/stripe/stripe-ios/blob/master/StripeFinancialConnections/StripeFinancialConnections/Source/Web/FinancialConnectionsWebFlowViewController.swift"
click node_connect "https://github.com/stripe/stripe-ios/blob/master/StripeConnect/StripeConnect/Source/Internal/Webview/ConnectComponentWebViewController.swift"
click node_issuing "https://github.com/stripe/stripe-ios/blob/master/StripeIssuing/StripeIssuing/Source/STPEphemeralKeyManager.swift"
click node_identity "https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/Coordinators/VerificationSheetFlowController.swift"
click node_document_capture "https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift"
click node_document_upload "https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentFileUploadViewController.swift"
click node_selfie_capture "https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/SelfieCaptureViewController.swift"
click node_scanner_output "https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/Coordinators/ImageScanner/DocumentScanner/DocumentScannerOutput.swift"
click node_camera_session "https://github.com/stripe/stripe-ios/blob/master/StripeCameraCore/StripeCameraCore/Source/Coordinators/CameraSession.swift"
click node_card_scan "https://github.com/stripe/stripe-ios/blob/master/StripeCardScan/StripeCardScan/Source/CardVerify/Card%20Image%20Verification/ScannedCard.swift"
click node_ui_core "https://github.com/stripe/stripe-ios/blob/master/StripeUICore/StripeUICore/Source/Controls/Button.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_payment_sheet,node_flow_controller,node_payments_ui,node_link toneBlue
class node_payments_api,node_payment_method,node_confirmation_auth,node_three_ds,node_apple_pay toneAmber
class node_financial_connections,node_financial_web,node_connect,node_issuing toneMint
class node_identity,node_document_capture,node_document_upload,node_selfie_capture,node_scanner_output,node_camera_session,node_card_scan toneRose
class node_stripe_api,node_api_config,node_analytics,node_json_decoder,node_ui_core,node_app,node_stripe_external,node_apple_services toneIndigo
```

## Components

### Payment experiences

- [PaymentSheet](https://github.com/stripe/stripe-ios/blob/master/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet.swift): `StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheet.swift`
- [Sheet flow controller](https://github.com/stripe/stripe-ios/blob/master/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFlowController.swift): `StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFlowController.swift`
- [Payment form UI](https://github.com/stripe/stripe-ios/tree/master/StripePaymentsUI/StripePaymentsUI/Source): `StripePaymentsUI/StripePaymentsUI/Source`
- [Link](https://github.com/stripe/stripe-ios/blob/master/StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Link/LinkController.swift): `StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/Link/LinkController.swift`

### Payments runtime

- [Payments API](https://github.com/stripe/stripe-ios/tree/master/StripePayments/StripePayments/Source/API%20Bindings): `StripePayments/StripePayments/Source/API Bindings`
- [Payment method model](https://github.com/stripe/stripe-ios/blob/master/StripePayments/StripePayments/Source/API%20Bindings/Models/PaymentMethods/STPPaymentMethod.swift): `StripePayments/StripePayments/Source/API Bindings/Models/PaymentMethods/STPPaymentMethod.swift`
- [Intent authentication](https://github.com/stripe/stripe-ios/blob/master/StripePayments/StripePayments/Source/Internal/IntentConfirmationChallengeViewController.swift): `StripePayments/StripePayments/Source/Internal/IntentConfirmationChallengeViewController.swift`
- [3DS2 authentication](https://github.com/stripe/stripe-ios/tree/master/Stripe3DS2/Stripe3DS2): `Stripe3DS2/Stripe3DS2`
- [Apple Pay](https://github.com/stripe/stripe-ios/blob/master/Stripe/StripeiOS/Source/STPApplePayContextDelegate.swift): `Stripe/StripeiOS/Source/STPApplePayContextDelegate.swift`

### Account experiences

- [Financial Connections](https://github.com/stripe/stripe-ios/blob/master/StripeFinancialConnections/StripeFinancialConnections/Source/Native/NativeFlowController.swift): `StripeFinancialConnections/StripeFinancialConnections/Source/Native/NativeFlowController.swift`
- [Connections web flow](https://github.com/stripe/stripe-ios/blob/master/StripeFinancialConnections/StripeFinancialConnections/Source/Web/FinancialConnectionsWebFlowViewController.swift): `StripeFinancialConnections/StripeFinancialConnections/Source/Web/FinancialConnectionsWebFlowViewController.swift`
- [Connect components](https://github.com/stripe/stripe-ios/blob/master/StripeConnect/StripeConnect/Source/Internal/Webview/ConnectComponentWebViewController.swift): `StripeConnect/StripeConnect/Source/Internal/Webview/ConnectComponentWebViewController.swift`
- [Issuing](https://github.com/stripe/stripe-ios/blob/master/StripeIssuing/StripeIssuing/Source/STPEphemeralKeyManager.swift): `StripeIssuing/StripeIssuing/Source/STPEphemeralKeyManager.swift`

### Identity and scanning

- [Identity flow](https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/Coordinators/VerificationSheetFlowController.swift): `StripeIdentity/StripeIdentity/Source/NativeComponents/Coordinators/VerificationSheetFlowController.swift`
- [Document capture](https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift): `StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift`
- [Document upload](https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentFileUploadViewController.swift): `StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentFileUploadViewController.swift`
- [Selfie capture](https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/SelfieCaptureViewController.swift): `StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/SelfieCaptureViewController.swift`
- [Document scan output](https://github.com/stripe/stripe-ios/blob/master/StripeIdentity/StripeIdentity/Source/NativeComponents/Coordinators/ImageScanner/DocumentScanner/DocumentScannerOutput.swift): `StripeIdentity/StripeIdentity/Source/NativeComponents/Coordinators/ImageScanner/DocumentScanner/DocumentScannerOutput.swift`
- [Camera session](https://github.com/stripe/stripe-ios/blob/master/StripeCameraCore/StripeCameraCore/Source/Coordinators/CameraSession.swift): `StripeCameraCore/StripeCameraCore/Source/Coordinators/CameraSession.swift`
- [Card scanning](https://github.com/stripe/stripe-ios/blob/master/StripeCardScan/StripeCardScan/Source/CardVerify/Card%20Image%20Verification/ScannedCard.swift): `StripeCardScan/StripeCardScan/Source/CardVerify/Card Image Verification/ScannedCard.swift`

### Shared SDK core

- [API client](https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/API%20Bindings/STPAPIClient.swift): `StripeCore/StripeCore/Source/API Bindings/STPAPIClient.swift`
- [API configuration](https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/API%20Bindings/StripeAPI.swift): `StripeCore/StripeCore/Source/API Bindings/StripeAPI.swift`
- [Analytics client](https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/Analytics/STPAnalyticsClient.swift): `StripeCore/StripeCore/Source/Analytics/STPAnalyticsClient.swift`
- [JSON decoding](https://github.com/stripe/stripe-ios/blob/master/StripeCore/StripeCore/Source/Coder/StripeJSONDecoder.swift): `StripeCore/StripeCore/Source/Coder/StripeJSONDecoder.swift`
- [UI controls](https://github.com/stripe/stripe-ios/blob/master/StripeUICore/StripeUICore/Source/Controls/Button.swift): `StripeUICore/StripeUICore/Source/Controls/Button.swift`

### Other components

- **Integrating app**
- **Stripe services**
- **Apple Pay services**

## Connections

- Integrating app → PaymentSheet: presents (evidence: `README.md`)
- Integrating app → Payment form UI: builds custom UI (evidence: `README.md`)
- Integrating app → Apple Pay: integrates (evidence: `README.md`)
- PaymentSheet → API client: uses APIs
- Sheet flow controller → PaymentSheet: coordinates (evidence: `StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentSheetFlowController.swift`)
- PaymentSheet → Link: offers
- Payments API → Payment method model: exposes
- Payments API → API client: uses client
- API client → Stripe services: sends requests
- API client → API configuration: uses settings (evidence: `StripeCore/StripeCore/Source/API Bindings/STPAPIClient.swift`)
- Intent authentication → 3DS2 authentication: launches
- Apple Pay → Apple Pay services: authorizes (evidence: `README.md`)
- Financial Connections → API client: uses API
- Financial Connections → Connections web flow: offers web flow
- Connect components → Stripe services: loads components
- Identity flow → Document capture: coordinates capture
- Document capture → Camera session: starts scanning (evidence: `StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift`)
- Document capture → Document scan output: processes frames (evidence: `StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift`)
- Document capture → Document upload: uploads images (evidence: `StripeIdentity/StripeIdentity/Source/NativeComponents/ViewControllers/DocumentCaptureViewController.swift`)
- Identity flow → Selfie capture: coordinates capture
- Selfie capture → Camera session: uses camera
- Card scanning → Camera session: uses camera
- UI controls → PaymentSheet: supports UI
- Analytics client → Stripe services: sends telemetry (evidence: `StripeCore/StripeCore/Source/Analytics/STPAnalyticsClient.swift`)
- JSON decoding → API client: decodes responses (evidence: `StripeCore/StripeCore/Source/API Bindings/STPAPIClient.swift`)
