If ever you needed to add fees on checkout based on the chosen payment method, then this is what you are looking for.
Just copy and paste this on your functions.php of the current theme and it should work.
What this would do is in the checkout page, if a customer chooses paypal as payment, additional fee will be calculated…
What you need to do is change the value of $fee to your desired value. Any value. You can also do some calculations and apply it to $fee.
Change ‘paypal’ on line 13 with your payment gateway in mind. No other changes needed on the code except if you really need to.

	$fee = 2;
	// or calculate your $fee with all the php magic...
        // $fee = WC()->cart->cart_contents_total * .025; // sample computation for getting 2.5% of the cart total.
	if ( $chosen_gateway == 'paypal' ) { //test with paypal method
		WC()->cart->add_fee( 'Paypal fee', $fee, false, '' );
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_fee' );
function cart_update_script() {
    if (is_checkout()) :