简体   繁体   English

Checkout-PHP-SDK 中的 PayPal 订单 V2 收款人 object 失败并出现金额错误

[英]PayPal Orders V2 payee object in Checkout-PHP-SDK fails with amount error

I am integrating PayPal Checkout which works nicely unless I include a custom payee in the order body.我正在集成 PayPal Checkout,除非我在订单正文中包含自定义收款人,否则它运行良好。 I tried the PayPal PHP example at https://developer.paypal.com/docs/checkout/integration-features/custom-payee/ that looks like this: 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...但我需要订单中的收款人...

Do you have PHP errors/warnings enabled ?您是否启用了 PHP 错误/警告 that looks like it might be bad PHP syntax看起来可能是错误的 PHP 语法

Try putting:尝试放置:

        'payee' =>
          array(
            'email_address' => 'payee@email.com'
          )

Within the array above (second key, in the same array as 'amount')在上面的数组中(第二个键,在与“金额”相同的数组中)

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

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