Checkout-PHP-SDK 中的 PayPal Orders V2 收款人对象因金额错误而失败
我正在集成 PayPal Checkout,它可以很好地工作,除非我在订单正文中包含自定义收款人.我在 https://developer.paypal 尝试了 PayPal PHP 示例.com/docs/checkout/integration-features/custom-payee/ 看起来像这样:
I am integrating PayPal Checkout which works nicely unless I include a custom payee in the order body. I tried the PayPal PHP example at https://developer.paypal.com/docs/checkout/integration-features/custom-payee/ that looks like this:
return array(
'intent' => 'AUTHORIZE',
'purchase_units' =>
array(
0 =>
array(
'amount' =>
array(
'currency_code' => 'USD',
'value' => '220.00'
)
),
array(
'payee' =>
array(
'email_address' => 'payee@email.com'
)
)
)
);
尝试创建订单将导致此错误消息(这似乎是完全错误的,因为它抱怨既不存在也不需要的字段):
Trying to create an order will lead to this error message (which seems to be completely wrong as it complaints about fields that are neither there nor needed):
{"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"65a47f1e8defd","details":[{"field":"/purchase_units/1/amount","value":"","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field / parameter is missing."}],"links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-MISSING_REQUIRED_PARAMETER","rel":"information_link","encType":"application/json"}]} [/var/www/web15/htdocs/retroplace/vendor/paypal/paypalhttp/lib/PayPalHttp/HttpClient.php:215]
如果我删除收款人的部分,一切正常.但是我需要订单中的收款人...
If I remove the portion with the payee, everything works fine. But I need the payee in the order...
你有 PHP errors/启用警告?看起来它可能是糟糕的 PHP 语法
Do you have PHP errors/warnings enabled? that looks like it might be bad PHP syntax
尝试放置:
'payee' =>
array(
'email_address' => 'payee@email.com'
)
在上面的数组中(第二个键,与'amount'在同一个数组中)
Within the array above (second key, in the same array as 'amount')