Introduction
Integrating secure, PCI-compliant payments is crucial for any Flutter app that charges users for goods or services. With Flutter Stripe payments you gain access to a mature payments platform and a well-maintained SDK. In this tutorial, we’ll walk through setting up Stripe in Flutter, creating payment intents on your backend, and handling payment confirmations in your client. By the end, you’ll have a streamlined Flutter payment integration with Stripe ready for production.
Setting up Stripe in Flutter
Add dependencies
In your pubspec.yaml, include the official Stripe SDK and HTTP client:
dependencies:
flutter_stripe: ^10.0.0
http
Initialize Stripe
Initialize the Stripe SDK early in your app (for example in main.dart) with your publishable key:
import 'package:flutter_stripe/flutter_stripe.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
Stripe.publishableKey = 'pk_test_XXXXXXXXXXXXXXXXXXXXXXXX';
runApp(MyApp());
}Configure platform settings
iOS: Add necessary entries to Info.plist for ATS and merchant IDs.
Android: Ensure AndroidManifest.xml has Internet permission and your application ID matches Stripe’s configuration.
Implementing Payment Intents
Flutter Stripe payments relies on Payment Intents for handling complex flows—authentication, SCA (Strong Customer Authentication), and more.
Create a Payment Intent on your backend
Use your preferred server language. Example in Node.js or Python:
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
app.post('/create-payment-intent', async (req, res) => {
const { amount, currency } = req.body;
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
automatic_payment_methods: { enabled: true },
});
res.json({ clientSecret: paymentIntent.client_secret });
});Fetch client secret in Flutter
import 'package:http/http.dart' as http;
import 'dart:convert';
Future<String> fetchClientSecret(int amount) async {
final response = await http.post(
Uri.parse('https://your-server.com/create-payment-intent'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({'amount': amount, 'currency': 'usd'}),
);
return jsonDecode(response.body)['clientSecret'];
}Handling Payment Confirmation
Once you have the client secret, build a payment sheet to collect user card details and confirm the transaction.
Initialize the payment sheet
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret: clientSecret,
merchantDisplayName: 'Your Store',
),
);Present and confirm the sheet
try {
await Stripe.instance.presentPaymentSheet();
print('Payment successful!');
} catch (e) {
print('Error: $e');
}Error handling and post-payment logic
Catch StripeException for user-cancelled flows or authentication failures.
Update UI and your backend on payment success or failure for order fulfillment or retries.
Customizing the Payment UI
Beyond the default payment sheet, you can embed individual components:
CardField for card entry
PaymentMethodParams.card() for custom confirm calls
Example:
CardField(
onCardChanged: (card) {
setState(() => _card = card);
},
),
ElevatedButton(
onPressed: () async {
if (_card?.complete ?? false) {
final pm = await Stripe.instance.createPaymentMethod(
PaymentMethodParams.card(),
);
}
},
child: Text('Pay'),
),This gives you full control over layout and user experience during checkout.
Vibe Studio

For rapid prototyping or no-code teams, consider Vibe Studio, powered by Steve’s advanced AI agents. Vibe Studio is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
You’ve now integrated Flutter Stripe payments end to end: initializing the SDK, creating and fetching Payment Intents, and handling confirmation with the payment sheet or custom UI. This setup supports SCA, 3DS, and future payment methods as Stripe releases them.