stripe_platform_interface 패키지는 플러터 애플리케이션에서 Stripe SDK에 대한 플랫폼 간 호환성 인터페이스를 제공합니다. 개발자가 안드로이드, iOS, 웹, 맥OS, 리눅스, 윈도우용 플랫폼별 구현을 만들고 통합할 수 있게 하여, 다양한 플랫폼 간 일관된 동작을 보장합니다. 이 추상화 계층은 플러터 앱과 네이티브 Stripe 기능(결제 처리 및 카드 관리 등) 간의 원활한 통신을 가능하게 합니다. 핵심 로직을 플랫폼별 코드와 분리함으로써 유지보수 및 확장성이 뛰어난 결제 통합을 지원합니다.
사용 사례
크로스 플랫폼 플러터 앱에서 스타일 결제 통합
플랫폼별 스토어 기능 사용
사용자 정의 Stripe 플러그인 확장 빌드
통합 API를 사용한 다중 운영 체제 지원
모크 구현을 통한 테스트 촉진
주요 기능
플랫폼 간 관계 없는 설계
플랫폼 전용 코드를 위한 모듈러 아키텍처
모든 주요 데스크톱 및 모바일 플랫폼 지원
핵심 및 플랫폼 로직 간의 명확한 분리
사용자 정의 구현을 위한 확장 가능한 인터페이스
적합한 대상
이커머스 앱을 구축하는 플러터 개발자
다중 플랫폼 결제 지원이 필요한 팀
Stripe 기능을 확장하거나 사용자 지정하는 개발자
테스트 가능한 결제 로직이 필요한 프로젝트
다중 플랫폼에서 네이티브 Stripe 기능을 사용하는 앱
고려 사항
플랫폼별 구현을 위해 추가 설정이 필요합니다
완전한 기능을 사용하려면 flutter_stripe에 의존합니다
Stripe SDK 버전이 변경될 때 업데이트가 필요할 수 있습니다
스트라이프 전용 사용 사례에 한정
구체적인 구현 없이 직접 사용하기 위한 것이 아님
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Flutter Stripe
The Stripe Flutter SDK allows you to build delightful payment experiences in your native Android and iOS apps using Flutter. We provide powerful and customizable UI screens and elements that can be used out-of-the-box to collect your users' payment details.
Features
Simplified Security: We make it simple for you to collect sensitive data such as credit card numbers and remain PCI compliant. This means the sensitive data is sent directly to Stripe instead of passing through your server. For more information, see our Integration Security Guide.
Google Pay: The plugin can easily act as payment provider for the Pay plugin that enables you to seamlessly integrate Google Pay or Apple Pay. All you need to do is add your stripe publishable key to the payment profile.
Payment methods: Accepting more payment methods helps your business expand its global reach and improve checkout conversion.
Native UI: We provide native screens and elements to securely collect payment details on Android and iOS.
Pre-built payments UI: Learn how to integrate Payment Sheet, the new pre-built payments UI for mobile apps. This pre-built UI lets you accept cards, Apple Pay, and Google Pay out of the box, and includes support for saving & reusing cards.
Recommended usage
If you're selling digital products or services within your app, (e.g. subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use the app store's in-app purchase APIs. This does not apply to app developers in the USA as they are excluded by new court ruling in 2025. See Apple's and Google's guidelines for more information. For all other scenarios you can use this SDK to process payments via Stripe.
Installation
dart pub add flutter_stripe
Requirements
Android
This plugin requires several changes to be able to work on Android devices. Please make sure you follow all these steps:
Rebuild the app, as the above changes don't update with hot reload
These changes are needed because the Android Stripe SDK requires the use of the AppCompat theme for their UI components and the Support Fragment Manager for the Payment Sheets
If you are having troubles to make this package to work on Android, join this discussion to get some support.
iOS
Compatible with apps targeting iOS 13 or above.
To upgrade your iOS deployment target to 13.0, you can either do so in Xcode under your Build Settings, or by modifying IPHONEOS_DEPLOYMENT_TARGET in your project.pbxproj directly.
You will also need to update in your Podfile:
platform :ios, '13.0'
For card scanning add the following to your Info.plist:
<key>NSCameraUsageDescription</key><string>Scan your card to add it automatically</string><key>NSCameraUsageDescription</key><string>To scan cards</string>
Web
Now you can use Stripe with Flutter web! Notice right now it is highly experimental and only a subset of features is implemented. Namely:
Note: Stripe is sunsetting CardField and CardForm in favor of PaymentSheet. We recommend using PaymentSheet for all new integrations. See Stripe's documentation for more details.
We also support the Customer Sheet and the Address sheet mobile elements to collect and manage customer payment methods and addresses.
Financial connections
We also support Financial connections in our latest sdk. Check out the docs to learn more on how to set it up.
Deep linking & coexistence with other deep-link plugins
Redirect-based payment methods (Link, iDEAL, Bancontact, PayPal, etc.) send the user out to a browser and back to your app via a returnURL. On iOS, flutter_stripe registers an app- and scene-delegate and forwards incoming URLs to the Stripe SDK. For URLs that are not a pending Stripe redirect it returns false and does not consume them — it does not block app_links, uni_links, go_router, or any other URL handler.
If a deep-link plugin stops receiving links after adding flutter_stripe, it is almost always one of the following (none of which is flutter_stripe consuming the URL):
app_links version. On apps using UISceneDelegate (the Flutter default since 3.41), use app_links >= 7.0.0, which registers a scene delegate. Older versions only register an app delegate and never receive scene:openURLContexts:.
FlutterDeepLinkingEnabled. If it is true in Info.plist, Flutter's own router may handle the URL. Either set it to false, or forward only your Stripe URLs from your router/deep-link handler (see below) and let everything else flow to your routes.
Scheme/returnURL mismatch. Make sure CFBundleURLSchemes, Stripe.urlScheme, and your PaymentSheet returnURL all use the same scheme.
To complete a Stripe redirect while your app owns deep linking, forward matching URLs to Stripe.instance.handleURLCallback():
// e.g. from your app_links / go_router listenerif (uri.scheme == 'yourappscheme' && uri.host == 'safepay') {
awaitStripe.instance.handleURLCallback(uri.toString());
}
A full example (router-based, deep-link-package-based, and the FlutterDeepLinkingEnabled=false approach) is in example/lib/main.dart. See also Stripe.instance.handleURLCallback in the Dart API.
Stripe initialization
To initialize Stripe in your Flutter app, use the Stripe base class.
Stripe offers publishableKey, stripeAccountId, threeDSecureParams and merchantIdentifier. Only publishableKey is required.
Dart API
The library offers several methods to handle stripe related actions:
The example app offers examples on how to use these methods.
Pay Plugin support
flutter_stripe fully supports the Pay plugin from the Google Pay team. By including a few lines you can integrate Stripe as a payment processor for Google / Apple Pay:
Future<void> onGooglePayResult(paymentResult) async {
final response = awaitfetchPaymentIntentClientSecret();
final clientSecret = response['clientSecret'];
final token = paymentResult['paymentMethodData']['tokenizationData']['token'];
final tokenJson = Map.castFrom(json.decode(token));
final params = PaymentMethodParams.cardFromToken(
token: tokenJson['id'],
);
// Confirm Google pay payment methodawaitStripe.instance.confirmPayment(
clientSecret,
params,
);
}
Run the example app
Navigate to the example folder cd example
Install the dependencies
flutter pub get
Set up env vars for the flutter app and a local backend.