PlatformPaymentException.cancelled constructor

PlatformPaymentException.cancelled({
  1. required PlatformPaymentType type,
  2. String? transactionId,
  3. Object? cause,
  4. StackTrace? stack,
  5. Map<String, dynamic> metadata = const {},
})

Convenience constructor for user-cancelled payment attempts.

Implementation

factory PlatformPaymentException.cancelled({
  required PlatformPaymentType type,
  String? transactionId,
  Object? cause,
  StackTrace? stack,
  Map<String, dynamic> metadata = const {},
}) {
  return PlatformPaymentException(
    type: type,
    errorCode: 'payment_cancelled',
    userMessage: 'Payment was cancelled.',
    devMessage: '${type.displayName} payment cancelled by user.',
    transactionId: transactionId,
    cause: cause,
    stack: stack,
    isReportable: false,
    metadata: metadata,
  );
}