Answers.Body: <p>Nevermind, I did not understand that Mollie is an off-site implementation. So the checkout just redirects you to the Mollie environment. If you want to implement on-site payments using Mollie you'd have to write your own logic I presume.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-06T11:54:33.867Z
Answers.LastActivityDate: 2016-12-06T11:54:33.867Z
Answers.UserDisplayName: Floriskoch
Body: <p>I'm working on a webshop that should have an integration with Mollie to provide the payment methods. Craft Commerce's docs mention that Mollie is already integrated by using the Omnipay interface.</p>
  
  <p>Am I correct that Omnipay only provides a basic interface to communicate with various Payment Gateways (including Mollie) and does not include more concrete functionality, like getting the payment methods/issuing banks?</p>
  
  <p>Basically, the code like below I still have to write myself? Or am I doing double work?</p>
  
  <pre><code>public function actionGetPaymentMethods()
  {
      $this-&gt;requireAjaxRequest();
  
      $paymentResponse = $this-&gt;gateway-&gt;fetchPaymentMethods()-&gt;send();
  
      if ($paymentResponse-&gt;isSuccessful()) {
          $paymentMethods = array();
          foreach ($paymentResponse-&gt;getPaymentMethods() as $paymentMethod) {
              $paymentMethods[] = array(
                  'id' =&gt; $paymentMethod-&gt;getId(),
                  'name' =&gt; $paymentMethod-&gt;getName(),
              );
          }
  
          $this-&gt;returnJson($paymentMethods);
      }
  
      $this-&gt;returnErrorJson('error');
  }
  </code></pre>
  
Tags: <plugin-development><plugin-craftcommerce>
Title: Omnipay Mollie implementation
ThreadText: # Omnipay Mollie implementation
  
  (Asked by: username_0 on 2016-12-05)
  
  I'm working on a webshop that should have an integration with Mollie to provide the payment methods. Craft Commerce's docs mention that Mollie is already integrated by using the Omnipay interface.
  
  Am I correct that Omnipay only provides a basic interface to communicate with various Payment Gateways (including Mollie) and does not include more concrete functionality, like getting the payment methods/issuing banks?
  
  Basically, the code like below I still have to write myself? Or am I doing double work?
  
  ```
  public function actionGetPaymentMethods()
  {
      $this->requireAjaxRequest();
  
      $paymentResponse = $this->gateway->fetchPaymentMethods()->send();
  
      if ($paymentResponse->isSuccessful()) {
          $paymentMethods = array();
          foreach ($paymentResponse->getPaymentMethods() as $paymentMethod) {
              $paymentMethods[] = array(
                  'id' => $paymentMethod->getId(),
                  'name' => $paymentMethod->getName(),
              );
          }
  
          $this->returnJson($paymentMethods);
      }
  
      $this->returnErrorJson('error');
  }
  
  ```
  
  **Tags:** plugin-development, plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-12-06. Score: 2
  
  Nevermind, I did not understand that Mollie is an off-site implementation. So the checkout just redirects you to the Mollie environment. If you want to implement on-site payments using Mollie you'd have to write your own logic I presume.
  
  
  ---
  
  