pay method
Implementation
@override
Future<StonePaymentResponse> pay({required StonePaymentPayload paymentPayload}) async {
try {
final response = await methodChannel.invokeMethod<Map>('pay', paymentPayload.toJson());
if (response is Map) {
if (response['code'] == StoneStatusDeeplink.SUCCESS.name && response['data'] is Map) {
final jsonData = response['data'];
return StonePaymentResponse.fromJson(jsonData);
} else {
throw StonePaymentException(message: response['message']);
}
} else {
throw StonePaymentException(message: 'invalid response');
}
} on StonePaymentException catch (e) {
throw StonePaymentException(message: e.message);
} on PlatformException catch (e) {
throw StonePaymentException(message: e.message ?? 'PlatformException');
} catch (e) {
throw StonePaymentException(message: "Pay Error: $e");
}
}