Menu Close
    Hire us Request quote Reading list Switch to dark mode
    lockdownWebkulUp

    Manage custom amount with paypal Magento2

    Hello,

    If you want to manage custom fee in your magento, then you can follow following blogs to manage them.

    Add custom amount order total magento2

    Now if in an order you added some custom amount, and want to pay the payment by magento’s default paypal payment method, then it throws the error that, amount is not same as order amount.

    For example:

    I create an order for RS 800.

    and added RS -246 as a custom amount in my order.

     

    Now, if i am trying to place an order using paypal express payment method then it gives me error:

     

     

     

    Now, to solve this issue you have to manage that custom amount for the paypal process also.

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .

    To manage it in paypal payment method you can follow the given process:

    Add an observer in your module:

    file path: app/code/Webkul/Test/etc/events.xml


    Now define this observer, at path:

    app/code/Webkul/Test/Observer/AddCustomAmountItem.php


    Here, addCustomItem() function is added your custom amount field in cart, and then paypal manages the amount as well.

    in this, first parameter is,  the field name, i.e. amount field name.

    second parameter is, quantity for the field.

    third parameter is, amount, which you want to add, in example i added (-1.00 *), because i want to pass negative value.

    forth parameter is, identifier, i.e. id of your custom amount field.

    After this code your order will get placed using paypal payment method without any error.

    Hope this blog will help you in implementation of functionality in magento.

    Thank you.

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close