Stop form submission and return error message


How can I stop sending the form and registering the entry based on the gform_after_submission function?

I comment, at the time of sending Send I have to send the information by API to another server and depending on the result you should or not send the email and register the entry.

Thank you.

It sounds similar to the discussion here: