I think your problem is not the PayPal API.
You checked that everything works perfect with your parameters passed to paypal in this 50% discount case?
After the PayPal Documentation you should provide a negative value to reflect a discount on an order. So everything adds up to the total amount.
Source: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing
Update with code: (by Nick)
I have a paypal service that does all kinds of stuff, but the following code should give you an idea of how the discount works. The discount is not a special type, it's a product just like any other except it's disguised by naming it like a discount and setting it's price to a negative number.
List<PaymentDetailsItemType> items = paymentDetails.PaymentDetailsItem;
foreach (ShoppingCartItem item in cart.ShoppingCartItems)
{
items.Add(new PaymentDetailsItemType
{
Name = item.Book.Title,
Quantity = item.Quantity,
Number = item.BookId.ToString(),
Amount =
new BasicAmountType
{currencyID = CurrencyCodeType.USD,
value = (item.Book.Price).To2Places()}
});
}
if (cartTotals.Discount > 0)
{
items.Add(new PaymentDetailsItemType
{
Name = "Promo Code Discount",
Quantity = 1,
Number = "PromoCode",
Amount =
new BasicAmountType
{
currencyID = CurrencyCodeType.USD,
value = (cartTotals.Discount*-1).To2Places()
}
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…