Paypal Express - 添加折扣
我目前正在向 Paypal Express 发送常规交易,并且正在顺利到达网关.
I'm currently posting a regular transaction to Paypal Express and am reaching the gateway without error.
我现在想配置我的购物车以向网关发送折扣.我的第一个想法是修改发送到网关的AMT"值.但是,Paypal 似乎通过计算 ITEMAMT
、TAXAMT
和 SHIPPINGAMT
字段的总数来验证AMT"字段,以确保总数为不变:
I would like to now configure my cart to send a discount to the gateway. My first thought was to modify the 'AMT' value that is sent to the gateway. However, it seems that Paypal validates the 'AMT' field by calculating the total of the ITEMAMT
, TAXAMT
and SHIPPINGAMT
fields to ensure the total is unchanged:
[L_AMT0] => 49.99
[L_NUMBER0] => 3706{3}8
[L_QTY0] => 1
[L_TAXAMT0] => 0.00
[ITEMAMT] => 49.99
[TAXAMT] => 0
[SHIPPINGAMT] => 14.95
[AMT] => 64.94
我向 Paypal 发送多少折扣?我已经查看了我能找到的文档,但没有运气;SO上的类似问题也无济于事.谢谢.
How many I send a discount to Paypal? I have looked through what documentation I can find, with no luck; the similar questions here on SO were no help, either. Thanks.
编辑:我注意到我可以通过字段SHIPDISCMT
.我不知道这是否能让我做我需要它做的事情 - 我仍然收到表明某些内容不匹配"的错误.
Edit: I've noticed I can pass through the field SHIPDISCAMT
. I don't know if this will let me do what I need it to though - I am still getting errors that indicate soemthing is 'mismatched'.
推荐答案
知道了.
事实证明,您可以将负金额作为订单项传递并自己将其标记为折扣.我不得不添加上面的代码:
It turns out that you can pass a negative amount through as a line item and label it as a discount yourself. I had to add the above code:
$params['L_NAME1'] = 'Discount Coupon';
$params['L_AMT1'] = -$discountCodeAmount;
$params['L_QTY1'] = 1;
$params['ITEMAMT'] -= $discountCodeAmount;
$params['AMT'] -= $discountCodeAmount;
这产生了以下效果:
我在此 PDF 中找到了答案:
I found my answer in this PDF:
https://cms.paypal.com/cms_content/CA/en_US/files/developer/PP_ExpressCheckout_IntegrationGuide.pdf
出于某种原因,我读过的其他几篇 PayPal express 官方文章/文件中没有提供该信息.
For some reason, that information was not given in several other official PayPal express articles/documents I had read.
相关文章