-1

Please to help. I got

error Invalid Request - see details

This is from an API call to PayPal. What can it be?

PHP.ini serialize_precision = -1
unit price 25.00 shipping 4.99 = total 29.99

Sandbox and Live give the same error:

Item amount must add up to specified amount subtotal (or total if amount details not specified) PHP 7.1.15

This is my API Calls Sandbox

request:

{
"body": {
    "redirect_urls": {
        "cancel_url": "https://www.**/offer/1/pay/cancel",
        "return_url": "https://www.**/offer/1/pay/success"
    },
    "intent": "sale",
    "payer": {
        "payment_method": "paypal"
    },
    "transactions": [
        {
            "item_list": {
                "items": [
                    {
                        "currency": "EUR",
                        "price": "25.00",
                        "description": "Zustand: Wie neu",
                        "name": "The Crew: Wild Run Edition (PlayStation 4)",
                        "quantity": "1"
                    }
                ]
            },
            "amount": {
                "currency": "EUR",
                "total": "29.99"
            }
        }
    ]
},
"header": {
    "x-pp-ads-performed": "true",
    "content-length": "508",
    "pp_remote_addr": "0.0.0.0.0",
    "x-pp-silover": "name=SANDBOX3.API.1&silo_version=1880&app=apiplatformproxyserv&TIME=2893264986&HTTP_X_PP_AZ_LOCATOR=",
    "accept": "application/json",
    "client-auth": "No cert",
    "host": "api.sandbox.paypal.com",
    "authorization": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9NZQ",
    "x-pp-idempotencyid": "b20b59c869af_1522037676",
    "x-slr-orig-script_uri": "https://api.sandbox.paypal.com/v1/payments/payment",
    "x-pp-corrid": "b20b59c869af",
    "user-agent": "Guzzle/3.9.3 curl/7.35.0 PHP/7.1.15",
    "content-type": "application/json",
    "x-pp-slingshot-targetapp": "apiplatformproxyserv"
},
"additional_properties": {},
"method": "POST"}  

response:

{
    "status": 400,
    "duration_time": 48,
    "body": {
        "message": "Invalid request - see details",
        "information_link": "https://developer.paypal.com/docs/api/payments/#errors",
        "details": [
            {
                "field": "transactions[0]",
                "issue": "Item amount must add up to specified amount subtotal (or total if amount details not specified)"
            }
        ],
        "name": "VALIDATION_ERROR",
        "debug_id": "b20b59c869af"
    },
    "additional_properties": {},
    "header": {
        "Date": "Mon, 26 Mar 2018 04:14:35 GMT",
        "Paypal-Debug-Id": "b20b59c869af",
        "APPLICATION_ID": "APP-80W284485P519543T",
        "Content-Language": "*",
        "CALLER_ACCT_NUM": "73ES43U4U7R5G"
    }
}
SherylHohman
  • 16,580
  • 17
  • 88
  • 94
  • why not to use the PayPal PHP-SDK instead of this? also PayPal has more than 10 APIs, which one you are trying to use? – hassan Mar 28 '18 at 11:53
  • However, from your sent request it seems that the issue is because your total does not equals your total product price, if you have any shipping details it must be implemented in the details object in your amount object. – hassan Mar 28 '18 at 12:04
  • text formatting as OP intended, grammar, quote formatting for error message, code formatting fix – SherylHohman Mar 29 '18 at 19:51
  • text editing as OP intended, grammar, quote formatting for error messages, code formatting, and fix indentation/code formatting – SherylHohman Mar 29 '18 at 19:55

1 Answers1

0

However, from your sent request it seems that the issue is because your total does not equals your total product price, if you have any shipping details it must be implemented in the details object in your amount object. – hassan 7 mins ago