Package selection guidance compiled from public package information, community data, and project usage.
Razorpay Flutter is a plugin that integrates the Razorpay payment gateway into Flutter applications, enabling seamless in-app payments for Android and iOS. It provides a native-like checkout experience with support for cards, UPI, net banking, wallets, and more. The plugin simplifies payment processing by handling secure transactions and offering customizable UI components. Developers can easily implement payment flows with minimal setup using straightforward APIs.
Use cases
In-app purchases
E-commerce platforms
Subscription billing
Event ticketing
Digital service payments
Key features
Secure payment processing
Customizable checkout UI
Support for multiple payment methods
Real-time transaction status updates
Easy integration with Flutter apps
Suitable for
Mobile e-commerce apps
SaaS platforms
Event management apps
Freemium app monetization
Online course platforms
Considerations
Requires valid Razorpay API keys
Needs proper error handling for failed transactions
Should comply with local payment regulations
Testing in sandbox mode before production
Regular SDK updates for security patches
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
This flutter plugin is a wrapper around our Android and iOS SDKs.
The following documentation is only focused on the wrapper around our native Android and iOS SDKs. To know more about our SDKs and how to link them within the projects, refer to the following documentation:
Sign up for a Razorpay Account and generate the API Keys from the Razorpay Dashboard. Using the Test keys helps simulate a sandbox environment. No actual monetary transaction happens when using the Test keys. Use Live keys once you have thoroughly tested the application and are ready to go live.
void_handlePaymentSuccess(PaymentSuccessResponse response) {
// Do something when payment succeeds
}
void_handlePaymentError(PaymentFailureResponse response) {
// Do something when payment fails
}
void_handleExternalWallet(ExternalWalletResponse response) {
// Do something when an external wallet was selected
}
To clear event listeners, use the clear method on the Razorpay instance.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
Set config.build_settings['ENABLE_BITCODE'] = 'YES'.
Setting Swift version
Add the following line below config.build_settings['ENABLE_BITCODE'] = 'YES':
config.build_settings['SWIFT_VERSION'] = '5.0'
CocoaPods could not find compatible versions for pod "razorpay_flutter" when running pod install
Specs satisfying the `razorpay_flutter (from
`.symlinks/plugins/razorpay_flutter/ios`)` dependency were found, but they
required a higher minimum deployment target.
This is due to your minimum deployment target being less than iOS 10.0. To change this, open ios/Podfile in your project and add/uncomment this line at the top:
# platform :ios, '9.0'
and change it to
platform :ios, '10.0'
and run pod install again in the ios directory.
iOS build fails with 'razorpay_flutter/razorpay_flutter-Swift.h' file not found
Add use_frameworks! in ios/Podfile and run pod install again in the ios directory.
Gradle build fails with Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:razorpay_flutter]
This is due to your Android minimum SDK version being less than 19. To change this, open android/app/build.gradle, find minSdkVersion in defaultConfig and set it to at least 19.
A lot of errors saying xxxx is not defined for the class 'Razorpay'
We export a class Razorpay from package:razorpay_flutter/razorpay_flutter.dart. Check if your code is redeclaring the Razorpay class.
Type 'xxxx' is not a subtype of type 'xxxx' of 'response' in Razorpay.on.<anonymous closure>
[VERBOSE-2:ui_dart_state.cc(148)] UnhandledException: type 'PaymentFailureResponse'is not a subtype of type 'PaymentSuccessResponse' of 'response'
#0Razorpay.on.<anonymous closure> (package:razorpay_flutter/razorpay_flutter.dart:87:14)
#1EventEmitter.emit.<anonymous closure> (package:eventify/src/event_emitter.dart:94:14)
#2List.forEach (dart:core-patch/growable_array.dart:278:8)
#3EventEmitter.emit (package:eventify/src/event_emitter.dart:90:15)
#4Razorpay._handleResult (package:razorpay_flutter/razorpay_flutter.dart:81:19)
#5Razorpay.open (package:razorpay_flutter/razorpay_flutter.dart:49:5)
Class Registrar not found
Please update to version 1.4.0 to fix this issue.
Check the signatures of the callbacks for payment events. They should match the ones described here.
API
Razorpay
open(map<String, dynamic> options)
Open Razorpay Checkout.
The options map has key as a required property. All other properties are optional.
For a complete list of options, please see the Checkout documentation.
on(String eventName, Function listener)
Register event listeners for payment events.
eventName: The name of the event.
listener: The function to be called. The listener should accept a single argument of the following type: