sbiepay_flutter_sdk Integration Guide
This guide outlines the different methods to integrate the sbiepay_flutter_sdk package into your Flutter project.
Requirements
- SDK Download: Download the latest Flutter SDK from pub.dev.
- Development Environment: Use dart SDK version >=3.5.3 up to <4.0.0 and Flutter version >=3.3.0
- Network Requirements: Ensure the device can access the internet for API communication.
- Android Support: API level from 28 (Android 9) to 36
- iOS Support: Minimum iOS 13.0+
- Supported Payment Methods: Ensure the payment methods offered by the aggregator (credit card, debit card, UPI, etc.) match your requirements.
Installation
Add the dependency to your pubspec.yaml:
dependencies:
sbiepay_flutter_sdk: ^1.0.0
Then run:
flutter pub get
Only For IOS: Install Pods.
For the SDK to work in Flutter iOS, navigate to the ios/ directory via terminal using cd ios command.
Then run:
pod install
Ensure that your Info.plist includes the necessary permissions for internet and networking.
Usage example:
- Import the SDK in your Dart file:
import 'package:sbiepay_flutter_sdk/sbiepay_flutter_sdk.dart';
-
Call your APIs to generate final url for payment.
-
Create transactionCheckout instance:
final transactionCheckout = TransactionCheckout();
- Call below method which is override from SDK.
transactionCheckout.initiateTransaction(
context: context,
paymentUrl: paymentUrl,
referrer: referrer,
transactionResultListener: TransactionResultListener(
onSuccess: (response) => handleTransactionSuccess(response),
onPending: (response) => handleTransactionPending(response),
onError: (response) => handleTransactionError(response),
onFailed: (response) => handleTransactionFailed(response),
onCancelled: (response) =>
handleTransactionCancelled(response),
onTimeOut: (response) => handleTransactionTimeOut(response),
));
- Handle Transaction Responses Implement appropriate handlers for each transaction status:
void handleTransactionSuccess(dynamic response) {
// Handle successful transaction
}
void handleTransactionPending(dynamic response) {
// Handle pending transaction
}
void handleTransactionError(dynamic response) {
// Handle transaction error
}
void handleTransactionFailed(dynamic response) {
// Handle failed transaction
}
void handleTransactionCancelled(dynamic response) {
// Handle cancelled transaction
}
void handleTransactionTimeOut(dynamic response) {
// Handle transaction timeout
}
Libraries
- plugin/epay_method_channel
- plugin/epay_platform
- plugin/epay_platform_interface
- sbiepay_flutter_sdk
- Encapsulates the plugin classes within the ePay library and controls their visibility. Allowed files exports specific classes and models that are accessible to the merchant app, allowing them to interact with the ePay SDK and handle transactions, results, and responses.