Paypal智能按钮集成-有什么方法可以向order.create函数添加折扣优惠券/ SKU?

问题描述

我与我的电子商务网站集成了Paypal智能按钮。整个设置是:用户单击Paypal按钮->付款-> IPN呼叫我的后端->将数据保存到数据库。此流程对我来说很好。

我现在希望能够将折扣SKU传递给Paypal,以便我可以通过IPN调用将其捕获到数据库中。现在,只有折扣金额,即根据使用的优惠券代码发送到Paypal。

这是我当前的代码

                    purchase_units: [{
                        description: "Zing Energy Patches",amount: {
                            currency_code: currencyCode,value: (basePrice + shippingPrice + tax - creditPrice).toFixed(2),breakdown: {
                                item_total: {
                                    currency_code: currencyCode,value: basePrice
                                },shipping: {
                                    currency_code: currencyCode,value: shippingPrice
                                },tax_total: {
                                    currency_code: currencyCode,value: tax
                                },discount:{
                                    currency_code: currencyCode,value: creditPrice
                                }
                            }
                        },items: productsArray
                    }]
                });```

I tried adding the discount as an item with negative value,but Paypal rejected the request stating that negative values are not allowed.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)