stripe-ios
AGENTS.md2.6k starsChanged 58 days agoMITView on GitHub
This file provides guidance to LLM-based coding agents when working with code in this repository. The test runner (ci_scripts/run_tests.rb) handles simulator setup automatically. ci_scripts/setup_simulator.sh selects the runtime for the active Xcode version: iOS 16.4 through Xcode 26 and iOS 18.5 with Xcode 27 and later. Invoke ci_scripts/run_tests.rb directly as shown below. Do not prefix it with ruby or bundle exec; the runner has no bundled dependencies, and direct invocation lets agent environments grant it the simulator access it needs. If…
- Commits and pushes
Trending
Quiet this year.about the whole repository
Who's talking about stripe/stripe-ios
- stripe/stripe-android“Port Stripe-Android to Flutter”GitHub · Jan 31, 2019 · 85 reactions
- tipsi/tipsi-stripe“Stripe does not build in XCode 11.4”GitHub · Mar 24, 2020 · 13 reactions
- expo/expo“[expo-payments-stripe] Stripe pod does not compile on Xcode 11.4”GitHub · Apr 2, 2020 · 10 reactions
- stripe/stripe-react-native“isPlatformPaySupported for Apple Pay that doesn't consider supported card networks”GitHub · Mar 2, 2024 · 8 reactions
- stripe/stripe-android“[BUG] Wrong title "Front of identity card"”GitHub · May 22, 2024 · 5 reactions
The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 15
Talked about on GitHub, Hacker News and Bluesky (15 times).
On GitHub · 13
- Jan 31, 2019Port Stripe-Android to Flutter — stripe/stripe-android85 reactions · 26 comments
- Mar 24, 2020Stripe does not build in XCode 11.4 — tipsi/tipsi-stripe13 reactions · 17 comments
- Apr 2, 2020[expo-payments-stripe] Stripe pod does not compile on Xcode 11.4 — expo/expo10 reactions · 23 comments
- Mar 2, 2024isPlatformPaySupported for Apple Pay that doesn't consider supported card networks — stripe/stripe-react-native8 reactions · 5 comments
- May 22, 2024[BUG] Wrong title "Front of identity card" — stripe/stripe-android5 reactions · 13 comments
8 more on GitHub
- Sep 4, 2024Use the generic title "Front of identity document" instead of "Front of identity card" — stripe/stripe-android4 reactions · 4 comments
- May 25, 2020Incompatible pod versions in 8.0.0-beta.10 example — tipsi/tipsi-stripe4 reactions · 2 comments
- Aug 14, 2019How to use Payment Intent and Setup Intents with Stripe in iOS — onmyway133/blog3 reactions
- Dec 8, 2024ios: fix: initial error value for apple pay — capacitor-community/stripe2 reactions · 2 comments
- Sep 9, 2024[BUG] Preferred network for co-branded cards not working — stripe/stripe-android2 reactions · 5 comments
- Jan 23, 2023Start bitrise setup. — stripe/stripe-android2 reactions · 3 comments
- May 9, 2022Bug: SPM error: Tuist doesn't generate the derived file Bundle+StripeCore for Stripe dependency — tuist/tuist2 reactions · 12 comments
- Oct 28, 2021[Feature] Allow falling back to webview in 3d secure 2 flow — stripe/stripe-android2 reactions · 2 comments
On Hacker News · 1
- Feb 4, 2013Stripe's iOS Bindings2 points
On Bluesky · 1
- Dec 17, 2024今日のGitHubトレンド stripe/stripe-ios このリポジトリは、iOSアプリでStripeを使った決済機能を容易に実装するためのSDKを提供します。 クレジットカード情報などの機密データを安全に収集し、Apple… — @dailygithubtrends.bsky.social1 likes and repost
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
16 rules. About 0 are common, 7 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
If simulator setup reports CoreSimulatorService connection failures or permission errors under ~/Library/Logs/CoreSimulator, rerun the same …
- Very specific: line 70
When tests fail, the runner saves an xcresult bundle and prints an inspection hint.
- Very specific: line 77
Test summary with pass/fail/skip counts
- Very specific: line 82
For LLM agents: after a test failure, run --failures and view any exported screenshot paths.
- Distinctive: line 94
When you need raw xcodebuild commands, always source the simulator setup first and suppress warnings for test targets:
- Distinctive: line 108
If you need to run these checks manually:
- Distinctive: line 112
Do not write in code comments (such as file headers) that code was generated by an LLM.
- Very specific: line 114
Use stpAssert/stpAssertionFailure only for SDK-internal invariants that indicate a Stripe SDK bug or unreachable internal state, not for …
- Distinctive: line 117
Branch Requirements: If you are on the master branch, you MUST check out a new branch before making commits.
- Very specific: line 120
When using the GitHub gh command, ALWAYS set GH_HOST=github.com.
- Very specific: line 124
If no new test coverage was added, write No new tests.
- Distinctive: line 125
If new test coverage was added, describe each new test in plain, simple English.
- Distinctive: line 126
Don't use test commands or test names as the test description.
- Distinctive: line 129
If adding a new CHANGELOG entry, always put it in the "changes pending release" section.
- Very specific: line 177
When adding/rewriting tests, use // Given <setup> / // When <action> / // Then <assertion> comments where helpful.
- Very specific: line 180
Run bundle install && bundle exec fastlane stripeios_tests initially to install test dependencies.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LLM-CONTEXT.md
This file provides guidance to LLM-based coding agents when working with code in this repository.
Simulator Setup
The test runner (ci_scripts/run_tests.rb) handles simulator setup automatically. ci_scripts/setup_simulator.sh selects the runtime for the active Xcode version: iOS 16.4 through Xcode 26 and iOS 18.5 with Xcode 27 and later.
Invoke ci_scripts/run_tests.rb directly as shown below. Do not prefix it with ruby or bundle exec; the runner has no bundled dependencies, and direct invocation lets agent environments grant it the simulator access it needs.
If simulator setup reports CoreSimulatorService connection failures or permission errors under ~/Library/Logs/CoreSimulator, rerun the same direct command with permission to access CoreSimulator. These errors do not mean the requested runtime is missing.
If simulator issues occur, clear the cache and retry:
./ci_scripts/setup_simulator.sh --clear-cacheBuild Commands
Test Runner
ci_scripts/run_tests.rb is the primary way to run tests locally. It handles simulator setup, scheme resolution, and xcodebuild invocation.
# Run a single test (scheme is inferred from the target name)
ci_scripts/run_tests.rb --test StripeCoreTests/URLEncoderTest/testQueryStringFromParameters
# Run all tests for a specific scheme
ci_scripts/run_tests.rb --scheme StripePaymentSheet
# Run all framework tests
ci_scripts/run_tests.rb --all
# Record snapshot reference images and update if meaningfully different
ci_scripts/record_snapshots.rb
# Preview snapshot changes without updating reference images
ci_scripts/record_snapshots.rb --dry-run
# Record network responses (tests will fail during recording)
ci_scripts/run_tests.rb --record-network --test StripePaymentsTests/STPCardFunctionalTest
# Run UI tests
ci_scripts/run_tests.rb --ui
# Retry flaky tests (up to 5 times)
ci_scripts/run_tests.rb --scheme StripeCore --retry
# Preview the xcodebuild command without executing
ci_scripts/run_tests.rb --scheme StripeCore --dry-run
# Build without running tests
ci_scripts/run_tests.rb --scheme StripePaymentSheet --build-only
# Inspect failures from the last test run
ci_scripts/run_tests.rb --failures
# Inspect failures from a specific xcresult bundle
ci_scripts/run_tests.rb --failures /path/to/result.xcresult
# Use a custom result bundle path
ci_scripts/run_tests.rb --scheme StripeCore --result-bundle-path /tmp/my-results.xcresult
# Full usage
ci_scripts/run_tests.rb --helpInspecting Test Failures
When tests fail, the runner saves an xcresult bundle and prints an inspection hint. Use --failures to get a structured summary:
ci_scripts/run_tests.rb --failuresThis prints:
- Test summary with pass/fail/skip counts
- Failure messages for each failed test
- Re-run commands for each failed test
- Paths to exported failure screenshot attachments
For LLM agents: after a test failure, run --failures and view any exported screenshot paths. Analyzing the screenshots alongside the failure messages helps determine root cause (e.g. snapshot mismatches, unexpected UI state).
CI Commands (Fastlane)
These are used by CI and can also be run locally:
- Run main tests:
bundle exec fastlane stripeios_tests - Run StripeConnect tests:
bundle exec fastlane stripeconnect_tests - Run all integration tests:
bundle exec fastlane integration_all - Run 3DS2 tests:
bundle exec fastlane threeds2_tests
Manual xcodebuild
When you need raw xcodebuild commands, always source the simulator setup first and suppress warnings for test targets:
source ci_scripts/setup_simulator.sh && xcodebuild test \
-workspace Stripe.xcworkspace \
-scheme StripePaymentSheet \
-destination "id=$DEVICE_ID_FROM_USER_SETTINGS,arch=arm64" \
-quiet SWIFT_SUPPRESS_WARNINGS=YES SWIFT_TREAT_WARNINGS_AS_ERRORS=NOCode Quality
Code Formatting and Linting
The project has an automated hook (.claude/settings.json) that runs format and lint checks before every git commit or push. This ensures code quality standards are maintained automatically.
If you need to run these checks manually:
- Format modified files:
ci_scripts/format_modified_files.sh - Lint modified files:
ci_scripts/lint_modified_files.sh
Do not write in code comments (such as file headers) that code was generated by an LLM.
- Use
stpAssert/stpAssertionFailureonly for SDK-internal invariants that indicate a Stripe SDK bug or unreachable internal state, not for invalid merchant input, unsupported public configuration, or integration misuse. For merchant-facing issues, use Swiftassert/assertionFailureor return/throw the appropriate integration error. - The
STPSPI (@_spi(STP)) is used to expose APIs to other Stripe modules, never to external users of the SDK. Accordingly, treat@_spi(STP) publicAPIs as non-public for most intents and purposes.
Branch Requirements: If you are on the master branch, you MUST check out a new branch before making commits.
Filing PRs
When using the GitHub gh command, ALWAYS set GH_HOST=github.com. For example: GH_HOST=github.com gh pr create --title [...]
In the PR description's ## Testing section:
- If no new test coverage was added, write
No new tests. - If new test coverage was added, describe each new test in plain, simple English.
- Don't use test commands or test names as the test description.
Changelog Entries
If adding a new CHANGELOG entry, always put it in the "changes pending release" section.
Project Architecture
Module Structure
The Stripe iOS SDK is organized as a multi-module framework with clear dependency hierarchies:
Core Dependencies:
StripeCore- Foundational networking, utilities, analyticsStripeUICore- Shared UI components and themesStripe3DS2- 3D Secure 2.0 authentication
Payment Modules:
StripePayments- Core payment APIs (depends on StripeCore, Stripe3DS2)StripePaymentsUI- Payment UI components (depends on StripePayments, StripeUICore)StripePaymentSheet- Prebuilt payment flow (depends on StripePaymentsUI, StripeApplePay). (This is the main product we work on.)StripeApplePay- Apple Pay integration (depends on StripeCore)
Specialized Modules:
StripeIdentity- Identity verification (depends on StripeCore, StripeUICore, StripeCameraCore)StripeFinancialConnections- Bank account linking (depends on StripeCore, StripeUICore)StripeConnect- Connect embedded components (depends on StripeCore, StripeUICore, StripeFinancialConnections)StripeCardScan- Card scanning functionality (depends on StripeCore)
Legacy Stripe Module:
Stripe- Legacy umbrella framework including most modules plus additional issuing features.
Key Workspaces and Projects
- Main workspace:
Stripe.xcworkspace- Contains all modules and examples - Individual projects: Each module has its own
.xcodeproj - Test configurations: Located in
BuildConfigurations/directories
Package Manager Support
- Swift Package Manager: Defined in
Package.swiftwith iOS 13+ minimum deployment - CocoaPods: Individual
.podspecfiles for each module
Development Workflow
Requirements
- Xcode 15+ required
- iOS 13+ minimum deployment target
- Bundle/Fastlane for automation
Testing Strategy
- Comprehensive unit tests for each module in corresponding
*Tests/directories - Snapshot tests for UI components using FBSnapshotTestCase; always record to a temp dir, CI auto-commits meaningful changes via
ci_scripts/record_snapshots.rb - Integration tests with real backend APIs (marked as functional tests)
- Example apps for manual testing in
Example/directory - When adding/rewriting tests, use
// Given <setup>/// When <action>/// Then <assertion>comments where helpful. You may use// ...and <other setup/action/assertion>when a section of code is doing multiple things to avoid having a single comment explain too much code.
Dependencies Installation
Run bundle install && bundle exec fastlane stripeios_tests initially to install test dependencies.
Special Testing Notes
- Legacy iOS versions: Separate fastlane lanes for iOS 13-16 compatibility testing
Acronyms and Terms
- AP = Adaptive Pricing
- CS = Checkout Session (
CheckoutSession), the server-backed source of truth for checkout state, or Customer Session (CustomerSession), depending on context - Mobile Checkout Elements (also Checkout Elements) = the native Checkout Session integration for composing a checkout from Stripe Elements and merchant-owned UI
- Checkout SDK /
CheckoutController= the client-side coordinator that loads and observes a CS, serializes updates from the merchant and Elements, exposes session state, and confirms the checkout - ECE = Express Checkout Element, the element for one-click payment methods such as Apple Pay and Google Pay outside of Payment Element
- EPE = EmbeddedPaymentElement
- PE = Payment Element; in Checkout Elements, this is a single payment-method collection surface that can be embedded or presented as a sheet
- PS.FC = FlowController (PaymentSheet.FlowController)
- FC = FinancialConnections, or occasionally FlowController (see above)
- MPE = Mobile Payment Element, an umbrella term for EmbeddedPaymentElement, PaymentSheet, and FlowController
- AE = Address Element; SAE = Shipping Address Element
- CSE = Currency Selector Element, the Adaptive Pricing currency control
- SPM = Saved Payment Method
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

