Paypal Express checkout with shipping cost and error
10,886
[PAYMENTREQUEST_PAYMENTACTION] => Sale
[PAYMENTREQUEST_ITEMAMT] => 12
[PAYMENTREQUEST_AMT] => 14.21
Should be:
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[PAYMENTREQUEST_0_ITEMAMT] => 12
[PAYMENTREQUEST_0_AMT] => 14.21
In addition, your amounts don't add up. You're setting a maximum of 14.21, but everything together is only 7.41
L_AMTm (should actually be L_PAYMENTREQUEST_0_AMTm) is item-specific. PAYMENTREQUEST_0_ITEMAMT is the subtotal of al items PAYMENTREQUEST_0_AMT should be the total of everything added together.
E.g.
[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
Or the official PayPal example:
&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
![MarJano](https://i.stack.imgur.com/msvR4.jpg?s=256&g=1)
Author by
MarJano
Updated on June 05, 2022Comments
-
MarJano about 2 years
Data I'm putting to paypal request (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
But all time I'm getting error:
[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
What I'm doing wrong with adding shipping to request??