PayPal Express将折扣应用于ItemTotal / SubTotal

时间:2012-10-11 04:15:34

标签: c# asp.net paypal

PayPalExpress version 95.0 ASP.Net& C#

CurrencyCodeType currency = (CurrencyCodeType)
   Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue);
PaymentDetailsType paymentDetails = new PaymentDetailsType();
paymentDetails.ShippingTotal = new BasicAmountType(currency, shippingTotal.Value);
paymentDetails.ItemTotal = new BasicAmountType(currency, itemTotal.ToString());
paymentDetails.OrderTotal = new BasicAmountType(currency, orderTotal.ToString());

我只看到ShippingDiscount。我想知道 如何在ItemTotal / SubTotal上应用折扣 (不在单个项目上)。

enter image description here

我在SO中找到Paypal Express Checkout: Apply order discount,但答案是关于个别项目折扣。

感谢您的帮助!

1 个答案:

答案 0 :(得分:3)

OMG!刚想通了!这是正确的,你必须添加另一项作为折扣项目。困难的部分是让子/总数正确!

这是我的SUCCESS提交:

array(14) {
    //  ERROR AREA 1    //  Total Amount of Items (including -Discount) and shipping and tax
    ["PAYMENTREQUEST_0_AMT"]
            =>  string(4) "9.71"
    //  ERROR AREA 2    //  Total Amount of items ONLY, including the -Discount!
    ["PAYMENTREQUEST_0_ITEMAMT"]
            =>  string(4) "6.76"
    ["PAYMENTREQUEST_0_SHIPPINGAMT"]
            =>  string(4) "2.95"
    ["PAYMENTREQUEST_0_TAXAMT"]
            =>  string(1) "0"

    /*  ITEMS   */

        /*  ITEM 01 */
    ["L_PAYMENTREQUEST_0_NAME0"]
            =>  string(18) "Order # 987654"
    ["L_PAYMENTREQUEST_0_AMT0"]
            =>  float(12.51)
    ["L_PAYMENTREQUEST_0_NUMBER0"]
            =>  string(6) "987654"
    ["L_PAYMENTREQUEST_0_QTY0"]
            =>  float(1)
    ["L_PAYMENTREQUEST_0_ITEMCATEGORY0"]
            =>  string(8) "Physical"

        /*  ITEM 02 */
        /*  ¡THE DISCOUNT!  */
    ["L_PAYMENTREQUEST_0_NAME1"]
            =>  string(9) "PromoCode"
    ["L_PAYMENTREQUEST_0_AMT1"]
            =>  float(-5.75)
    ["L_PAYMENTREQUEST_0_NUMBER1"]
            =>  string(18) "Promo 123456"
    ["L_PAYMENTREQUEST_0_QTY1"]
            =>  float(1)
    ["L_PAYMENTREQUEST_0_ITEMCATEGORY1"]
            =>  string(8) "Physical"
}

成功!

array(6) {
    ["TOKEN"]
        =>  string(20) "NOTIMPORTANT"
    ["TIMESTAMP"]
        =>  string(20) "2014-10-03T12:39:06Z"
    ["CORRELATIONID"]
        =>  string(12) "NOTIMPORTANT"
    ["ACK"]
        =>  string(7) "SUCCESS"
    ["VERSION"]
        =>  string(2) "93"
    ["BUILD"]
        =>  string(8) "13154493"
}

  

是的,我知道这个问题已经过时了,但我无法在其他任何有效的地方找到答案。所以这是我的工作解决方案!