Add Custom Extra Charge to Checkout

Hello all.

I’ve investigated the way of adding custom global options and variants, shipping methods etc.



But my need is the following:

There is a custom javascript / php function which re-calculates a given price based on a specific mathematical type with 3 parameters one of which is the initial product price.



I have the function and need to implement it on the total cart subtotal but i haven’t found the way.



The customer should be able to select a value from a select box once, for example selecting payment method and afterwords all product prices (subtotal) should be calculated based on the custom function i have passing to the function the subtotal and the value the user selected from the select box.



I didn’t find the way to do this, so i want to help me giving some directions.