Support

Home Forums Event Espresso Premium Adding Paypal Surcharge Fee

Adding Paypal Surcharge Fee

Posted: March 15, 2017 at 9:56 am


sarahschaef

March 15, 2017 at 9:56 am

I’d like to have a surcharge for the paypal fee. I found this code, but I doesn’t work. The extra fee is not adding to the paypal cart.

function add_pp_args($args){

	$ppamt = $args['amount_1'] + $args['tax_cart'];
	$ppamt = ( ($ppamt * .026) + .30 ); 
	$ppamt = number_format((float)$ppamt, 2, '.', '');
	//remove debug
	foreach($args as $key => $val) if( substr($key,-2) == '_2' ) unset($args[$key]);
	$args['item_name_2'] = "Booking and Service Fee";
	$args['amount_2'] = $ppamt;
	$args['quantity_2'] = 1;
	return $args;
}

add_filter('FHEE__EEG_Paypal_Standard__set_redirection_info__arguments','add_pp_args');

I’m using EE4.. Is that above method working just for Paypal Stardard? I think EE4 works just with Paypal Express, right?


Tony

  • Support Staff

March 15, 2017 at 10:08 am

Hi Sarah,

EE4 used to only use PayPal standard which is where the above snippet came from, however we now ship with PayPal Express which uses a different filter:

FHEE__EEG_Paypal_Express__set_redirection_info__arguments

however the code for the above will also be different as Express uses different arguments than standard.

Before moving forward do you know its against PayPals user agreement to charge a surcharge specifically for PayPal transactions?

https://www.paypal.com/ie/webapps/mpp/ua/useragreement-full
(Point 4.4)


sarahschaef

March 15, 2017 at 1:07 pm

My client said she called PayPal and they said we can do it… We will put something on the site telling buyer why there is the surcharge (as the agreement says).

ok so… let me know how can I fix the code. Thanks!


sarahschaef

March 16, 2017 at 11:58 am

Can you give me the update code to make it work with paypal express?

function add_pp_args($args){

	$ppamt = $args['amount_1'] + $args['tax_cart'];
	$ppamt = ( ($ppamt * .026) + .30 ); 
	$ppamt = number_format((float)$ppamt, 2, '.', '');
	//remove debug
	foreach($args as $key => $val) if( substr($key,-2) == '_2' ) unset($args[$key]);
	$args['item_name_2'] = "Booking and Service Fee";
	$args['amount_2'] = $ppamt;
	$args['quantity_2'] = 1;
	return $args;
}

add_filter('FHEE__EEG_Paypal_Standard__set_redirection_info__arguments','add_pp_args');


Josh

  • Support Staff

March 20, 2017 at 11:30 am

Hi there,

I’m not so sure the code for PayPal Standard can be “fixed” as it were so it’d just work with PayPal Express. I can probably point you in the direction for how to achieve recouping the costs of using PayPal versus the other payment method. May I ask, what are the other payment methods activated on their site? Are they Invoice, Check, something else?


sarahschaef

March 23, 2017 at 4:03 pm

I have the check option and paypal express. Yes let me know the direction to solve this issue. Thanks


Josh

  • Support Staff

March 24, 2017 at 4:26 pm

The direction I recommend going would be to tack on the prices into the tickets. So for example you add 3% to the ticket price, or even add a price modifier at 3% in the advanced part of the ticket editor (which will take care of the calculation for you).

This way the prices on the website will match the prices that the PayPal customers will pay, (which will avoid the surprises later).

Then, you add some code to the site that will give Check payment customers a discount that matches the offset to cover the fees. Here’s a link to some example code:

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

You’ll need to change lines 10-14 to your liking, and line 15 so it sets the discount to apply to the check payment method:

$cart_modifier_name = 'my cart % discount';
$cart_modifier_amount = -3.00;
$cart_modifier_description = '3% discount for choosing check payment method';
$cart_modifier_taxable = false; // or true if discount is taxable
$payment_methods_with_surcharges = array( 'check' );

You can add the code to a functions plugin, then activate the plugin.

The support post ‘Adding Paypal Surcharge Fee’ 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