Support

Home Forums Event Espresso Premium Passing value to PayPal

Passing value to PayPal

Posted: January 11, 2017 at 4:01 pm


wegAdmin

January 11, 2017 at 4:01 pm

I just configured PayPal Express, but for accounting purposes, I must pass the value ‘7777’ along with every PayPal transaction. Can you please point me to some documentation about how to do this?


wegAdmin

January 11, 2017 at 4:46 pm

The value I need to pass is the Item ID column. I need to set the Item ID to a specific value.


Josh

  • Support Staff

January 12, 2017 at 8:15 am

Hi there,

I checked into this and the PayPal Express gateway will need a filter hook added to allow passing more data onto PayPal. I can let you know how to use the filter hook to pass a specific value to the Item ID column, after the hook has been added.


wegAdmin

January 12, 2017 at 11:57 am

I have added this code to my site-specific plugin, but it doesn’t pass the item_id value to PayPal:

add_filter( 'FHEE__EEG_Paypal_Standard__set_redirection_info__arguments', 'jf_ee_add_paypal_item_id' );
function jf_ee_add_paypal_item_id( $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_item_id', true );
                            if ( ! empty( $meta_key_value ) ) {
                                $redirect_args[ 'item_number_1' ] = $meta_key_value;
							}
						}
					}
				}
			}
		}
	}
    return $redirect_args; 
}


Josh

  • Support Staff

January 12, 2017 at 12:09 pm

That’s because the code you’re trying to use is for the PayPal Standard gateway. A similar hook isn’t available for PayPal Express yet.


wegAdmin

January 12, 2017 at 2:00 pm

Any time frame for the availability of that code?


Josh

  • Support Staff

January 12, 2017 at 2:37 pm

Not much time it’s already in the release candidate for the next release.


Josh

  • Support Staff

January 17, 2017 at 9:40 am

Update: The release candidate was released today. Starting with EE4.9.26.p, you can use the
FHEE__EEG_Paypal_Express__set_redirection_info__arguments
filter hook. Here’s a link to a gist that shows an example of how to use that hook:

https://gist.github.com/joshfeck/b67d87256f29599abefa5ebc2de3dad2

The support post ‘Passing value to PayPal’ 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