3

enter image description here

i am add some extra fee in cart on base of some special conditions.It's work fine all all place in magento but now i think about add this fee to paypal standard.I am successful but it works only if Transfer Cart Line Items = No.

I want to work it where Transfer Cart Line Items = yes in paypal option.

Now i want one row on paypal bill with fee lable & value.

Paypal standard bill with Transfer Cart Line Items SET yes

It can come with tax and item total or items and shipping both option are good for me. Can any body help me?

1
3

I've managed to add extra lines in PayPal Standard cart using the paypal_prepare_line_items event.

In your module's config.xml:

<config>
    <global>
        <events>
            <paypal_prepare_line_items>
                <observers>
                    <paypal_prepare_line_items>
                        <class>your_module/observer</class>
                        <method>updatePaypalTotal</method>
                    </paypal_prepare_line_items>
                </observers>
            </paypal_prepare_line_items>
        </events>
    </global>
</config>

In your observer:

class Your_Module_Model_Observer
{
    public function updatePaypalTotal(Varien_Event_Observer $observer)
    {
        $feeAmount = <calculated somewhere...>

        /* @var $cart Mage_Paypal_Model_Cart */
        $cart = $observer->getEvent()->getPaypalCart();

        $cart->addItem('Fee label', 1, $feeAmount, 'fee');

        return $this;
    }
}
1
  • 2
    PayPal gateway has rejected request. The totals of the cart item amounts do not match order amounts (#10413: Transaction refused because of an invalid argument. See additional error messages for details). – Arvind07 Feb 19 '16 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.