首页 > 解决方案 > 如何修复 quickbooks API 中的错误,GuzzleHttlp 说 Request has invalid or Unsupported Property

问题描述

我正在为我的一个项目开发 Quickbooks API。我收到以下错误:

GuzzleHttp\Exception\ClientException 客户端错误:POST https://sandbox-quickbooks.api.intuit.com//*Private Info */ 导致 400 Bad Request 响应:{"Fault":{"Error":[{" Message":"Request has invalid or unsupported property","Detail":"Property Name:Unrecognized field \(截断...)

编码:

我不知道它对我说什么来修复它。谁能帮我这个?

请找到更新的代码


if(!$buyer->details->quickbooks_id){
            $customer = $http->post(
                // Sandbox API hidden for security reason
                [
                    'headers' => [
                        'Accept'=> 'application/json',
                        'Content-type'=> 'application/json',
                        'Authorization'=> 'Bearer '.$oauth['access_token']
                    ],
                    'body' => json_encode(
                        [
                        'PrimaryEmailAddr' => [
                            'Address' => $buyer->email
                        ],
                        'DisplayName' => $buyer->first_name.' '.$buyer->last_name.' - '.$buyer->details->business_name,
                        'PrimaryPhone'=>[
                            'FreeFormNumber'=> $buyer->phone
                        ],
                        'CompanyName'=>$buyer->details->business_name,
                        'GivenName'=>$buyer->first_name,
                        'FamilyName'=>$buyer->last_name,
                        'BillAddr'=> [
                            "CountrySubDivisionCode" => $buyer->details->state, 
                            "City" => $buyer->details->city, 
                            "PostalCode" => $buyer->details->zip, 
                            "Line1" => $buyer->details->address,
                            "Country" => $buyer->details->country
                        ]
                    ])
                ]
            );
            $customer = json_decode((string)$customer->getBody(), true);
            $buyer->details->quickbooks_id = $customer['Customer']['Id'];
            $buyer->details->save();
        }

        dd($buyer, $buyer->details, $buyer->details->quickbooks_id);

标签: phplaravelpaymentquickbooks

解决方案


推荐阅读