How do I create a label field that shows a warning or not?

I have an API that returns true or false based on if the id is associated with a course that has been billed.  I needed to create a API, because the billed value is in a  parent module.

How do a create a custom field that is a label that displays a warning message based on a true value?

Thank you