startCheckout method

  1. @override
Future<bool> startCheckout({
  1. required Map<String, dynamic> configurations,
  2. dynamic onClose()?,
  3. dynamic onReady()?,
  4. dynamic onSuccess(
    1. String
    )?,
  5. dynamic onError(
    1. String
    )?,
  6. dynamic onCancel()?,
})
override

Start the checkout process with configurations and callbacks

Implementation

@override
Future<bool> startCheckout({
  required Map<String, dynamic> configurations,
  Function()? onClose,
  Function()? onReady,
  Function(String)? onSuccess,
  Function(String)? onError,
  Function()? onCancel,
}) async {
  _onClose = onClose;
  _onReady = onReady;
  _onSuccess = onSuccess;
  _onError = onError;
  _onCancel = onCancel;

  try {
    final result = await methodChannel.invokeMethod<bool>('startCheckout', {
      'configurations': configurations,
    });
    return result ?? false;
  } catch (e) {
    print('Error starting checkout: $e');
    return false;
  }
}