Ankur
Ankur

Reputation: 13

Adding a discount amount to payment request to PAYPAL through REST API

I am using PAYPAL Rest API for payment transaction. I am calling context(/v1/payments/payment) for authorization and passing the ItemList as part of Transaction object.

Requirement: To Display Discount/GiftCard amount as part of the ItemList on the Paypal authentication page.

Problem: The API doesn't allow to put negative amount to an item and validation error is thrown.

Can anyone tell me if it is possible to display discount/gift card negative amount. (It is possible in Classic API though)

Upvotes: 1

Views: 5702

Answers (1)

Vimalnath
Vimalnath

Reputation: 6463

Negative amount are supported now. For example in PHP SDK you can pass -ve values as line item.

$item1 = new Item();
$item1->setName('Ground Coffee 40 oz')
    ->setCurrency('USD')
    ->setQuantity(1)
    ->setPrice('5.00');
$item2 = new Item();
$item2->setName('Discount')
    ->setCurrency('USD')
    ->setQuantity(1)
    ->setPrice('-2.00');

enter image description here

Upvotes: 8

Related Questions