Support

Home Forums Event Espresso Premium Paypal fee adding causes "Amount Due" back to the customer

Paypal fee adding causes "Amount Due" back to the customer

Posted: August 25, 2015 at 10:24 pm

Viewing 7 reply threads


Joshua Foshee

August 25, 2015 at 10:24 pm

I was trying to add a Paypal fee to the invoice. Lorenzo helped me with this on this posting “https://eventespresso.com/topic/add-free-to-paypal-payments/” but the problem we now have is that after the user pays and comes back to our website it shows they have overpaid and they now have a “Amount Due” to them of the fee back.

What would be the best to to accomplish event espresso not showing that an “amount due” back to them?


Merlin

August 26, 2015 at 2:37 am

hello there,

i have the same problem here.

i’ve managed the paypal fee for more than one different tickets payed at the time with this code. The fee will show up in position one in paypal and all tickets will follow.

function add_pp_args($args){
	
	$ppamtx = 0;
	
	for ($x = 1; $x <= 10; $x++){
		$ppamtx = $ppamtx + $args['amount_' . $x] * $args['quantity_' . $x];
	}
	
	for ($i = 10; $i >= 1; $i--) {
		
		$y = $i + 1;
		
		$args['item_name_' . $y] = $args['item_name_' . $i];
		$args['amount_' . $y] = $args['amount_' . $i];
		$args['quantity_' . $y] = $args['quantity_' . $i];
	}
	
	$pptax = ( ($ppamtx / 100 * 1.9) + 0.35);
	$pptax = number_format((float)$pptax, 2, '.', '');
	
	$args['item_name_1'] = "Paypal Buchungsgebuehr";
	$args['amount_1'] = $pptax;
	$args['quantity_1'] = 1;
		
	return $args;
}

add_filter('FHEE__EEG_Paypal_Standard__set_redirection_info__arguments','add_pp_args');

now the user sees that he has overpaid because EE thinks for example that the use must pay 10,00€ but the return value from paypal shows 10,54€.

maybe one way is to calculate the fee before it gets overhanded to paypal and integrate it in the EE payment overview or an other way is to remove the fee after the paypal payment process when its come back to EE and we can eliminate the “overpaid status”.

i’ve read here in the forum that a add-on is on the way for that problem. Is there a release date soon?

thanks in advance


Merlin

August 28, 2015 at 8:12 am

Hello support team,

has anyone a solution for that problem? Or is there a way to change the transaction status manually?

thanks in advance


Josh

  • Support Staff

September 9, 2015 at 3:55 pm

Hi Merlin,

It turns out you can change the transaction status manually by clicking the apply refund button. There it will autofill the overpaid amount, so all you do is save.

Another approach you could take is actually add a line item just before processing the payment using PayPal. This way PayPal gets told about it, and there’s a record in Event Espresso of the surcharge. Event Espresso has a method that allows for adding line items like these, you can learn more about it by reviewing the EEH_Line_Item::add_unrelated_item() method and its usage in the core code.


Merlin

September 15, 2015 at 11:44 am

hi josh,

thanks for your respond. i’ve tried some things but i didn’t get it to work. in the core code are not enough information for me to integrate this and i cant’t find any example.

do i have to integrate this code in the functions.php and can i add it into the add_p_args() function or anywhere else?

maybe you can give me an example for this code… thank you very much in advance.

merlin


Josh

  • Support Staff

September 15, 2015 at 12:09 pm

Hi Merlin,

I’m sorry I don’t have any examples to give outside of what core already does, and you can look in Event Espresso core code for examples on how it uses the method. In addition to where it uses in the unit tests (you’ll need the version from github to see the unit test folder), the Event Espresso PayPal standard gateway uses add_unrelated_item() to handle shipping that PayPal adds.


Merlin

September 15, 2015 at 3:26 pm

Hi josh,

thanks for your efforts. i think this is a level to high for me. i’ve tried some thinks in the EEG_Paypal_Standard.gateway.php. there is some code like EEH_Line_Item::add_unrelated_item():

if( $this->_paypal_shipping && floatval( $update_info[ 'mc_shipping' ] ) != 0 ){
			$this->_line_item->add_unrelated_item( $transaction->total_line_item(), __('Shipping', 'event_espresso'), floatval( $update_info[ 'mc_shipping' ] ), __('Shipping charges calculated by Paypal', 'event_espresso'), 1, FALSE,  'paypal_shipping' );
			$grand_total_needs_resaving = TRUE;
		}

i’ve tried to modify this but i didn’t get it to work. i hope there is a function in the core espresso where you can add fees to paypal in the future.

but do i understand it right that there is already a function in the core paypal checkout to add taxes and shippings to paypal? so what the code above means? and can i turn it on?

thanks


Josh

  • Support Staff

September 16, 2015 at 7:22 am

It turns out the currently released version of Event Espresso 4 core does not have code where tax added by PayPal gets integrated into the transaction. We have a separate branch, which you can download and review here, that adds this feature, and it’s a work in progress.

Viewing 7 reply threads

The support post ‘Paypal fee adding causes "Amount Due" back to the customer’ 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