verifyPayment method
Implementation
Future<Transaction?> verifyPayment({
required String cardId,
required String otp,
required double amount,
required String token,
required String? baseUrl,
required String lang,
ValueSetter? onError,
}) async {
try {
return await ApiProvider.post(
auth: true,
apiURL: ApiRoutes.verifyPayment.path,
baseURL: baseUrl,
lang: lang,
data: {
'card_code': cardId,
'otp': otp,
'amount': amount,
'token': token,
}).catchError((error) {
if (onError != null) {
onError((error as ApiException).message);
}
}).then((response) {
if (response != null) {
return Transaction.fromJson(response['data']);
}
return null;
});
} catch (e) {
SnackBar(content: Text("Verify otp error: $e"));
return null;
}
}