Forum

Thread tagged as: Question, Problem, Shop

Get shop info in Mollie API

Hello,

I'm not sure if I am doing it right because this is very new to me, but I am trying to use Mollie as a payment gateway to my shop.

My checkout.php:

<?php
    // Show the cart with a non-interactive template
    perch_shop_cart([
        'template'=>'cart/cart_static.html'
    ]);
    // Show the order addresses
    perch_shop_order_addresses();
    // Display the form with the T&Cs checkbox
//    perch_shop_form('checkout/confirm.html');
?>

<?php
  perch_shop_payment_form('stripe');
?>

My payment form:

<perch:form id="confirm" app="perch_shop" class="order-confirm" action="/shop/test">
  <perch:input type="submit" value="Go" />
</perch:form>

Test.php (Page from the action of the form, where I call Mollie):


<?php require_once('C:\xampp\htdocs\kevcel\vendor\Mollie\API\Autoloader.php'); $mollie = new Mollie_API_Client; $mollie->setApiKey('test_a6xxfh7Was8KHhrRv44J7Gpjd6wqyG'); try { $payment = $mollie->payments->create( array( 'amount' => '400.00', 'description' => 'My first payment', 'redirectUrl' => 'https://www.kevcel.test/shop/result.php', 'webhookUrl' => 'https://www.kevcel.test/shop/test-webhook.php', 'metadata' => array( 'order_id' => '12345' ) ) ); /* * Send the customer off to complete the payment. * This request should always be a GET, thus we enforce 303 http response code */ header("Location: " . $payment->getPaymentUrl(), true, 303); exit; } catch (Mollie_API_Exception $e) { echo "API call failed: " . htmlspecialchars($e->getMessage()); echo " on field " . htmlspecialchars($e->getField()); } ?>

So my question is, how do I get the order_id, amount etc. etc. in Mollie? Now I have put an amount etc. by myself, but it should get it from the perch order.

I hope someone can help me, thanks in advance.

Mike

Mike Hendriks

Mike Hendriks 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you created a gateway adapter class?

No, I don't think so. How would I do that?

Is there any documentation on that subject? I can't seem to find anything.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to declare a gateway class, and make it available in your autoloader. You'll also need to include the Omnipay Mollie implementation.

https://omnipay.thephpleague.com/gateways/mollie/

class PerchShopGateway_mollie extends PerchShopGateway_default
{
    protected $slug = 'mollie';
    public $omnipay_name = 'Mollie';
}

You can then overwrite any of the methods defined in PerchShopGateway_default to customise the payment handling for Mollie.

Okay, so I have created PerchShopGateway_mollie in /perch/addons/apps/perch_shop/lib/gateways

PerchShopGateway_mollie.class.php:

<?php

class PerchShopGateway_mollie extends PerchShopGateway_default
{
    protected $slug = 'mollie';
    public $omnipay_name = 'Mollie';
}

I also installed the Omnipay Mollie via composer.

How do I make the mollie gateway class available in my autoloader?

Autoloader.php (Mollie/API/Autoloader.php):

<?php 

class Mollie_API_Autoloader
{
    /**
     * @param string $class_name
     */
    public static function autoload ($class_name)
    {
        if (strpos($class_name, "Mollie_") === 0)
        {
            $file_name = str_replace("_", "/", $class_name);
            $file_name = realpath(dirname(__FILE__) . "/../../{$file_name}.php");

            if ($file_name !== false)
            {
                require $file_name;
            }
        }
    }

    /**
     * @return bool
     */
    public static function register ()
    {
        return spl_autoload_register(array(__CLASS__, "autoload"));
    }

    /**
     * @return bool
     */
    public static function unregister ()
    {
        return spl_autoload_unregister(array(__CLASS__, "autoload"));
    }
}

Mollie_API_Autoloader::register();

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

I have created PerchShopGateway_mollie in /perch/addons/apps/perch_shop/lib/gateways

Don't put your code there - it'll get replaced when you upgrade. Put it in somewhere like /perch/addons/apps/hendricks_mollie

Then create /perch/addons/apps/hendricks_mollie/runtime.php and put your autoloader in there (or heck, just include the gateway file).

Add hendricks_mollie to your apps.php file.

I created /perch/addons/apps/hendriks_mollie in which I put runtime.php and PerchShopGateway_mollie.class.php.

runtime.php:

<?php

class Mollie_API_Autoloader
{
    /**
     * @param string $class_name
     */
    public static function autoload ($class_name)
    {
        if (strpos($class_name, "Mollie_") === 0)
        {
            $file_name = str_replace("_", "/", $class_name);
            $file_name = realpath(dirname(__FILE__) . "/../../{$file_name}.php");

            if ($file_name !== false)
            {
                require $file_name;
            }
        }
    }

    /**
     * @return bool
     */
    public static function register ()
    {
        return spl_autoload_register(array(__CLASS__, "autoload"));
    }

    /**
     * @return bool
     */
    public static function unregister ()
    {
        return spl_autoload_unregister(array(__CLASS__, "autoload"));
    }
}

Mollie_API_Autoloader::register();

PerchShopGateway_mollie.class.php:

<?php

class PerchShopGateway_mollie extends PerchShopGateway_default
{
    protected $slug = 'mollie';
    public $omnipay_name = 'Mollie';
}

perch/config/apps.php:

<?php
    $apps_list = [ 'perch_members', 'perch_shop', 'hendriks_mollie'
    ];

Am I on the right track now? Thank you for the help so far.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What problem are you now having?

Well, my test.php still looks like this:


<?php require_once('C:\xampp\htdocs\kevcel\vendor\Mollie\API\Autoloader.php'); $mollie = new Mollie_API_Client; $mollie->setApiKey('test_a6xxfh7Was8KHhrRv44J7Gpjd6wqyG'); try { $payment = $mollie->payments->create( array( 'amount' => '400.00', 'description' => 'My first payment', 'redirectUrl' => 'https://www.kevcel.test/shop/result.php', 'webhookUrl' => 'https://www.kevcel.test/shop/test-webhook.php', 'metadata' => array( 'order_id' => '12345' ) ) ); /* * Send the customer off to complete the payment. * This request should always be a GET, thus we enforce 303 http response code */ header("Location: " . $payment->getPaymentUrl(), true, 303); exit; } catch (Mollie_API_Exception $e) { echo "API call failed: " . htmlspecialchars($e->getMessage()); echo " on field " . htmlspecialchars($e->getField()); } ?>

What do I change there? This is my first time doing anything like this.

Do I change require_once('C:\xampp\htdocs\kevcel\vendor\Mollie\API\Autoloader.php'); to require_once('C:\xampp\htdocs\kevcel\perch\addons\apps\hendriks_mollie\runtime.php'); ? And then edit the PerchShopGateway_default into PerchShopGateway_mollie

Do I also change the shop.php ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You'd then use your new gateway adapter with the checkout function:

perch_shop_checkout('mollie', [
    'return_url' => '/payment/success',
    'cancel_url' => '/payment/failure',
]);

On checkout.php I now get:

Fatal error: Uncaught Omnipay\Common\Exception\RuntimeException: Class '\Omnipay\Mollie\Gateway' not found in C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\vendor\omnipay\common\src\Omnipay\Common\GatewayFactory.php:105 Stack trace: #0 [internal function]: Omnipay\Common\GatewayFactory->create('\\Omnipay\\Mollie...') #1 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\vendor\omnipay\common\src\Omnipay\Omnipay.php(115): call_user_func_array(Array, Array) #2 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\gateways\PerchShopGateway_default.class.php(213): Omnipay\Omnipay::__callStatic('create', Array) #3 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\gateways\PerchShopGateway_default.class.php(51): PerchShopGateway_default->get_omnipay_instance() #4 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\PerchShop_Order.class.php(90): PerchShopGateway_default->take_payment(Object(PerchShop_Order), Array) #5 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\PerchShop_Runtime.class.php(6 in C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\vendor\omnipay\common\src\Omnipay\Common\GatewayFactory.php on line 105

I copied my Autoloader.php in runtime.php, but that was the Autoloader from my manual Mollie install, before installing the omnipay Mollie. So now I copied Gateway.php found inside /perch/addons/apps/perch_shop/lib/vendor/mollie/src/Gateway.php in runtime.php.

Then I get the next error:


Notice: Undefined index: api_key in C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\gateways\PerchShopGateway_default.class.php on line 134 Fatal error: Uncaught Error: Class '\Omnipay\Mollie\Message\PurchaseRequest' not found in C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\vendor\omnipay\common\src\Omnipay\Common\AbstractGateway.php:322 Stack trace: #0 C:\xampp\htdocs\kevcel\perch\addons\apps\hendriks_mollie\runtime.php(82): Omnipay\Common\AbstractGateway->createRequest('\\Omnipay\\Mollie...', Array) #1 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\gateways\PerchShopGateway_default.class.php(55): Omnipay\Mollie\Gateway->purchase(Array) #2 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\PerchShop_Order.class.php(90): PerchShopGateway_default->take_payment(Object(PerchShop_Order), Array) #3 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\PerchShop_Runtime.class.php(620): PerchShop_Order->take_payment('purchase', Array) #4 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\runtime\cart.php(186): PerchShop_Runtime->checkout('mollie', Array, 'default') #5 C:\xampp\htdocs\kevcel\shop\checkout.php(15): perch_shop_checkout('moll in C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\vendor\omnipay\common\src\Omnipay\Common\AbstractGateway.php on line 322

runtime.php with Autoloader.php from first install:

<?php
/**
 * Copyright (c) 2013, Mollie B.V.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * @license     Berkeley Software Distribution License (BSD-License 2) https://www.opensource.org/licenses/bsd-license.php
 * @author      Mollie B.V. <info@mollie.com>
 * @copyright   Mollie B.V.
 * @link        https://www.mollie.com
 */
class Mollie_API_Autoloader
{
    /**
     * @param string $class_name
     */
    public static function autoload ($class_name)
    {
        if (strpos($class_name, "Mollie_") === 0)
        {
            $file_name = str_replace("_", "/", $class_name);
            $file_name = realpath(dirname(__FILE__) . "/../../{$file_name}.php");

            if ($file_name !== false)
            {
                require $file_name;
            }
        }
    }

    /**
     * @return bool
     */
    public static function register ()
    {
        return spl_autoload_register(array(__CLASS__, "autoload"));
    }

    /**
     * @return bool
     */
    public static function unregister ()
    {
        return spl_autoload_unregister(array(__CLASS__, "autoload"));
    }
}

Mollie_API_Autoloader::register();

runtime.php with Gateway.php from omnipay mollie:

<?php

namespace Omnipay\Mollie;

use Omnipay\Common\AbstractGateway;

/**
 * Mollie (iDeal) Gateway
 *
 * @link https://www.mollie.nl/files/documentatie/payments-api.html
 */
class Gateway extends AbstractGateway
{
    /**
     * @return string
     */
    public function getName()
    {
        return 'Mollie';
    }

    /**
     * @return array
     */
    public function getDefaultParameters()
    {
        return array(
            'apiKey' => 'test_a6xxfh7Was8KHhrRv44J7Gpjd6wqyG'
        );
    }

    /**
     * @return string
     */
    public function getApiKey()
    {
        return $this->getParameter('apiKey');
    }

    /**
     * @param  string $value
     * @return $this
     */
    public function setApiKey($value)
    {
        return $this->setParameter('apiKey', $value);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchIssuersRequest
     */
    public function fetchIssuers(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchIssuersRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchPaymentMethodsRequest
     */
    public function fetchPaymentMethods(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchPaymentMethodsRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchTransactionRequest
     */
    public function fetchTransaction(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchTransactionRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\PurchaseRequest
     */
    public function purchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\PurchaseRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\CompletePurchaseRequest
     */
    public function completePurchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\CompletePurchaseRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\RefundRequest
     */
    public function refund(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\RefundRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\CreateCustomerRequest
     */
    public function createCustomer(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\CreateCustomerRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\UpdateCustomerRequest
     */
    public function updateCustomer(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\UpdateCustomerRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchCustomerRequest
     */
    public function fetchCustomer(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchCustomerRequest', $parameters);
    }
}

I thought it was getting a bit of a mess at this point, so I decided to delete everything and start from scratch.

  1. I install Omnipay Mollie via composer, which gives me a vendor folder in the root of my site.
  2. I create a folder /perch/addons/apps/mollie_ideal in which I create PerchShopGateway_mollie.class.php and runtime.php

PerchShopGateway_mollie.class.php:

<?php
class PerchShopGateway_mollie extends PerchShopGateway_default
{
    protected $slug = 'mollie';
    public $omnipay_name = 'Mollie';
}

runtime.php (Took code from C:/xampp/htdocs/kevcel/vendor/omnipay/mollie/src/Gateway.php):

<?php

namespace Omnipay\Mollie;

use Omnipay\Common\AbstractGateway;

/**
 * Mollie (iDeal) Gateway
 *
 * @link https://www.mollie.nl/files/documentatie/payments-api.html
 */
class Gateway extends AbstractGateway
{
    /**
     * @return string
     */
    public function getName()
    {
        return 'Mollie';
    }

    /**
     * @return array
     */
    public function getDefaultParameters()
    {
        return array(
            'apiKey' => ''
        );
    }

    /**
     * @return string
     */
    public function getApiKey()
    {
        return $this->getParameter('apiKey');
    }

    /**
     * @param  string $value
     * @return $this
     */
    public function setApiKey($value)
    {
        return $this->setParameter('apiKey', $value);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchIssuersRequest
     */
    public function fetchIssuers(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchIssuersRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchPaymentMethodsRequest
     */
    public function fetchPaymentMethods(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchPaymentMethodsRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchTransactionRequest
     */
    public function fetchTransaction(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchTransactionRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\PurchaseRequest
     */
    public function purchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\PurchaseRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\CompletePurchaseRequest
     */
    public function completePurchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\CompletePurchaseRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\RefundRequest
     */
    public function refund(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\RefundRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\CreateCustomerRequest
     */
    public function createCustomer(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\CreateCustomerRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\UpdateCustomerRequest
     */
    public function updateCustomer(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\UpdateCustomerRequest', $parameters);
    }

    /**
     * @param  array $parameters
     * @return \Omnipay\Mollie\Message\FetchCustomerRequest
     */
    public function fetchCustomer(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\Mollie\Message\FetchCustomerRequest', $parameters);
    }
}
  1. Add 'mollie_ideal' to my apps.php
  2. Add checkout with new mollie gateway

checkout.php:

<?php
    if (!perch_member_logged_in()) {
        PerchSystem::redirect('/shop/login');
    }

    perch_shop_checkout('mollie', [
        'return_url' => '/shop/result',
        'cancel_url' => '/shop/failure',
    ]);
?>

----

<?php
     perch_shop_payment_form('stripe');
?>

stripe_payment_form.html:

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <perch:form id="confirm" app="perch_shop" class="order-confirm" action="/shop/test">
                    <perch:input type="submit" value="Go" />
            </perch:form>
        </div>
    </div>
</div>

On checkout.php I now get this error:

Fatal error: Uncaught Error: Class '\Omnipay\Mollie\Message\PurchaseRequest' not found in C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\vendor\omnipay\common\src\Omnipay\Common\AbstractGateway.php:322 Stack trace: #0 C:\xampp\htdocs\kevcel\vendor\omnipay\mollie\src\Gateway.php(82): Omnipay\Common\AbstractGateway->createRequest('\\Omnipay\\Mollie...', Array) #1 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\gateways\PerchShopGateway_default.class.php(55): Omnipay\Mollie\Gateway->purchase(Array) #2 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\PerchShop_Order.class.php(90): PerchShopGateway_default->take_payment(Object(PerchShop_Order), Array) #3 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\PerchShop_Runtime.class.php(620): PerchShop_Order->take_payment('purchase', Array) #4 C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\runtime\cart.php(186): PerchShop_Runtime->checkout('mollie', Array, 'default') #5 C:\xampp\htdocs\kevcel\shop\checkout.php(11): perch_shop_checkout('mollie', Arr in C:\xampp\htdocs\kevcel\perch\addons\apps\perch_shop\lib\vendor\omnipay\common\src\Omnipay\Common\AbstractGateway.php on line 322
Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like your autoloader isn't configured correctly.

Do you think that I have the right code in runtime.php? As said I took the code from: C:/xampp/htdocs/kevcel/vendor/omnipay/mollie/src/Gateway.php.

You said: Then create /perch/addons/apps/hendricks_mollie/runtime.php and put your autoloader in there (or heck, just include the gateway file).

Which file do you mean by 'autoloader'?

Okay, so in my runtime.php I have included C:/xampp/htdocs/kevcel/vendor/autoload.php

So now my page after checkout looks like this:

<?php include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); ?>

<?php
    if (!perch_member_logged_in()) {
        PerchSystem::redirect('/shop/login');
    }

    perch_shop_checkout('mollie', [
    'return_url' => '/shop/result',
    'cancel_url' => '/shop/',
    ]);

The page now returns:

Notice: Undefined index: test_mode in C:\xampp\htdocs\kevcel2\perch\addons\apps\perch_shop\lib\gateways\PerchShopGateway_default.class.php on line 133

Notice: Undefined index: live in C:\xampp\htdocs\kevcel2\perch\addons\apps\perch_shop\lib\gateways\PerchShopGateway_default.class.php on line 136
Unauthorized request

I think I am almost there! So now it is only a matter of overwriting the methods from PerchShopGateway_default.class.php, am I right?

Those undefined indexes was because of my shop.php file not being setup correctly.

Fixed it:

<?php
  return [
    'gateways' => [
      'mollie' => [
        'enabled'   => true,
        'test_mode' => true,
        'live' => [
          'secret_key'      => '',
          'publishable_key' => '',
        ],
        'test' => [
          'api_key'      => 'test_a6xxfh7Was8KHhrRv44J7Gpjd6wqyG',
        ],
      ],
    ],
  ];
?>

YESSSS! I got Mollie working! Thank you for all the help, Drew.

The only problem that I am having right now, is that when I copy a public function from default.class.php to mollie.class.php it is not overwriting? It is still grabbing the function from default.class.php.

Example: PerchShopGateway_default.class.php

    public function take_payment($Order, $opts)
    {
        $payment_opts = [
                'amount'        => $Order->orderTotal(),
                'currency'      => $Order->get_currency_code(),
                'transactionId' => $Order->id(),
                'clientIp'      => PerchUtil::get_client_ip(),
                'description'   => 'Order #'.$Order->id(),
            ];

#########
}

PerchShopGateway_mollie.class.php

    public function take_payment($Order, $opts)
    {
        $payment_opts = [
                'amount'        => $Order->orderTotal(),
                'currency'      => $Order->get_currency_code(),
                'transactionId' => $Order->id(),
                'clientIp'      => PerchUtil::get_client_ip(),
                'description'   => 'Test Description #'.$Order->id(),
            ];

#########
}

It is still returning 'Order' as description, and not 'Test Description'.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you sure?