Support

Home Forums Event Espresso Premium Multiple Paypal accounts in EE4

Multiple Paypal accounts in EE4

Posted: August 10, 2015 at 4:55 am

Viewing 18 reply threads


MR DECLAN J MAIR

August 10, 2015 at 4:55 am

Hello,

I have been looking to see if EE4 can have some events paying to a different paypal account. Is this possible? previous forums said it wasn’t yet but that was a good year ago.

Thanks in advance.
Declan


Lorenzo Orlando Caum

  • Support Staff

August 10, 2015 at 9:59 am

Hi Declan,

In Event Espresso 4, you can also use a meta key & then add this code snippet to your child theme’s functions.php file or a site specific plugin (https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/):

https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/jf_ee_paypal_account_meta_key_override.php


Lorenzo


MR DECLAN J MAIR

August 11, 2015 at 5:29 am

Thank you


Tony

  • Support Staff

August 11, 2015 at 5:47 am

Hi Declan,

Do you need further assistance with this or shall I mark the thread resolved?
(You can also mark a thread resolved yourself in the sidebar on the right if you refer)


MR DECLAN J MAIR

August 14, 2015 at 6:56 am

Hi
I’ve put it into the php file… can you keep the thread open at the moment please as I’ll need to test it.

Thanks
Declan


Tony

  • Support Staff

August 14, 2015 at 7:00 am

Sure 🙂

We generally will not close threads unless its clear the thread is resolved although they will close automatically if no reply is made within 2 weeks.

Just let us know if you have any problems.


MR DECLAN J MAIR

August 14, 2015 at 7:16 am

ok… stupid question… where do you put the new paypal id???


Tony

  • Support Staff

August 14, 2015 at 8:33 am

Its within the post_meta for the event so within ‘Custom Fields’ – http://take.ms/4v5zh


MR DECLAN J MAIR

August 14, 2015 at 1:41 pm

Thanks… doesn’t appear to be working!… below is the code, I’ve added to the functions file. First I added the code beneath the first lot of code and started it with “<?php” but the tried it within the php brackets…

<?php
/************************************************************/
/*                                                          */
/*   INCLUDE ALL IMPORTANT FUNCTIONS                        */
/*                                                          */
/************************************************************/

require(get_template_directory().'/functions/add-wordpress-suports.php');               // WordPress Supports
require(get_template_directory().'/functions/register-sidebars.php');                   // Register Sidebars
require(get_template_directory().'/functions/scripts-styles.php');                      // Enqueue Scripts and Styles
require(get_template_directory().'/functions/widgets.php');                             // Widgets
require(get_template_directory().'/functions/post-types-and-taxonomies.php');           // Post Type and Custom Taxonomies
//require(get_template_directory().'/functions/variables-for-js.php');                    // Load variables from PHP to JS
require(get_template_directory().'/functions/functions.php');                           // Load all custom functions
require(get_template_directory().'/functions/meta-boxes.php');                          // Load Meta Boxes
require(get_template_directory().'/functions/theme-settings.php');                      // Create custom admin panel
require(get_template_directory().'/functions/thumbnail-sizes.php');                     // Load WP Thumbnail Sizes
//require(get_template_directory().'/functions/aq-page-builder/aq-page-builder.php');     // Create custom admin panel
require(get_template_directory().'/functions/theme-style.php');
function load_fonts() {
            wp_register_style('et-googleFonts', 'http://fonts.googleapis.com/css?family=Marcellus');
            wp_enqueue_style( 'et-googleFonts');
        }
    add_action('wp_print_styles', 'load_fonts');
    
add_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite', 'my_custom_venue_slug', 10, 2 );
    function my_custom_venue_slug( $slug, $post_type ) {
      if ( $post_type == 'espresso_venues' ) {
        $custom_slug = array( 'slug' => 'locations' );
        return $custom_slug;
      }
      return $slug;
    }
    
// use optional paypal account via a meta key in EE4
// note: use the meta key: paypal_id
// the default paypal ID set in Payment Methods will be used if Multi Event Registration is activated
add_filter( 'FHEE__EEG_Paypal_Standard__set_redirection_info__arguments', 'jf_ee_paypal_account_meta_key_override' );
function jf_ee_paypal_account_meta_key_override( $redirect_args ) {
    if ( ! defined( 'EE_MER_PATH' ) ) {
        $checkout = EE_Registry::instance()->SSN->checkout();
        if ( $checkout instanceof EE_Checkout ) {
            $transaction = $checkout->transaction;
            if ( $transaction instanceof EE_Transaction ) {
               foreach ( $transaction->registrations() as $registration ) {
                    if ( $registration instanceof EE_Registration ) {
                        $event = $registration->event();
                        if ( $event instanceof EE_Event ) {
                            $meta_key_value = get_post_meta( $event->ID(), 'paypal_id', true );
                            $clean_email = sanitize_email( $meta_key_value );
                            if ( isset( $redirect_args[ 'business' ] ) && ! empty( $clean_email ) && $clean_email == $meta_key_value ) {
                                $redirect_args[ 'business' ] = $meta_key_value;
                            }
                        }
                    }
                }
            }
        }
    }
    return $redirect_args; 
}
?>

Thanks!


Tony

  • Support Staff

August 14, 2015 at 1:48 pm

Ah, I know why from your other thread.

Your using MER and unfortunately that code isn’t compatible with MER.

Currently with MER in the mix there isn’t an option to use multiple PayPal accounts.


MR DECLAN J MAIR

August 14, 2015 at 2:06 pm

that’ll explain it… whats MER? I’ve just tried the plugin options ect to no avail.

Thanks


MR DECLAN J MAIR

August 14, 2015 at 2:11 pm

do you have a timescale of when the feature will be available?


Tony

  • Support Staff

August 14, 2015 at 2:16 pm

Apologies, I’m so used to using the shorthand version.

MER is the Multi Event Registration Add-on

I’ve just tried the plugin options ect to no avail.

Oh to disabled ‘MER’? Sorry 🙂

With MER you have multiple events that can all have individual paypal_id’s that all need to go through a single transaction, there would be no way to know which paypal ID to use so that does will not work.


MR DECLAN J MAIR

August 14, 2015 at 3:41 pm

Sorry I meant I tried the plugin option before I read your comment! I read on multiple events it’ll use the default PayPal? Is that not the case then, it’s not possible to have a different PayPal account should they only be booking the one event?


Tony

  • Support Staff

August 17, 2015 at 7:19 am

I read on multiple events it’ll use the default PayPal?

Is that from this comment within the code:

the default paypal ID set in Payment Methods will be used if Multi Event Registration is activated

Even when you register onto a single event the Multi Event Registration Add-on is still active and so the default PayPal ID is used. The code checks if the Add-on is active or not, if its active it does nothing, if its not it checks the current event for the meta value and uses that.

Currently with the Multi Event Registration Add-on active you can not use ‘per event’ PayPal ID’s.


MR DECLAN J MAIR

August 17, 2015 at 4:32 pm

Ah :/ is there an estimate of the timescale?


Josh

  • Support Staff

August 17, 2015 at 6:39 pm

It turns out we’re not planning on making a multiple events registration within one transaction to be split between multiple payment accounts. If you need multiple payment accounts, they’ll need to be separate transactions, which is how Event Espresso works without Multi Event Registration activated.


MR DECLAN J MAIR

August 18, 2015 at 7:39 am

oh ok.


Lorenzo Orlando Caum

  • Support Staff

August 18, 2015 at 11:48 am

Hello, were there any other questions that we could answer for you regarding using multiple PayPal.com accounts?

Thanks


Lorenzo

Viewing 18 reply threads

The support post ‘Multiple Paypal accounts in EE4’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso