Elementor form and Tera wallet: Display an error message if the balance is insufficient

In my WordPress website, I’m using WooCommerce and Tera Wallet plugins. An Elementor form debits the customer wallet based on the option they choose. I would like to display an error message when the customer balance is insufficient.

Screenshots:

enter image description here

enter image description here

  • Small – 1000 Words. (0.80$)|0.80
  • Medium – 2000 Words. (0.90$)|0.90
  • Large – 3000 Words. (1.00$)|1.00

Current code that makes the discount in the user’s Tera wallet:

add_action( 'elementor_pro/forms/new_record', function( $record, $handler ) {
    // Nome do formulário (configure no Elementor, aba Avançado > Nome do formulário)
    $form_name = $record->get_form_settings( 'form_name' );
    if ( 'artigo_saldo' !== $form_name ) {
        return; // Evita interferir em outros formulários
    }

    // Captura os campos do formulário
    $fields = $record->get( 'fields' );

    // Verifica se o campo saldo_artigo foi preenchido
    if ( empty( $fields['saldo_artigo']['value'] ) ) {
        return;
    }

    // Converte o valor para float
    $valor = floatval( $fields['saldo_artigo']['value'] );

    // Pega o usuário logado
    $user_id = get_current_user_id();

    if ( $user_id && $valor > 0 ) {
        $descricao = 'Débito automático após envio do formulário de artigo';

        // Realiza o débito da carteira
        woo_wallet()->wallet->debit( $user_id, $valor, $descricao );
    }

}, 10, 2 );