请帮忙。我得到了
错误无效请求 - 请参阅详细信息
这是来自对PayPal的API调用。它能是什么?
PHP.ini serialize_precision = -1
unit price 25.00 shipping 4.99 = total 29.99
Sandbox and 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"
}
}
答案 0 :(得分:0)
但是,根据您发送的请求,问题似乎是因为您的总数不等于您的总产品价格,如果您有任何送货详细信息,则必须在您的金额对象的详细信息对象中实施。 - hassan 7分钟前