贝宝快速结账:应用顺序折扣 [英] Paypal Express Checkout: Apply order discount

查看:152
本文介绍了贝宝快速结账:应用顺序折扣的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有电子商务网站运行ZNode。送税,运费,订单总额,等等,直到施加订单水平的折扣一切正常(比如50%)。我们从贝宝,上面写着以下内容的响应:

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,用户申请优惠码上我们的网站,然后被转移到贝宝。

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。
你检查发现一切都运行完美你的参数传递到PayPal在这50%的折扣呢?

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

更新的代码(由尼克)

我有一个PayPal服务,做各种东西,但下面的代码应该给你的折扣是如何工作的。折扣是不是一种特殊类型,它就像任何其他的,除了它是通过命名它像一个折扣,设定它的价格为负数变相的产品。

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

这篇关于贝宝快速结账:应用顺序折扣的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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