Can additional market press payment gateways live outside the market press plugin folder?

I wrote a few custom payment gateways and am writing more.

1. However, I am concerned that if market press updates, i might lose my payment gateways. will this happen?

2. If dumping my custom payment gateways in the plugins-gateway folder will remove my gateways after an update, then can my own custom gateways live outside the market press folder? that means it will be its own plugin. Can I just dump my existing payment gateway file (which i copied as-is from eways/paypal/manual payments), into the wordpress plugin folder or do i need to write additional code? can u help me with the code for this?

3. one of my gateways that i'm writing has an interesting reseller option. i will need to add this option in the network page. however, i shouldn't make these changes in marketpress-ms.php as i think i might lose my changes if market press updates. i believe i need to write a new plugin, but how do i override the marketpress-ms.php html and php code so that i can add my code?

  • Tyler Postle
    • CGO

    Hey Hazrul,

    Thanks for your question!

    Yes, if you have it inside the plugin then you will lose your payment gateways when the plugin is updated; however, you may be able to use the mu-plugins folder (must-use) and add your gateway code as a plugin in there.

    With that said, I am going to call in one of our coding experts on this one for you as this level of customizations is a bit above my skill set. They will be able to more accurately advise you on what to do in this situation :slight_smile:

    In the meantime, would you mind letting us know a bit more about your code? Seeing the code will likely help our SLS staff know what needs to be done with it to ensure it still works.

    If you would rather not post is publicly, then you can always mail it in privately to me through our secure contact form and I can pass it on to them.

    Send in:

    Subject: "Attn: Tyler Postle"
    include custom code

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Look forward to hearing back Hazrul!

    All the best,
    Tyler

  • Tyler Postle
    • CGO

    Hey Hazrul,

    Hope you're doing well today and thanks for sending in that code :slight_smile:

    I'm passing it along to our second line support to take a closer look so they can post back with some advice on this. Thanks for your patience Hazrul!

    Have a great rest of your day.

    Cheers,
    Tyler

  • Jose
    • Bruno Diaz

    Hey there Hazrul,

    Your code looks fine.

    You should be good as long as you hook into the action 'mp_load_gateway_plugins' to register your external gateway.

    You should take a look into the method 'load_gateway_plugins()', which is declared into the file wp-content/plugins/marketpress/marketpress.php line 651.

    Let me know if you have issues implementing it and I'll be glad to help.

    Cheers,
    Jose

  • Hazrul Azhar Jamari
    • Site Builder, Child of Zeus

    Hi Tyler

    Thanks. I will take a look.

    However, I am modifying the plugin slightly.

    This gateway requires a payment and failure page. I created a payment-success page. It returns the transaction Id as a query string after payment is successful.

    I need to test for the query string on this page and update the transaction to paid.

    Yah, the gateway is pretty old tech. but it needs to be done. can i send the updated code to you and have the programmer check it out? i need help with this.

  • Hazrul Azhar Jamari
    • Site Builder, Child of Zeus

    I'm not sure how to hook in mp_load_gateway_plugins in my code.

    Btw, I figured out how to call update order status. So my last email was solved.

    But I can't seem to figure out how to hook in mp_load_gateway_plugins in my code. I tried activating my plugin, and i get a wsod.

  • Hazrul Azhar Jamari
    • Site Builder, Child of Zeus

    I still need an answer for Qn.3

    3. one of my gateways that i'm writing has an interesting reseller option. i will need to add this option in the network page. however, i shouldn't make these changes in marketpress-ms.php as i think i might lose my changes if market press updates. i believe i need to write a new plugin, but how do i override the marketpress-ms.php html and php code so that i can add my code?

    I am now writing this new gateway plugin that has this reseller option. So what should I write in my plugin that will display Reseller API Key field in the marketpress-ms.php ?

  • Jose
    • Bruno Diaz

    Hey @Hazrul,

    You don't need to look into marketpress-ms.php.

    The plugin provides a specific hook to add custom settings for your gateway.

    You can find the hook definition into marketpress.php, line 7617:

    //for adding additional settings for a payment gateway plugin
    do_action('mp_gateway_settings', $settings);

    Let me know if you have further questions.

    Cheers,
    Jose

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.