phppaypalexpress-checkoutnvp

Paypal the totals of the cart item amounts do not match order amounts using nvp with express_checkout


This is what i've sent to paypal using nvp and express_checkout, but it gives me error do not match order amount, can you help me please which one i'm missing or calculated wrongly?

I have read post with same problem, but still got no clue how to fixed mine out from their suggested answers. Thank you in advance.

Array
(
    [METHOD] => SetExpressCheckout
    [SOLUTIONTYPE] => Sole
    [LANDINGPAGE] => Billing
    [ALLOWNOTE] => 0
    [PAYMENTREQUEST_0_PAYMENTACTION] => Sale
    [PAYMENTREQUEST_0_AMT] => 70.00
    [PAYMENTREQUEST_0_CURRENCYCODE] => AUD
    [PAYMENTREQUEST_0_INVNUM] => 124-1440383961
    [RETURNURL] => http://mysite.here/checkout/124/payment/return/I2Ir45QRcKkACL__OFbNrNjc8cL9Iajr0UU1LzXesWA
    [CANCELURL] => http://mysite.here/checkout/124/payment/back/I2Ir45QRcKkACL__OFbNrNjc8cL9Iajr0UU1LzXesWA
    [L_PAYMENTREQUEST_0_NAME0] => Babbling Brook - 7min Loop
    [L_PAYMENTREQUEST_0_AMT0] => 35.00
    [L_PAYMENTREQUEST_0_QTY0] => 1
    [L_PAYMENTREQUEST_0_NUMBER0] => babblingbrook-7minloop
    [L_PAYMENTREQUEST_0_NAME1] => Crackling Fire - 7min Loop
    [L_PAYMENTREQUEST_0_AMT1] => 35.00
    [L_PAYMENTREQUEST_0_QTY1] => 1
    [L_PAYMENTREQUEST_0_NUMBER1] => cracklingfire-7minloop
    [PAYMENTREQUEST_0_ITEMAMT] => 63.64
    [PAYMENTREQUEST_0_TAXAMT] => 6.36
    [NOSHIPPING] => 1
    [USER] => myusernamehere
    [PWD] => ANDPASSWORDHERE
    [SIGNATURE] => A.bIs5s0FCBv.KdshBEZ.0y1BshsBr9
    [VERSION] => 76.0
)

PayPal server response:

Array
(
    [TIMESTAMP] => 2015-08-24T02:20:54Z
    [CORRELATIONID] => 7b10ddf49b4c1
    [ACK] => Failure
    [VERSION] => 76.0
    [BUILD] => 000000
    [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
)

Solution

  • The last time I played with this I was using API version 113 (which is over a year old now).

    I think you've just really only missed the per-item tax amount.

    The PAYMENTREQUEST_0_ITEMAMT field should be equal to the sum of each item's amount (L_PAYMENTREQUEST_0_AMTn) exclusive of tax, multiplied by the quantity. So you should have

    'L_PAYMENTREQUEST_0_AMT0' => 31.82,
    'L_PAYMENTREQUEST_0_AMT1' => 31.82,
    'PAYMENTREQUEST_0_ITEMAMT' => 63.64
    

    PAYMENTREQUEST_0_TAXAMT is the sum of each item's tax amount (L_PAYMENTREQUEST_0_TAXAMTn) multiplied by the quantity. You haven't specified the item tax amount but let's say it's something like

    'L_PAYMENTREQUEST_0_TAXAMT0' => 3.18,
    'L_PAYMENTREQUEST_0_TAXAMT1' => 3.18,
    'PAYMENTREQUEST_0_TAXAMT' => 6.36
    

    Finally, PAYMENTREQUEST_0_AMT is the sum of PAYMENTREQUEST_0_ITEMAMT and PAYMENTREQUEST_0_TAXAMT plus any shipping

    'PAYMENTREQUEST_0_AMT' => 70.00