2

I have (had) a custom payment gateway running in Expresso Store 2.0.6. Since i updated to 2.1 the gateway is not working anymore. I am aware of the new folder structure inside the vendor/omnipay folder and tried to adapt my own gateway folder without success. The gateway is not listed in stores payment gateway settings. I also changed the store_unofficial_payment_gateways value in the db from 0 to 1.

So,

  • Are there some special installation instructions for custom payment gateways in EE Store 2.1? Or is it like in previous versions that i only have to move my custom gateway folder into the vendor folder and if everything is fine in my folder the gateway shows up?

  • Are there other files i have to adapt outside my custom gateway folder?

  • What's about that new composer.json file? I'm not sure how that should look like …

Also worth to note: The button "Add Payment Method" in the upper right corner doesn't exists in my installation as seen in the store docs: https://exp-resso.com/docs/settings_payment_methods.html

I am running the latest versions from both EE and Expresso Store.

Thanks in advance

2 Answers 2

2

As of Store 2.1 gateways are now added as separate extensions outside of the actual Store folders. This makes it easier in the future to upgrade Store because you don't have to worry about overwriting your custom gateway. (Last item under Developer). You can see an example of the folder structure in the example gateway Store Check.

1
  • 1
    Since the "Store Check" example is so basic, I also suggest checking out my Beanstream gateway as an example. Commented Dec 23, 2013 at 14:11
2

Just to expand on Justin's answer a little, payment gateways in Store 2.1 can now be registered as separate extensions. This means you don't need to copy anything into the third_party/store folder or worry about re-copying files when you upgrade.

The extension hook you need to use is called store_payment_gateways. If you are unfamiliar with ExpressionEngine extension development, it's probably worth reviewing the extension development guide first.

Inside the extension hook, you need to first add your gateway name to Store's list of gateways, then tell Store where to find your gateway files (so they can be autoloaded when needed). Here is a complete example:

/**
 * This hook is called when Store is searching for available payment gateways
 * We will use it to tell Store about our custom gateway
 */
public function store_payment_gateways($gateways)
{
    // tell Store about our new payment gateway
    // (this must match the name of your gateway in the Omnipay directory)
    $gateways[] = 'Check';

    // tell PHP where to find the gateway classes
    // Store will automatically include your files when they are needed
    $composer = require(PATH_THIRD.'store/autoload.php');
    $composer->add('Omnipay', __DIR__);

    return $gateways;
}

For a complete example, check out these existing third-party gateways:

  • Check - our example custom gateway which simply creates an additional "Manual" payment gateway
  • Beanstream by Derek Hogue
1
  • 2
    That's wat i call first class support. Answering a question on December 24th. Thanks Adrian & Justin. I will try that. Merry Christmas!
    – Chrigi
    Commented Dec 24, 2013 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.