April 14 2015

Paypal rest API add discount on the total amount

Tagged Under :

On Paypal rest APi, it don’t have a specifies discount function for the payment. And you are not allow minus the discount price from the total amount, because Paypal itself will add all the items total price when you submit. If the total price are different with the amount you set. It will return an error for you.

The simple way to set the discount price in Paypal APi. you can set the discount as an item. For example to set the discount.
$item3 = new Item();
$item3->setName('Voucher Discount')
    ->setDescription('Voucher Discount')
Remember you must set the price as ‘-10’ no -10. If the latter´╝î it will become 0 and then the total items prices will different with the Total amount you set inside the Transaction. Once it different Paypal will return an error for you.

Make a Comment

You must be logged in to post a comment.