Dynamic Payment Surcharge Problem

hi i am try to build my bank payment gateway.

i have installments

i am checking installmens from bank api. and turn me differend installments values

i calculate installmens with :

Tygh::$app['session']['cart']['payment_surcharge'] = $turned_Value;
    Tygh::$app['session']['cart']['payment_surcharge_title'] = 'Commission';
    fn_calculate_payment_taxes(Tygh::$app['session']['cart'], $auth);

but when payment fnishing with :

fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
fn_order_placement_routines('route', $_REQUEST['order_id']);

turn default values. please i need advice how can fix this ?

i have to set under fn_update_payment_surcharge

payment_surcharge hook

than worked. anyone know different way without edit core files ?

I suggest you to use hooks in the fn_calculate_cart_content. If payment surcharge is to 0 for the payment, it will not be overriden

itry fn_calculate_cart_content hook. its doenst work. resetting after calculating

its working with this way. and second problem ....

i added another payment method working similar paypal.

turn me payment surcharge value

how can i update before success payment ? before fn_finish_payment

?

how can i update before success payment ? before fn_finish_payment

?

It is not clear what do you mean. Please clarify

$auth = Tygh::$app['session']['auth'];
$cart = Tygh::$app['session']['cart'];
fn_calculate_cart_content($cart,$auth);
fn_save_cart_content($cart, $auth['user_id']);
fn_update_order_data($_REQUEST['order_id'], $cart);

i try before fn_finish_payment

nothing ?


i want recalculate and update order before succes order placement. coz i am getting dynamic payment surcharge. i am adding this with private hook

What is purpose of this code? If you user hooks correctly, surcharge should exist in the session

check first post mate i am adding surcharge with private hook

Sorry, I thought you used hooks in the fn_calculate_cart_content function.

look i am getting response commission

$pp_response['reason_text'] .= 'Commission: ' . $raw_result['merchantCommissionRateAmount'];

i have to update exsist order surcharge with this i am try this

i checked now fn_calculate_cart_content doesnt call any surcharge

Payment surcharge is not applied until checkout and is based on what payment method is selected.

If you're wanting this to show as a fee and shown before checkout then you can add the data to the cart and then handle it using the PHP hook for 'calculate_cart_taxes_pre' and make the appropriate subtotal adjustment there. But you won't know what payment method the customer is using in the cart, only in checkout.

i sold the problem with fn_update_order before placing order. thanks for all