简体   繁体   English

PayPal Rest API,validation_error,Laravel全能支付

[英]PayPal Rest API, validation_error, Laravel omnipay

Please to help. 请帮忙。 I got 我有

error Invalid Request - see details 错误无效请求-查看详细信息

This is from an API call to PayPal. 这是从对PayPal的API调用中获得的。 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 项目金额必须总计为指定金额小计(如果未指定金额明细,则为总计)PHP 7.1.15

This is my API Calls Sandbox 这是我的API调用沙箱

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"
    }
}

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 –哈桑7分钟前

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM