【问题标题】:PayPal Rest API, validation_error, Laravel omnipayPayPal Rest API、validation_error、Laravel 全支付
【发布时间】:2018-09-07 01:40:01
【问题描述】:

请帮忙。我得到了

错误无效请求 - 查看详细信息

这是来自对 PayPal 的 API 调用。会是什么?

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

Sandbox 和 Live 给出相同的错误:

项目金额必须加到指定金额小计(如果未指定金额详情,则为总计)PHP 7.1.15

这是我的 API 调用沙盒

请求:

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

回复:

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

【问题讨论】:

  • 为什么不使用 PayPal PHP-SDK 而不是这个? PayPal 也有 10 多个 API,您尝试使用哪一个?
  • 但是,从您发送的请求来看,问题似乎是因为您的总价格不等于您的产品总价格,如果您有任何运输详细信息,则必须在您的数量对象的详细信息对象中实施。
  • OP 预期的文本格式、语法、错误消息的引用格式、代码格式修复
  • 按 OP 预期进行文本编辑、语法、错误消息的引用格式、代码格式和修复缩进/代码格式

标签: php laravel paypal omnipay


【解决方案1】:

但是,从您发送的请求来看,问题似乎是因为您的总价不等于您的产品总价,如果您有任何运输详细信息,则必须在您的数量对象的详细信息对象中实施。 – 哈桑 7 分钟前

【讨论】:

    猜你喜欢
    • 2016-11-23
    • 2017-02-16
    • 1970-01-01
    • 1970-01-01
    • 2014-10-26
    • 2014-08-05
    • 2019-05-15
    • 2017-04-20
    • 2016-07-23
    相关资源
    最近更新 更多