【问题标题】:PayPal Rest API Subtotal equal to zeroPayPal Rest API 小计等于零
【发布时间】:2017-08-13 01:54:37
【问题描述】:

我目前正在我的网站上集成 PayPal Rest API。我能够这样做,但遇到了一个特殊情况的问题:

  • 商品价格:10.00 美元
  • 运费:5.00 美元
  • 小计:小计 (10.00 美元) - 优惠券折扣 (10.00 美元)
  • 税金:0.00 美元
  • 总金额:5.00 美元

根据上述内容,我需要要求客户仅支付订单运费(5.00 美元)。我的总金额等于运费 + 小计 + 税金 = 5.00 美元。但是,当我将此数据发送到 PayPal 时,我收到一个错误。

有没有办法解决这个问题?

【问题讨论】:

  • 您从贝宝收到什么错误?
  • 事实证明,更大的问题是在小计为0时为ItemList设置价格。错误是:项目金额必须加到指定金额小计(如果未指定金额详细信息,则为总计跨度>

标签: paypal


【解决方案1】:

Paypal RestAPI 不允许将小计作为 0 传递。 要解决此问题,您可以在进行 RestAPI 调用时修改代码。 检查下面的代码。

Amount amount = new Amount();
//check your condition here subtotal is greater than 0 or not or based on your scenario.
if (CheckSubTotalCondition)
{
 amount = new Amount()
 {
   total = totalAmount
   details = new Details()
   {
     shipping = shippingAmount,
     subtotal = subtotalAmount,
     tax = taxAmount
   }
 };
}
else
{
  amount = new Amount()
  {
    total = totalAmount
  };
}

【讨论】:

    猜你喜欢
    • 2015-11-01
    • 1970-01-01
    • 2014-07-02
    • 2018-06-17
    • 2014-12-08
    • 2016-04-06
    • 2013-09-13
    • 2021-09-30
    • 1970-01-01
    相关资源
    最近更新 更多