带税的SetExpressCheckout,购物车项目金额的总数与订单金额不匹配

时间:2013-10-17 07:02:11

标签: java paypal

我有以下代码从paypal获取令牌,但不知何故,paypal继续向我发送错误消息,说明购物车项目的总数与订单金额不符。我在这里做错了什么?

                    <ebl:PaymentDetails>
                    <ebl:OrderTotal currencyID="USD">21.70</ebl:OrderTotal>
                    <ebl:TaxTotal currencyID="USD">1.70</ebl:TaxTotal>
                    <ebl:ButtonSource>PayPal_SDK</ebl:ButtonSource>
                    <ebl:PaymentDetailsItem>
                        <ebl:Name>Product A</ebl:Name>
                        <ebl:Quantity>1</ebl:Quantity>
                        <ebl:Tax currencyID="USD">1.70</ebl:Tax>
                        <ebl:Amount currencyID="USD">20.00</ebl:Amount>
                    </ebl:PaymentDetailsItem>
                </ebl:PaymentDetails>

如果我合并税金和金额,它会按预期工作(参见下面的示例)。我想分税,以便用户知道他们为产品支付了多少税。

                    <ebl:PaymentDetails>
                    <ebl:OrderTotal currencyID="USD">21.70</ebl:OrderTotal>
                    <ebl:ButtonSource>PayPal_SDK</ebl:ButtonSource>
                    <ebl:PaymentDetailsItem>
                        <ebl:Name>Product A</ebl:Name>
                        <ebl:Quantity>1</ebl:Quantity>
                        <ebl:Amount currencyID="USD">21.70</ebl:Amount>
                    </ebl:PaymentDetailsItem>
                </ebl:PaymentDetails>

1 个答案:

答案 0 :(得分:1)

好的,所以我需要包含itemTotal,taxTotal和orderTotal才能使其正常工作。

                    <ebl:PaymentDetails>
                    <ebl:OrderTotal currencyID="USD">43.40</ebl:OrderTotal>
                    <ebl:ItemTotal currencyID="USD">40.00</ebl:ItemTotal>
                    <ebl:TaxTotal currencyID="USD">3.40</ebl:TaxTotal>
                    <ebl:ButtonSource>PayPal_SDK</ebl:ButtonSource>
                    <ebl:PaymentDetailsItem>
                        <ebl:Name>Product A</ebl:Name>
                        <ebl:Quantity>1</ebl:Quantity>
                        <ebl:Tax currencyID="USD">1.70</ebl:Tax>
                        <ebl:Amount currencyID="USD">20.00</ebl:Amount>
                    </ebl:PaymentDetailsItem>
                    <ebl:PaymentDetailsItem>
                        <ebl:Name></ebl:Name>
                        <ebl:Quantity>2</ebl:Quantity>
                        <ebl:Tax currencyID="USD">0.85</ebl:Tax>
                        <ebl:Amount currencyID="USD">10.00</ebl:Amount>
                    </ebl:PaymentDetailsItem>
                </ebl:PaymentDetails>