Paypal Express Checkout со стоимостью доставки и ошибкой - PullRequest
1 голос
/ 26 ноября 2011

Данные, которые я отправляю в PayPal-запрос (SetExpressCheckout)

[METHOD] => SetExpressCheckout

[ENDPOINT] => https://api-3t.sandbox.paypal.com/nvp
[USER] => ***
[PWD] => ***
[SIGNATURE] => ***
[VERSION] => 84.0
[TOKEN] => 
[CURRENCYCODE] => GBP
[RETURNURL] => http://experiment.loc/
[CANCELURL] => http://experiment.loc/?action=cancel
[SHIPPINGAMT] => 2.21
[SOLUTIONTYPE] => Sole
[LANDINGPAGE] => Billing
[L_ITEMCATEGORY0] => Physical
[L_QTY0] => 4
[L_AMT0] => 2.20
[L_DESC0] => ZajÄ…czek 1
[L_NAME0] => ZajÄ…czek 1
[L_CURRENCYCODE0] => GBP
[L_ITEMCATEGORY1] => Physical
[L_QTY1] => 1
[L_AMT1] => 3.20
[L_DESC1] => ZajÄ…czek 2
[L_NAME1] => ZajÄ…czek 2
[L_CURRENCYCODE1] => GBP
[PAYMENTREQUEST_PAYMENTACTION] => Sale
[PAYMENTREQUEST_ITEMAMT] => 12
[PAYMENTREQUEST_AMT] => 14.21
[AMT] => 14.21

Но все время я получаю сообщение об ошибке:

[TIMESTAMP] => 2011-11-26T18:37:33Z
[CORRELATIONID] => 465d809d95153
[ACK] => Failure
[VERSION] => 84.0
[BUILD] => 2271164
[L_ERRORCODE0] => 10413
[L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_LONGMESSAGE0] => The totals of the cart item amounts do not match order amounts.
[L_SEVERITYCODE0] => Error

Что я делаю неправильно с добавлением доставкизапросить ??

1 Ответ

5 голосов
/ 28 ноября 2011
[PAYMENTREQUEST_PAYMENTACTION] => Sale
[PAYMENTREQUEST_ITEMAMT] => 12
[PAYMENTREQUEST_AMT] => 14.21

Должно быть:

[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[PAYMENTREQUEST_0_ITEMAMT] => 12
[PAYMENTREQUEST_0_AMT] => 14.21

Кроме того, ваши суммы не складываются. Вы устанавливаете максимум 14,21, но все вместе составляет всего 7,41

L_AMTm (на самом деле должно быть L_PAYMENTREQUEST_0_AMTm) зависит от конкретного предмета. PAYMENTREQUEST_0_ITEMAMT - это промежуточный итог всех пунктов PAYMENTREQUEST_0_AMT должно быть суммой всего сложенного вместе.

1009 * Е.Г. *

[SOLUTIONTYPE] => Sole
[LANDINGPAGE] => Billing
[L_PAYMENTREQUEST_0_ITEMCATEGORY0] => Physical
[L_PAYMENTREQUEST_0_QTY0] => 4
[L_PAYMENTREQUEST_0_AMT0] => 2.20
[L_PAYMENTREQUEST_0_DESC0] => ZajÄ…czek 1
[L_PAYMENTREQUEST_0_NAME0] => ZajÄ…czek 1
[L_PAYMENTREQUEST_0_CURRENCYCODE0] => GBP
[L_PAYMENTREQUEST_0_ITEMCATEGORY1] => Physical
[L_PAYMENTREQUEST_0_QTY1] => 1
[L_PAYMENTREQUEST_0_AMT1] => 3.20
[L_PAYMENTREQUEST_0_DESC1] => ZajÄ…czek 2
[L_PAYMENTREQUEST_0_NAME1] => ZajÄ…czek 2
[L_PAYMENTREQUEST_0_CURRENCYCODE1] => GBP
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[PAYMENTREQUEST_0_SHIPPINGAMT] => 2.21
[PAYMENTREQUEST_0_ITEMAMT] => 5.40
[PAYMENTREQUEST_0_AMT] => 7.61

Или официальный пример PayPal :

&L_PAYMENTREQUEST_0_NAME0=10% Decaf Kona Blend Coffee  
&L_PAYMENTREQUEST_0_NUMBER0=623083  
&L_PAYMENTREQUEST_0_DESC0=Size: 8.8-oz 
&L_PAYMENTREQUEST_0_AMT0=9.95  
&L_PAYMENTREQUEST_0_QTY0=2  
&L_PAYMENTREQUEST_0_NAME1=Coffee Filter bags  
&L_PAYMENTREQUEST_0_NUMBER1=623084  
&L_PAYMENTREQUEST_0_DESC1=Size: Two 24-piece boxes  
&L_PAYMENTREQUEST_0_AMT1=39.70  
&L_PAYMENTREQUEST_0_QTY1=2  
&PAYMENTREQUEST_0_ITEMAMT=99.30  
&PAYMENTREQUEST_0_TAXAMT=2.58  
&PAYMENTREQUEST_0_SHIPPINGAMT=3.00  
&PAYMENTREQUEST_0_HANDLINGAMT=2.99  
&PAYMENTREQUEST_0_SHIPDISCAMT=-3.00  
&PAYMENTREQUEST_0_INSURANCEAMT=1.00  
&PAYMENTREQUEST_0_AMT=105.87  
&PAYMENTREQUEST_0_CURRENCYCODE=USD  
...