title: Prestashop 1.7 DisplayPaymentByBinaries hook for paymentmodule
body: <p>I am creating a paymentmodule for Prestashop 1.7 and i'm trying to use the hook DisplayPaymentByBinaries because i can't use the submit button.</p>
  
  <p>underneath you will find my code:</p>
  
  <pre><code>    public function hookDisplayPaymentByBinaries()
  {
      if (!Currency::exists('EUR', 0))
      {
          return  '&lt;p class="payment_module" style="color:red;"&gt;' .
          $this-&gt;l('Payment Methods are only available when Euros are activated.') .
          '&lt;/p&gt;';
      }
      $issuer_setting = $this-&gt;getConfigValue('MY_ISSUERS');
  
      try {
  
          $methods = $this-&gt;api-&gt;methods-&gt;all();
          $issuer_list = in_array($issuer_setting, array(self::ISSUERS_ALWAYS_VISIBLE, self::ISSUERS_ON_CLICK)) ? $this-&gt;_getIssuerList() : array();
      } catch (MY_API_Exception $e) {
          $methods = array();
          $issuer_list = array();
  
          if ($this-&gt;getConfigValue('MY_DEBUG_LOG') == self::DEBUG_LOG_ERRORS)
          {
              Logger::addLog(__METHOD__ . ' said: ' . $e-&gt;getMessage(), My::ERROR);
          }
          if ($this-&gt;getConfigValue('MY_DISPLAY_ERRORS'))
          {
              return
                  '&lt;p class="payment_module" style="color:red;"&gt;' .
                  $e-&gt;getMessage() .
                  '&lt;/p&gt;'
                  ;
          }
      }
      $this-&gt;setBinary = true;
      $this-&gt;smarty-&gt;assign(array(
              'methods'        =&gt; $methods,
              'issuers'        =&gt; $issuer_list,
              'issuer_setting' =&gt; $issuer_setting,
              'images'         =&gt; $this-&gt;getConfigValue('MY_IMAGES'),
              'warning'        =&gt; $this-&gt;warning,
              'msg_pay_with'   =&gt; $this-&gt;lang['Pay with %s'],
              'msg_bankselect' =&gt; $this-&gt;lang['Select your bank:'],
              'module'         =&gt; $this,
          ));
  
      return $this-&gt;display(__FILE__, 'my_methods.tpl');
  }
  </code></pre>
  
  <h2>As described by prestashop:</h2>
  
  <p>As you may read it above, you must not have a submit button into your module’s HTML code, because PrestaShop will automatically generate it. If you can’t remove the submit button from the form for some reasons (e.g.: the form is generated by binaries), we have implemented another way to make your module PrestaShp 1.7 compatible. But, note that this is NOT the recommended way to do it.</p>
  
  <p>To do this, you’ll need to implement a supplementary hook: displayPaymentByBinaries. It’s made to display the payment form, and it will replace the unique payment button in the checkout.</p>
  
  <h2>You’ll also need to set the $binary variable to true. It will adapt the behavior to hide the payment button and replace it by the form when the payment option is selected.</h2>
  
  <p>I have implemented my code and my payment options are showing, but the submit button is still there. As you can see in my function, i used:</p>
  
  <pre><code>$this-&gt;setBinary = true;
  </code></pre>
  
  <p>in the header of the file i have added:</p>
  
  <pre><code>use PrestaShop\PrestaShop\Core\Payment\PaymentOption;
  </code></pre>
  
  <p>The setBinary function which im calling (from the paymentoption file):</p>
  
  <pre><code>public function setBinary($binary)
  {
      $this-&gt;binary = $binary;
      return $this;
  }
  </code></pre>
  
  <p>Can someone please help me out on what i'm doing wrong here? In other words, what do i have to alter to remove the submit button?</p>
  
  <p>Thank you all beforehand.</p>
  
  <hr>
  
  <p>Underneath is my working awnser thanks to <a href="https://stackoverflow.com/users/179545/unloco">@UnLoCo</a>.</p>
  
  <pre><code>    public function hookPaymentOptions($params)
  {
      if (!Currency::exists('EUR', 0))
      {
          return;
      }
  
      try {
          $methods = $this-&gt;api-&gt;methods-&gt;all();
      } catch (My_API_Exception $e) {
          $methods = array();
  
          if ($this-&gt;getConfigValue('My_DEBUG_LOG') == self::DEBUG_LOG_ERRORS)
          {
              Logger::addLog(__METHOD__ . ' said: ' . $e-&gt;getMessage(), My::ERROR);
          }
  
          return;
      }
  
  
      $payment_options = array();
      foreach($methods as $method)
      {
          $newOption = new PaymentOption();
          $newOption-&gt;setBinary(true);
  
          $payment_options[] = $newOption;
      }
  
      return $payment_options;
  }
  </code></pre>