title: Handle POST Requests through Wordpress
body: <p>I am trying to integrate TrialPay with Wordpress. TrialPay can send me either a POST or GET Request, and I have to receive it. When I send the response, there can be no HTML, only a "1" in the response.</p>
  
  <p>I have tried a rewrite endpoint from some code someone gave me, but in the response the whole home page HTML is included.</p>
  
  <pre><code>  function wpd_trialpay_endpoint(){
          add_rewrite_endpoint( 'trialpay', EP_PAGES );
     }
    add_action( 'init', 'wpd_trialpay_endpoint' );
  
     function wpd_trialpay_parse( $request ){
  if( array_key_exists( 'trialpay', $request-&gt;query_vars ) ){
      $toaward = $_GET['reward_amount'];
      $user = $_GET['sid'];
  
      if (mycred_add('Points_for_TrialPay_Offer', 1, 1, '%plural% for TrialPay offer completion', $_POST['oid'] )) {
          echo "1";
          //header("HTTP/1.1 200 OK");
   } else {
          echo "Fail!";
          //header("HTTP/1.1 412 Precondition Failed");
      }
      die;
    }
  }
   add_action( 'parse_request', 'wpd_trialpay_parse' );
  </code></pre>
  
  <p>Is this the right way to do this? When I navigate to mysite.com/offer/trialpay (/offer is a blank page), the page outputs a "1" like intended. When I test the page with a POST request, it returns the whole front page HTML. What am I missing?</p>