[Skip to main content](#vessel-content)

#   Additional fees (subtotal) not transmitted to checkout paiement gateway

##

- **[consultech](/forum/user/13290-consultech "View consultech's Profile")**
- [![consultech's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13290-consultech "View consultech's Profile") Topic Author
- [ Offline](/forum/user/13290-consultech)

Less More

- Posts: 54
- Thank you received: 2
-
-

7 years 2 months ago [\#311273](#311273) by [consultech](/forum/user/13290-consultech "View consultech's Profile")  *[Additional fees (subtotal) not transmitted to checkout paiement gateway](/forum/27-checkout/898341-additional-fees-subtotal-not-transmitted-to-checkout-paiement-gateway#311273 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.11 -- PHP version -- : 7.2.20  Hello,  I'm making a specific « donation » plugin. I think all working well, with trigger onAfterCartProductsLoad(&amp;$cart) for adding $cart-&gt;additonal amount of donation like this :  $cartClass=hikashop&#95;get('class.cart'); $currencyClass = hikashop&#95;get('class.currency'); $currency&#95;id = hikashop&#95;getCurrency();  $donation = new stdClass(); $donation-&gt;name = 'Don '.$this-&gt;params-&gt;get('title', 'Don Caritatif'); // $additional-&gt;value = ''; $donation-&gt;price&#95;currency&#95;id = $currency&#95;id; $donation-&gt;price&#95;value = floatval($amount); $donation-&gt;price&#95;value&#95;with&#95;tax = floatval($amount);  $cart-&gt;additional&#91;$this-&gt;name&#93;=$donation; $cartClass-&gt;save($cart);  the $cart is successfully saved on db, but on next step, to the payment gateway, amount of donation not added on final total to pay and when I cancel or return to the cart, the additional amount of donation is missing... (on db too).  What's wrong ?  Thank-you in advance for your help.")* was created by *[consultech](/forum/user/13290-consultech "View consultech's Profile")*

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.11
-- PHP version -- : 7.2.20

Hello,

I'm making a specific « donation » plugin. I think all working well, with trigger **onAfterCartProductsLoad(&amp;$cart)** for adding $cart-&gt;additonal amount of donation like this :

$cartClass=hikashop_get('class.cart');
$currencyClass = hikashop_get('class.currency');
$currency_id = hikashop_getCurrency();

$donation = new stdClass();
$donation-&gt;name = 'Don '.$this-&gt;params-&gt;get('title', 'Don Caritatif');
// $additional-&gt;value = '';
$donation-&gt;price_currency_id = $currency_id;
$donation-&gt;price_value = floatval($amount);
$donation-&gt;price_value_with_tax = floatval($amount);

$cart-&gt;additional[$this-&gt;name]=$donation;
$cartClass-&gt;save($cart);

the $cart is successfully saved on db, but on next step, to the payment gateway, amount of donation not added on final total to pay and when I cancel or return to the cart, the additional amount of donation is missing... (on db too).

What's wrong ?

Thank-you in advance for your help.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5ODM0MS1hZGRpdGlvbmFsLWZlZXMtc3VidG90YWwtbm90LXRyYW5zbWl0dGVkLXRvLWNoZWNrb3V0LXBhaWVtZW50LWdhdGV3YXk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

7 years 2 months ago [\#311284](#311284) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Additional fees (subtotal) not transmitted to checkout paiement gateway](/forum/27-checkout/898341-additional-fees-subtotal-not-transmitted-to-checkout-paiement-gateway#311284 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.11 -- PHP version -- : 7.2.20  Hello,  I'm making a specific « donation » plugin. I think all working well, with trigger onAfterCartProductsLoad(&amp;$cart) for adding $cart-&gt;additonal amount of donation like this :  $cartClass=hikashop&#95;get('class.cart'); $currencyClass = hikashop&#95;get('class.currency'); $currency&#95;id = hikashop&#95;getCurrency();  $donation = new stdClass(); $donation-&gt;name = 'Don '.$this-&gt;params-&gt;get('title', 'Don Caritatif'); // $additional-&gt;value = ''; $donation-&gt;price&#95;currency&#95;id = $currency&#95;id; $donation-&gt;price&#95;value = floatval($amount); $donation-&gt;price&#95;value&#95;with&#95;tax = floatval($amount);  $cart-&gt;additional&#91;$this-&gt;name&#93;=$donation; $cartClass-&gt;save($cart);  the $cart is successfully saved on db, but on next step, to the payment gateway, amount of donation not added on final total to pay and when I cancel or return to the cart, the additional amount of donation is missing... (on db too).  What's wrong ?  Thank-you in advance for your help.")*

Hi,

From what I understand of your message, you're saying that after being redirected to the payment gateway for the payment the amount of the additional fee is missing there.
So the first thing is to check the order in the backend of HikaShop. Do you have the additional fee there and is the total amount correct ?
If so, the problem is in the payment plugin used to integrate with the payment gateway which doesn't take into account additional fees.
Normally, most payment plugins send the full total of the order so it should work just fine.
However, a few payment gateways require the plugin to send the details of the order and then the payment gateway calculate itself the total. That's the case with the PayPal standard plugin when you activate the "send order details" setting of the plugin. However, the PayPal plugin supports additional fees as far as I know.
I guess I would need more information on which payment gateway you're using for your tests and how you configured the payment plugin to be able to say more on what's wrong exactly.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5ODM0MS1hZGRpdGlvbmFsLWZlZXMtc3VidG90YWwtbm90LXRyYW5zbWl0dGVkLXRvLWNoZWNrb3V0LXBhaWVtZW50LWdhdGV3YXk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[consultech](/forum/user/13290-consultech "View consultech's Profile")**
- [![consultech's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13290-consultech "View consultech's Profile") Topic Author
- [ Offline](/forum/user/13290-consultech)

Less More

- Posts: 54
- Thank you received: 2
-
-

7 years 2 months ago -  7 years 2 months ago [\#311308](#311308) by [consultech](/forum/user/13290-consultech "View consultech's Profile")  Replied by *[consultech](/forum/user/13290-consultech "View consultech's Profile")* on topic *[Additional fees (subtotal) not transmitted to checkout paiement gateway](/forum/27-checkout/898341-additional-fees-subtotal-not-transmitted-to-checkout-paiement-gateway#311308 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.11 -- PHP version -- : 7.2.20  Hello,  I'm making a specific « donation » plugin. I think all working well, with trigger onAfterCartProductsLoad(&amp;$cart) for adding $cart-&gt;additonal amount of donation like this :  $cartClass=hikashop&#95;get('class.cart'); $currencyClass = hikashop&#95;get('class.currency'); $currency&#95;id = hikashop&#95;getCurrency();  $donation = new stdClass(); $donation-&gt;name = 'Don '.$this-&gt;params-&gt;get('title', 'Don Caritatif'); // $additional-&gt;value = ''; $donation-&gt;price&#95;currency&#95;id = $currency&#95;id; $donation-&gt;price&#95;value = floatval($amount); $donation-&gt;price&#95;value&#95;with&#95;tax = floatval($amount);  $cart-&gt;additional&#91;$this-&gt;name&#93;=$donation; $cartClass-&gt;save($cart);  the $cart is successfully saved on db, but on next step, to the payment gateway, amount of donation not added on final total to pay and when I cancel or return to the cart, the additional amount of donation is missing... (on db too).  What's wrong ?  Thank-you in advance for your help.")*

Hi Nicolas,

Thank-you for your response. I think the probleme is at my level, after checking the orders test, I can't see my additonal fees and order_full_price is correct without them. maybe I must adding a trigger function onBeforeOrderCreate(&amp;$order, &amp;$do) to add my additinal fees ?

my code is largely inspired from userpoint plugin : Code:

function onAfterCheckoutStep($controllerName, &amp;$go_back, $original_go_back, &amp;$controller) { if($controllerName != 'plg.shop.donation') return; $app = JFactory::getApplication(); $amount = $_REQUEST['donation']; $app-&gt;setUserState(HIKASHOP_COMPONENT.'.donation_value', $amount); $checkoutHelper = hikashopCheckoutHelper::get(); $cart = $checkoutHelper-&gt;getCart(); $cart_id = (int)$cart-&gt;cart_id; $cart = $checkoutHelper-&gt;getCart(); $cart_id = (int)$cart-&gt;cart_id; unset($cart); $cartClass = hikashop_get('class.cart'); $cartClass-&gt;get('reset_cache', $cart_id); $cartClass-&gt;getFullCart($cart_id); $cart = $checkoutHelper-&gt;getCart(true); $cartClass-&gt;save($cart); return true; }

Thank you for clarifications.

Last edit: 7 years 2 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5ODM0MS1hZGRpdGlvbmFsLWZlZXMtc3VidG90YWwtbm90LXRyYW5zbWl0dGVkLXRvLWNoZWNrb3V0LXBhaWVtZW50LWdhdGV3YXk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

7 years 2 months ago [\#311326](#311326) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Additional fees (subtotal) not transmitted to checkout paiement gateway](/forum/27-checkout/898341-additional-fees-subtotal-not-transmitted-to-checkout-paiement-gateway#311326 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.11 -- PHP version -- : 7.2.20  Hello,  I'm making a specific « donation » plugin. I think all working well, with trigger onAfterCartProductsLoad(&amp;$cart) for adding $cart-&gt;additonal amount of donation like this :  $cartClass=hikashop&#95;get('class.cart'); $currencyClass = hikashop&#95;get('class.currency'); $currency&#95;id = hikashop&#95;getCurrency();  $donation = new stdClass(); $donation-&gt;name = 'Don '.$this-&gt;params-&gt;get('title', 'Don Caritatif'); // $additional-&gt;value = ''; $donation-&gt;price&#95;currency&#95;id = $currency&#95;id; $donation-&gt;price&#95;value = floatval($amount); $donation-&gt;price&#95;value&#95;with&#95;tax = floatval($amount);  $cart-&gt;additional&#91;$this-&gt;name&#93;=$donation; $cartClass-&gt;save($cart);  the $cart is successfully saved on db, but on next step, to the payment gateway, amount of donation not added on final total to pay and when I cancel or return to the cart, the additional amount of donation is missing... (on db too).  What's wrong ?  Thank-you in advance for your help.")*

Hi,

The code you posted in your last message does two things after your own custom step:
- it adds the donation amount in the session of the user
- it loads the cart and saves it (for no reason)

This in itself won't add your donation fee to the cart/order.
The code in your first message looks good, but I don't know where you have it or where you get $amount from.
Normally, I would recommend to add that code in the onAfterCartProductsLoad trigger and set the $amount variable with the amount you stored in the session (from your second piece of code).
Then, it should work properly.

The following user(s) said Thank You: [consultech](/forum/user/13290-consultech "View consultech's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5ODM0MS1hZGRpdGlvbmFsLWZlZXMtc3VidG90YWwtbm90LXRyYW5zbWl0dGVkLXRvLWNoZWNrb3V0LXBhaWVtZW50LWdhdGV3YXk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[consultech](/forum/user/13290-consultech "View consultech's Profile")**
- [![consultech's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13290-consultech "View consultech's Profile") Topic Author
- [ Offline](/forum/user/13290-consultech)

Less More

- Posts: 54
- Thank you received: 2
-
-

7 years 2 months ago [\#311350](#311350) by [consultech](/forum/user/13290-consultech "View consultech's Profile")  Replied by *[consultech](/forum/user/13290-consultech "View consultech's Profile")* on topic *[Additional fees (subtotal) not transmitted to checkout paiement gateway](/forum/27-checkout/898341-additional-fees-subtotal-not-transmitted-to-checkout-paiement-gateway#311350 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.11 -- PHP version -- : 7.2.20  Hello,  I'm making a specific « donation » plugin. I think all working well, with trigger onAfterCartProductsLoad(&amp;$cart) for adding $cart-&gt;additonal amount of donation like this :  $cartClass=hikashop&#95;get('class.cart'); $currencyClass = hikashop&#95;get('class.currency'); $currency&#95;id = hikashop&#95;getCurrency();  $donation = new stdClass(); $donation-&gt;name = 'Don '.$this-&gt;params-&gt;get('title', 'Don Caritatif'); // $additional-&gt;value = ''; $donation-&gt;price&#95;currency&#95;id = $currency&#95;id; $donation-&gt;price&#95;value = floatval($amount); $donation-&gt;price&#95;value&#95;with&#95;tax = floatval($amount);  $cart-&gt;additional&#91;$this-&gt;name&#93;=$donation; $cartClass-&gt;save($cart);  the $cart is successfully saved on db, but on next step, to the payment gateway, amount of donation not added on final total to pay and when I cancel or return to the cart, the additional amount of donation is missing... (on db too).  What's wrong ?  Thank-you in advance for your help.")*

Thank-you Nicolas,

Because I wanted to refresh (in ajax) view of current checkout step in page (donation block and cart details), the only way I've found is with function onAfterCheckoutStep trigger and job is done with onAfterCartProductsLoad function where I get my session variable $amount.

I'm just understanding how it work and now it's perfect. Thank-you for your help.

Regards,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5ODM0MS1hZGRpdGlvbmFsLWZlZXMtc3VidG90YWwtbm90LXRyYW5zbWl0dGVkLXRvLWNoZWNrb3V0LXBhaWVtZW50LWdhdGV3YXk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.055 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
