PaymentErrorCallback typedef

PaymentErrorCallback = void Function(PaymentException errorMessage)

Callback invoked when an error occurs during the payment process.

This callback receives a PaymentException containing details about the error:

Example:

void onPaymentError(PaymentException error) {
  switch (error.errorType) {
    case PaymentErrorType.network:
      showNetworkErrorDialog(error.message);
      break;
    case PaymentErrorType.invalidOrderId:
      showInvalidOrderDialog(error.message);
      break;
    default:
      showGenericErrorDialog(error.message);
  }
}

Implementation

typedef PaymentErrorCallback = void Function(PaymentException errorMessage);