Paypal Express Checkout:应用订单折扣 [英] Paypal Express Checkout: Apply order discount

查看:17
本文介绍了Paypal Express Checkout:应用订单折扣的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拥有一个运行 ZNode 的电子商务网站.我们发送税金、运费、订单总额等.一切正常,直到应用订单级折扣(比如 50%).我们收到 PayPal 的回复,内容如下:

Have an ecommerce site running ZNode. We send tax, shipping, order total, etc. Everything works fine until an order level discount is applied (say 50%). We get a response from PayPal that says the following:

购物车商品总金额与订单金额不符.

The totals of the cart item amounts do not match order amounts.

我正在遍历 API,但找不到任何可以应用订单级别折扣的内容.FWIW,用户正在我们的网站上申请折扣代码,然后被转移到 PayPal.

I'm traversing the API, and I can't find anything to apply an order level discount. FWIW, the user is applying discount codes on our site, and then is being transferred to PayPal.

推荐答案

我认为您的问题不是 PayPal API.在这个 50% 的折扣案例中,您检查过传递给 paypal 的参数是否一切正常?

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?

在 PayPal 文档之后,您应该提供一个负值以反映订单的折扣.所以所有的东西加起来就是总金额.

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.

来源:https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing

更新代码:(尼克)

我有一个可以做各种事情的贝宝服务,但下面的代码应该能让你了解折扣是如何运作的.折扣不是特殊类型,它和其他任何产品一样,只是通过将其命名为折扣并将其价格设置为负数来伪装.

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()
                                      }
                          });
        }

这篇关于Paypal Express Checkout:应用订单折扣的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆