Callback URL in WordPress

That’s pretty simple, just use your website home url 🙂

After that, just fire an action when the page is loaded via POST HTTP method and hook with a callback.

add_action( 'wp_loaded', function() {
   if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
      // fire the custom action
      do_action('onchangeapi', new PostListener($_POST));
   }
} );

And now the listener class

class PostListener {

   private $valid = false;

   /**
    * @param array $postdata $_POST array
    */
   public function __construct(array $postdata) {
       $this->valid = $this->validatePostData($postdata);
   }

   /**
    * Runs on 'onchangeapi' action
    */
   public function __invoke() {
      if ($this->valid) {
          // do whatever you need to do 
          exit();
      }
   }

   /**
    * @param array $postdata $_POST array
    * @return bool
    */
   private function validatePostData(array $postdata) {
      // check here the $_POST data, e.g. if the post data actually comes
      // from the api, autentication and so on
   } 
}