This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
yarn typescript- Type-check TypeScript filesyarn lint- Lint code with ESLintyarn lint --fix- Fix linting issues automaticallyyarn test- Run Jest unit testsyarn prepare- Build the library (runsbob build && husky)
yarn bootstrap- Setup project by installing dependencies and CocoaPodsyarn bootstrap-no-pods- Setup without installing CocoaPodsyarn pods- Install CocoaPods for iOS (example app)yarn update-pods- Update specific Stripe pod dependencies
- Setup:
yarn bootstrap - Run Example App (requires 2 terminals):
- Terminal 1:
yarn example start - Terminal 2:
yarn example iosORyarn example android
- Terminal 1:
The example app uses a pre-configured demo backend, so no server setup is required.
yarn example start- Start Metro serveryarn run-example-ios- Run iOS example app on iPhone 16 simulatoryarn run-example-android- Run Android example appyarn run-example-ios:release- Build and run iOS app in release modeyarn run-example-android:release- Build and run Android app in release mode
yarn test:e2e:ios- Run all iOS E2E tests using Maestroyarn test:e2e:android- Run all Android E2E tests using Maestroyarn test-ios ./path/to/test.yml- Run single iOS E2E testyarn test-android ./path/to/test.yml- Run single Android E2E testyarn test:unit:ios- Run iOS native unit tests via Xcodeyarn test:unit:android- Run Android unit tests
yarn docs- Generate API documentation using TypeDoc
Follow conventional commits:
fix:- Bug fixesfeat:- New featuresrefactor:- Code refactoringdocs:- Documentation changestest:- Test additions/updateschore:- Tooling changes
This is the official Stripe React Native SDK, providing payment processing capabilities for mobile apps.
-
src/- Main TypeScript source codecomponents/- React Native components (CardField, PaymentSheet, etc.)hooks/- React hooks for payment functionalitytypes/- TypeScript type definitionsspecs/- Native module specifications for code generationfunctions.ts- Core payment functionsindex.tsx- Main exports
-
ios/- Native iOS implementation in Swift/Objective-C- Uses Stripe iOS SDK (~24.16.1)
- Supports both Old and New Architecture (Fabric)
- Test files in
ios/Tests/
-
android/- Native Android implementation in Kotlin/Java- Uses Stripe Android SDK
- Gradle build configuration
-
example/- Example React Native app demonstrating SDK usage- Contains test server in
server/directory - Configured for both iOS and Android development
- Contains test server in
-
e2e-tests/- End-to-end tests using Maestro framework- Platform-specific tests in
ios-only/andandroid-only/ - Tests payment flows, UI components, and integrations
- Platform-specific tests in
The SDK uses React Native's TurboModules/Fabric for native communication:
- Specs defined in
src/specs/generate native interfaces - Both Old and New Architecture supported
- Special patch for Old Architecture compatibility in
patches/old-arch-codegen-fix.patch
- React Native Builder Bob - Builds CommonJS, ES modules, and TypeScript declarations
- CocoaPods - iOS dependency management
- Gradle - Android build system
- Expo Plugin -
src/plugin/withStripe.tsfor Expo integration
- StripeProvider - Context provider for SDK initialization
- PaymentSheet - Pre-built payment UI
- CardField/CardForm - Card input components
- PlatformPayButton - Apple Pay/Google Pay integration
- CustomerSheet - Customer payment method management
- AddressSheet - Address collection component
- Jest - Unit tests for TypeScript code
- Maestro - E2E testing framework for mobile flows
- Native Tests - iOS XCTest and Android instrumentation tests
- Mock implementation provided in
jest/mock.js
- iOS: Requires Xcode 14.1+, iOS 13+ deployment target
- Android: Requires API 21+, compileSdkVersion 34, Kotlin 2.x
- React Native: Compatible with 0.78+, TypeScript 5.7+
- Expo: Supported via plugin configuration
- iOS Native: Open
example/ios/StripeSdkExample.xcworkspacein Xcode- Source files:
Pods > Development Pods > stripe-react-native
- Source files:
- Android Native: Open
example/androidin Android Studio- Source files:
reactnativestripesdkunderAndroid
- Source files:
- TypeScript: Edit files in
src/andexample/
GH_HOST=github.com gh issue list --repo stripe/stripe-react-native --limit 20- List recent issuesGH_HOST=github.com gh issue view <issue_number> --repo stripe/stripe-react-native- View specific issueGH_HOST=github.com gh issue view <issue_number> --repo stripe/stripe-react-native --comments- View issue with commentsGH_HOST=github.com gh issue list --repo stripe/stripe-react-native --state all --search "keyword" --limit 30- Search ALL issues (open/closed) by keywordGH_HOST=github.com gh issue create --repo stripe/stripe-react-native- Create new issueGH_HOST=github.com gh issue edit <issue_number> --repo stripe/stripe-react-native- Edit issueGH_HOST=github.com gh pr create --repo stripe/stripe-react-native- Create pull request- Always use
--state allwhen searching to include closed/resolved issues - Always check GitHub issues for similar problems before investigating user reports
- Use GitHub CLI to distinguish between SDK bugs vs integration issues
When using the GitHub gh command, ALWAYS set GH_HOST=github.com. For example: GH_HOST=github.com gh pr create --title [...]
The SDK maintains compatibility with React Native's Old Architecture via patches/old-arch-codegen-fix.patch. This patch converts EventEmitter properties to callback functions for code generation compatibility with RN ≥ 0.74.