The code in this download folder enables you to add a fee by percentage of the cart total and a flat fee on top of the sub total. Or, you can add a percentage fee only or a flat fee only. All fees are added according to which payment option is selected at the checkout as seen in the demo video.
On the Edit product screen, go to Product Data – Simple Product and add values for a total percentage fee and/or a flat fee for each payment provider.
Install the download zip folder as a new plugin or copy & paste the PHP code to the end of your child themes functions.php file or custom functionality plugin.
These solutions may also help :