I have added surcharge fee and its working fine with cash on delivery payment method but not working with paypal express checkout.
Hello @neha_
you need to create event for add custom amount
<event name="payment_cart_collect_items_and_amounts"> <observer name="paypal_prepare_line_items_customercredit" instance="ModuelName\Namespace\Observer\AddAmount" /> </event>
AddAmount.php you need to add a custom amount
namespace ModuelName\Namespace\Observer; use Magento\Framework\Event\ObserverInterface; class AddAmount implements ObserverInterface { public function execute(\Magento\Framework\Event\Observer $observer) { $cart=$observer->getEvent()->getCart(); $cart->addCustomItem('SubCharge','1',10 );//10 means your subscharge amount return $this; } }
Hope it will help you.
@Sunil Patel, Yes I exactly done this but the issue is Paypal's 'AMT' index is showing old amount that is without surcharge but this code update the subtotal not grand total amount of paypal.