A Flutter plugin to integrate razorpay SDK for Android and iOS.
-
Android and iOS
- Credit Card, Netbanking Payment
- Wallet payment
- All supported payment options with your account
- Please note this is a plugin only. This plugin has used the Android SDK. Note: This plugin is still under development. Feedback and Pull Requests are most welcome!
To use this plugin :
- add the dependency to your pubspec.yaml file.
Add this in pubspec.yaml
flutter_razorpay_sdk: ^0.1.4
For iOS you will need to install the followings.
- Swift 4.2
- Xcode 10 or above
To call payment procedure:
import 'package:flutter_razorpay_sdk/flutter_razorpay_sdk.dart';
Future<Null> _showNativeView() async {
String apiKey = "API_KEY_HERE";
Map<String, String> notes = new Map();
notes.putIfAbsent('billing_address', () => "Somewhere on earth");
notes.putIfAbsent('shipping_address', () => "Somewhere near India");
Map<String, dynamic> options = new Map();
options.putIfAbsent("name", () => "Laptop");
options.putIfAbsent("image", () => "https://s3.amazonaws.com/rzp-mobile/images/rzp.png"); // optional arguement
options.putIfAbsent("description", () => "Testing razorpay transaction");
options.putIfAbsent("amount", () => "100");
options.putIfAbsent("email", () => "[email protected]");
options.putIfAbsent("contact", () => "+919825123456");
// additional notes support. https://docs.razorpay.com/docs/notes
options.putIfAbsent("notes", () => notes);
options.putIfAbsent("theme", () => "#4D68FF"); // optional arguement
options.putIfAbsent("api_key", () => apiKey);
Map<dynamic,dynamic> paymentResponse = new Map();
paymentResponse = await FlutterRazorpaySdk.openPaymentDialog(options);
print("response $paymentResponse");
}
Response :
{"code": 0, "message": "Payment Cancelled"}
or
{"code": 1, "message": "pay_BcbdhwtCmNX4ck"}
If payment is sucessfull message will contain the payment_id from razorpay.
If you found this plugin helpful and want to thank me, consider buying me a cup of ☕
Copyright 2018 seven-re.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.