startPayment method
Future<bool>
startPayment({
- required FawryLaunchModel launchModel,
- required String baseURL,
- required String lang,
override
Initiates the Fawry payment process.
Implementation
@override
Future<bool> startPayment({
required FawryLaunchModel launchModel,
required String baseURL,
required String lang,
}) async {
try {
if (!baseURL.endsWith("/")) {
baseURL = "$baseURL/";
debugPrint("Fixed Invalid URL");
}
return await FawrySdkPlatformInterface.instance.startPayment(
launchModel: launchModel,
baseURL: baseURL,
lang: lang,
);
} on PlatformException catch (e) {
if (e.code == _CODE_PAYMENT_FAILED) {
throw "Payment Failed: $_CODE_PAYMENT_FAILED. Message: ${e.message}.";
}
throw "Unknown Error: Error -> ${e.message}";
} catch (e) {
throw "Error Occurred: Message: $e";
}
}