Razorpay Payment Gateway Integration in Flutter (with Blup)

Introduction to Razorpay and Flutter Integration
As the mobile app market grows exponentially, enabling seamless digital payments has become one of the most important features of any app. Users expect to complete purchases, subscriptions, and donations without friction, and developers must meet those expectations. A single failed transaction or clunky payment experience can result in lost revenue and negative reviews. This is especially true in markets like India, where UPI, wallets, and debit card payments are widespread.
Integrating a payment gateway like Razorpay into your Flutter app means you can offer your users fast, reliable, and secure payment options with minimal effort. Razorpay supports everything from credit/debit cards to UPI, net banking, and wallets like Paytm. Combined with Flutter’s cross-platform development capabilities, this makes for an ideal tech stack for developers building apps for the Indian market. This step-by-step guide will show you how to set up Razorpay in your Flutter project, whether you're using full code or Blup’s low-code interface.
Why Choose Razorpay for Flutter Apps?
Razorpay is India’s leading developer-first payment gateway, offering modern APIs, extensive documentation, and excellent performance. It supports over 100 payment modes, including UPI, cards, net banking, wallets, EMI, and buy-now-pay-later solutions. Razorpay also provides secure fraud detection mechanisms and PCI DSS Level 1 compliance.
Flutter developers benefit from a well-maintained SDK—razorpay_flutter—that works natively on both Android and iOS. You can create and manage Razorpay Orders, listen to payment callbacks, handle external wallets, and use prefill options with ease. Whether you're creating a small MVP or scaling to a large production app, Razorpay grows with you.
Its test environment allows you to simulate real transactions without affecting your billing, making development and QA simple and safe. Razorpay also integrates with backend stacks like Node.js, Firebase, Django, and more. And if you're building apps using Blup’s low-code interface, Razorpay can still be used via custom code modules.
Setting Permissions and Preparing Dependencies
Installing Razorpay Flutter Plugin
Initializing Razorpay in Your App
Attaching Event Listeners
Attaching Event Listeners to Handle Payment Flow
You must define handlers to track payment success, failure, and wallet selections:
Define these callback functions and clean up on widget disposal:
This ensures memory safety and complete event tracking.
Creating a Razorpay Order on the Server
Before starting a transaction, create an order on your backend server using Razorpay’s REST API:
Body example:
You’ll get an order_id which is required in your app’s checkout process.
Adding Razorpay Checkout Options in Flutter
Prepare your payment config with details like API key, amount, and the order_id:
This configuration feeds Razorpay’s UI with dynamic data.
Opening the Razorpay Checkout Interface
Now, invoke Razorpay’s payment window using:
Bind this to a CTA button:
Verifying Payment
Final Checklist Before Going Live
Pro Tips:
Do not store API keys in your frontend code
Use
Razorpay Orders APIto generate dynamic order IDsSet a timeout or loading screen during the payment flow
Using Razorpay with Blup:
Add a custom code block and paste
openCheckout()Bind input fields (email, amount, phone) to dynamic UI
Use State Manager to reflect payment status and errors
🙋♂️ FAQs (20 Developer Questions)
Is Razorpay free to test? Yes, the sandbox mode is free.
Does it work on both Android & iOS? Yes.
What’s the minimum SDK version? Android: 19+, iOS: iOS 10+
What is Razorpay’s currency format? Amount is in paise (₹100 = 10000).
Do I need a backend for the order ID? Yes, for verified payments.
What is a payment signature? A hash used to validate transactions.
Can I integrate with Firebase? Yes.
Is it compatible with Blup? 100% via Custom Code Blocks.
Can I store user payment data? You can store IDs, but not sensitive data.
Can I integrate subscriptions? Yes, via Razorpay’s subscriptions API.
Does it support EMI & wallets? Yes.
Can I test failed transactions? Yes, Razorpay simulates failures.
Is server-side required? For secure apps, yes.
Does Razorpay send a webhook? Yes, optional for live event tracking.
What if payment is incomplete? Capture error and notify user.
Can I open the checkout twice? Yes, with new
order_id.How do I refund a payment? Use the Razorpay dashboard or APIs.
Can I use biometric login post-payment? Yes, independently.
Does Razorpay support custom branding? Limited via their SDK.
Where can I get support? Visit razorpay.com/support
Blup + Razorpay = fast, secure, and scalable app payments in Flutter.
Now you're fully equipped to accept payments in any app you're building, with clear guidance, tested flows, and room to scale. Happy building! 🚀
Table of content


