Support

Home Forums Event Espresso Premium Add EE4 Transaction ID to Paypal Payment Details Revisited

Add EE4 Transaction ID to Paypal Payment Details Revisited

Posted: January 27, 2016 at 2:01 am


raffy

January 27, 2016 at 2:01 am

With reference to thisticket

I finally get around to doing making a site specific plugin as recommended.
I followed https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

and popped in Josh’s code in the ticket linked above

add_filter( 'FHEE__EEG_Paypal_Standard__set_redirection_info__arguments', 'jf_ee_set_transaction_id_as_paypal_item_id' );
function jf_ee_set_transaction_id_as_paypal_item_id( $redirect_args ) {
    $checkout = EE_Registry::instance()->SSN->checkout();
    if ( $checkout instanceof EE_Checkout ) {
        $transaction = $checkout->transaction;
        if ( $transaction instanceof EE_Transaction ) {      
            $redirect_args[ 'item_number' ] = $transaction->ID();
        }
    }
    return $redirect_args; 
}

Using the above, what should my client see when viewing the order summary on PayPal before choosing a way to pay? Will the transaction ID show up there? Will it show up on Paypal in sandbox mode?

To force what I wanted to see on my Paypal transactions, I fiddled with a core file.

I know I’m not supposed to mess around with the core files but just to show you the effect that I want I modified EEG_Paypal_Standard.gateway.php, line 131-132

I changed

sprintf( _x('%1$s for %2$s', 'Ticket for Event', 'event_espresso' ), $line_item->name(), $line_item->ticket_event_name()),

to

sprintf( _x('TIN %1$s: %2$s for %3$s', 'Ticket for Event', 'event_espresso' ), $transaction->ID(), $line_item->name(), $line_item->ticket_event_name()),

Will the code given by Josh last November 4, 2015 at 6:52 pm have this or a similar effect? Where was the transaction number show up?

I understand that my modification will get wiped out each time EE4 updates but is the modification I made valid? Safe? How do I bring this out as a site specific plugin?


Josh

  • Support Staff

January 27, 2016 at 11:37 am

Using the above, what should my client see when viewing the order summary on PayPal before choosing a way to pay? Will the transaction ID show up there? Will it show up on Paypal in sandbox mode?

I don’t think they’ll see a change to their order summary, the code that passes the EE transaction ID as the item number is for displaying the EE transaction ID as an item with the PayPal notification email.

Your other idea to modify the item_name that’s sent to PayPal would likely be best accomplished by adding a filter hook there. There is the existing hook that might be able to be used, but since there can be multiple items I think it’d be easily to add a new filter where it puts together the item_name.

If you’re interested in adding a new filter, we can look into adding one or you are also welcome to submit a pull request on our Github project.

https://github.com/eventespresso/event-espresso-core/pulls


raffy

January 27, 2016 at 2:12 pm

I’m not a programmer. I just happen to get how some of these things work. The code I posted was arrived at using the brute force method 😉

I tried looking at what a pull request and I won’t be able to effectively go through that workflow.

I intend to modify EEG_Paypal_Standard.gateway.php each time EE4 updates until such time you see it fit to integrate the TIN OR Unique Reg Code in the data sent to Paypal.

As it is, is the code I showed you to modify item_name safe (i.e. won’t break my EE4 install)?

Thanks.


Josh

  • Support Staff

January 27, 2016 at 2:23 pm

Please don’t modify core code. That’s never recommended or in this case necessary. The filter hooks that are in place, along with the code you referred to earlier, already pass the transaction ID to PayPal.


raffy

January 27, 2016 at 2:50 pm

Understood. Thanks.

The support post ‘Add EE4 Transaction ID to Paypal Payment Details Revisited’ 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