2012-08-13 85 views
0

我加入的20.00的項目,訂單總額設置爲22.00如何設置貝寶SOAP API快速結帳運費

paymentDetails.OrderTotal = new PayPalSandboxWS.BasicAmountType() 
    { 
     currencyID = ConvertProgramCurrencyToPayPalSandbox(currency), 
     Value = "22.00" 
    }; 

和航運總設置爲2.00

paymentDetails.ShippingTotal = new PayPalSandboxWS.BasicAmountType() 
    { 
     currencyID = ConvertProgramCurrencyToPayPalSandbox(currency), 
     Value = "2.00" 
    }; 

但我收到此錯誤:The totals of the cart item amounts do not match order amounts.

請協助

+0

我有完全相同的,想知道如果你找到了解決方案?在文檔中找不到關於它的任何內容:https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout – 2012-08-17 12:22:23

+0

您是否還擁有:SetExpressCheckoutRequestDetailsType sdt = new SetExpressCheckoutRequestDetailsType() ; sdt.ShippingMethod = ShippingServiceCodeType.CustomCode; sdt.ShippingMethodSpecified = true; – 2012-08-17 12:29:23

回答

1

幽祕ssed設定值爲ItemTotal!這導致這個錯誤:

double itemTot = 20.0; 
double tot  = 22.0; 
double shipping = 2.0; 
string desc  = ""; 
var paymentDetailsItemTypes = new List<PaymentDetailsItemType>(); 

PaymentDetailsType pdt = new PaymentDetailsType() 
{   
    OrderDescription = desc, 
    OrderTotal = new BasicAmountType() 
    { 
     currencyID = CurrencyCodeType.EUR, 
     Value = tot.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) 
    }, 
    PaymentDetailsItem = paymentDetailsItemTypes.ToArray(), 
    ShippingTotal = new BasicAmountType() 
    { 
     currencyID = CurrencyCodeType.EUR, 
     Value = shipping.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) 
    }, 
    ItemTotal = new BasicAmountType() 
    { 
     currencyID = CurrencyCodeType.EUR, 
     Value = itemTot.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture) 
    } 
};