Checkout-PHP-SDK 中的 PayPal Orders V2 收款人对象因金额错误而失败 [英] PayPal Orders V2 payee object in Checkout-PHP-SDK fails with amount error

查看:56
本文介绍了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')

这篇关于Checkout-PHP-SDK 中的 PayPal Orders V2 收款人对象因金额错误而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆