'Paypal Express Checkout: Apply order discount

Have an ecommerce site running ZNode. We send tax, shipping, order total, etc. Everything works fine until an order level discount is applied (say 50%). We get a response from PayPal that says the following:

The totals of the cart item amounts do not match order amounts.

I'm traversing the API, and I can't find anything to apply an order level discount. FWIW, the user is applying discount codes on our site, and then is being transferred to PayPal.



Solution 1:[1]

Another option for sending a discount via the PayPal API use the PAYMENTREQUEST_n_SHIPDISCAMT

Which is actually a shipping discount, but works just fine, and is a one line.

But it does say shipping discount at the PalPal end.

Solution 2:[2]

Add the discount value to the PAYMENTREQUEST_0_ITEMAMT parameter and it will works fine.

In other words, if you consider your discount as a product, passing it through L_PAYMENTREQUEST_0_NAME(i), L_PAYMENTREQUEST_0_AMT(i) and L_PAYMENTREQUEST_0_QTY(i), then you have to sum the discount value to the products value and pass the result into the PAYMENTREQUEST_0_ITEMAMT param.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TheAlbear
Solution 2 Fabio