Is it possible to use EE-standard database queries in a custom payment gateway written using Omnipay format to manipulate data in the database?

I.E. use $query = ee()->db->select('title, url_title, field_id_14') within the PurchaseRequest class?


I assume you are using Store > 2. If that is the case you would be making your own extension. Store has a default layout for these extensions available on github here.

If you notice in the ext.store_check.php file, there are these lines.

    // 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__);

This would get all the files in your omipay folder and include them into this source. Working off of that assumption, you should (in theory) be able to call any ExpressionEngine api functions that are regularly available in an extension in your omnipay files.

One precautionary note I'm going to mention is be careful of namespaces (if you are using any). Because those could throw off the function calls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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