如何在 Paypal SOAP API 快速结账中设置运费

Posted

技术标签:

【中文标题】如何在 Paypal SOAP API 快速结账中设置运费【英文标题】:How to set shipping charges in Paypal SOAP API express checkout 【发布时间】:2012-08-10 04:00:29 【问题描述】:

我正在添加 20.00 的项目并将订单总额设置为 22.00

 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.

请帮忙

【问题讨论】:

我的情况完全一样,想知道您是否找到了解决方案?在文档中找不到任何关于它的内容:cms.paypal.com/us/cgi-bin/… 你是否也有:SetExpressCheckoutRequestDetailsType sdt = new SetExpressCheckoutRequestDetailsType(); sdt.ShippingMethod = ShippingServiceCodeType.CustomCode; sdt.ShippingMethodSpecified = true; 【参考方案1】:

您错过了设置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)
    
;

【讨论】:

以上是关于如何在 Paypal SOAP API 快速结账中设置运费的主要内容,如果未能解决你的问题,请参考以下文章

Paypal 快速结账与 PayPal REST API 的集成

通过 PHP SOAP SDK 使用“买家在 PayPal 上付款”

PayPal SOAP API - 快速结帐 - 错误 10002

PHP PayPal API 快速结帐

如何在结账时重置送货地址paypal?

快速结账或基本 HTML 代码中的 Paypal 订阅 MAXFAILEDPAYMENTS 设置