payment_gateway_demo 0.0.9
payment_gateway_demo: ^0.0.9 copied to clipboard
A payment gateway demo by Konze.
Payment Gateway Package for Flutter #
A payment gateway package for Flutter
Stripe Integration Steps #
Getting Started #
return StripePaymentPackagePage(
jsonData,
onCallBack: (value) {
if (value is PaymentIntent) {
PaymentIntent paymentIntent = value;
debugPrint('value ==>> ${paymentIntent.amount}');
if (paymentIntent.status ==
PaymentIntentsStatus.Succeeded) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text(
'Success!: The payment was confirmed successfully, Thank You.'),
),
);
}
} else {
debugPrint('value ==>> $value');
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Error: $value')));
}
}
);
Installation #
flutter pub add payment_gateway_demo
Requirements #
Android
This plugin requires several changes to be able to work on Android devices. Please make sure you follow all these steps:
- Use Android 5.0 (API level 21) and above
- Use Kotlin version 1.5.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/ .gradle#L2)
- Using a descendant of
Theme.AppCompatfor your activity: example, example night theme - Using an up-to-date Android gradle build tools version: example and an up-to-date gradle version accordingly: example
- Using
FlutterFragmentActivityinstead ofFlutterActivityinMainActivity.kt: example - 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 12 or above.
To upgrade your iOS deployment target to 12.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, '12.0'
CashFree Integration Steps #
Getting Started #
CFPaymentPackagePage cfPaymentPackagePage = CFPaymentPackagePage();
String getRandomNo() {
var rng = Random();
return 'order ${rng.nextInt(1000000)}';
}
String envType = "TEST";
String requestId = getRandomNo();
String orderAmount = "1";
String? tokenData = "";
String customerName = "Arjun";
String orderNote = "Order Note";
String orderCurrency = "INR";
String appId = envType == "TEST"
? "1831dac3fd47d13be98b7fd11381"
: "1848d0ce8441fb8ffa258bc98481";
String customerPhone = "9012341234";
String customerEmail = "sample@gmail.com";
String notifyUrl = "https://test.gocashfree.com/notify";
tokenData = "GET YOUR OWN TOKEN";
CFPaymentOrder cfPaymentOrder = cfPaymentPackagePage.initPaymentData(
requestId,
orderAmount,
tokenData,
customerName,
orderNote,
orderCurrency,
customerPhone,
customerEmail,
notifyUrl,
appId,
envType,
);
cfPaymentPackagePage.doPayment(
context,
cfPaymentOrder.toMap(),
callback: (value) {
if (value is CFResponse) {
CFResponse response = value;
//Todo: CFResponse will provide you the result like payment status, message and payment details.
}
},
);