Support

Home Forums Event Espresso Premium Multiple PaypalPro gateways that auto-switch based on cart contents

Multiple PaypalPro gateways that auto-switch based on cart contents

Posted: September 14, 2020 at 1:12 pm


Daniel

September 14, 2020 at 1:12 pm

Hello!

I have 2 Paypal accounts and I want to automatically choose one or the other depending on logic based on cart contents.

I want to be able to choose which payment of 2 PaypalPro gateways I send customers to based on the contents of their cart.

I have customized the checkout to allow an “Admin-only” checkout and that has worked well.

However, right now, I see only 1 PaypalPro payment method here: /wp-admin/admin.php?page=espresso_payment_settings

I would like to be able to duplicate this payment method and create a new name and have it show up in the admin listing with a name like “Paypal Pro 2” – the idea is that I just need a place to store the API key and secret and it seems as if duplicating and creating a new name would be pretty easy.

Are there any issues I should be aware of before I start this process?

Thank you in advance for any sage advice.
D


Tony

  • Support Staff

September 14, 2020 at 1:16 pm

Hi Daniel,

You can do some of this using the Payment Methods Pro add-on:

https://eventespresso.com/product/eea-payment-methods-pro/

So you could start by taking a look into how that add-on works.

It basically allows you to create multiple ‘instances’ of a payment method and set it on specific events. However, you can’t use that add-on with MER as you could have Event A with PayPal Payment Method 1 assigned to it, then Event B with PayPal Payment Method 2 assigned to…. what do you use when both Event A and B are assigned to the cart?


Daniel

September 14, 2020 at 4:26 pm

Oh, right PMP.
I did try that and I got the error message which led me to this nice comment in the code:


/**
     * Don't run MER and payment methods pro together, because if we did that, we'd
     * have to only show payment methods usable by ALL selected events, and it's
     * possible there might be none, so we'd need to have some fallback plan etc.
     * Besides, people who need this probably don't need MER. But we'll see
     * if folks indicate otherwise
     */
    public static function deactivate_if_mer_active() {
...

So, it looks like it was considered and then not pursued because there wasn’t a clear use case.

I do, in fact, use and enjoy the MER add-on and I am happy to set up some logic here to allow assigning a default gateway when the checkout is “confused” because of events that are assigned to sell through different gateways.

What would be an efficient and sustainable (ie hooks) way to remove this “error” check? I could just hack the code but it is my experience that you guys have created a lot of options for devs to hook into.

D

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Daniel 1 month, 2 weeks ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!