title: WHMCS Action Hook Not Passing $vars
body: <p>According to the <code>WHMCS</code> documentation, the action hook 'AddInvoicePayment' should pass the $vars variable with <code>$vars['invoiceid']</code> being equal to whatever invoice just received a payment.</p>
  
  <p>However, it appears my action hook is not receiving anything in the <code>$vars</code> variable. I've included my code below:</p>
  
  <pre><code>add_hook('AddInvoicePayment', 5, function($vars) {
  // $vars['invoiceid'] is the only var passed into this hook.
  
  // 1. Get the invoice information from WHMCS
  function get_invoice_info($invoice_id) {
      //Define the paramaters
      $command = 'GetInvoice';
      $values = array(
          'invoiceid' =&gt; $invoice_id
      );
      $adminUsername = 'admin';
  
      // Call the Local API
      $invoice_info = localAPI($command, $values, $adminUsername);
  
      // Make it an object
      return json_decode($invoice_info);
  }
  
  // 2. Get the Client email from WHMCS
  function get_client_email($client_id) {
      //Define the paramaters
      $command = 'GetClientsDetails';
      $values = array(
          'clientid' =&gt; $client_id,
          'stats' =&gt; false,
      );
      $adminUsername = 'admin';
  
      // Call the local API
      $client_info = localAPI($command, $values, $adminUsername);
  
      //Make it pretty
      $client_array = json_decode($client_info, true);
      return $client_array['client[email]'];
  }
  
  // 3. Create LeadDyno Purchase
  function create_leaddyno_purchase($vars){
      $invoiceinfo = get_invoice_info($vars['invoiceid']);
      $clientemail = get_client_email($invoiceinfo-&gt;userid);
  
      // Gather all the info for the curl request
      $url = 'https://api.leaddyno.com/v1/purchases';
      $req = '&amp;email=' . $clientemail;
      $req .= '&amp;purchase_amount=' . $invoiceinfo-&gt;total;
  
      // Actually make the curl request
      make_curl_request( $url, $req );
  }
  
  // 4. Get the Client info from WHMCS
  function get_client_info($client_id) {
      //Define the paramaters
      $command = 'GetClientsDetails';
      $values = array(
          'clientid' =&gt; $client_id,
          'stats' =&gt; false,
      );
      $adminUsername = 'admin';
  
      // Call the local API
      $client_info = localAPI($command, $values, $adminUsername);
  
      //Make it pretty
      $client_array = json_decode($client_info, true);
  
      return $client_array;
  }
  
  // 5. Create a LeadDyno affiliate. If they already exists, it ignores our request
  function create_a_leaddyno_affiliate($vars){
      $clientinfo = get_client_info(get_invoice_info($vars['invoiceid'])-&gt;userid);
  
      // Gather the children for the trip
      $url = 'https://api.leaddyno.com/v1/affiliates';
      $req = '&amp;email=' . urlencode($clientinfo['client[email]']);
      $req .= '&amp;first_name=' . $clientinfo['client[firstname]'];
      $req .= '&amp;last_name=' . $clientinfo['client[lastname]'];
  
      // Send the children on the trip
      make_curl_request( $url, $req );
  }
  create_leaddyno_purchase($vars);
  create_a_leaddyno_affiliate($vars);
  });
  </code></pre>