php - 如何修复 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);
解决方案
推荐阅读
- vue.js - 仅在检查 3 个验证时显示提交按钮
- c# - 任务计划程序启动 .EXE 程序,该程序打开连接到数据库的网页,导致“NT 权限/匿名登录失败”
- postgresql - 关系模式和完整性约束?
- r - 如何不手动将矩形插入轴
- user-interface - 如何在 PyCharm 中运行 NGSolve GUI?
- javascript - Web自动化登录输入框麻烦
- apache - htaccess :将所有 url 重定向到公共文件夹 exept api 文件夹中的 index.php
- cmake - 如何在 cmake 中使用 cpplint.py?
- sharepoint - 自动将文件移动到文件夹时防止文件重复
- python - 按 groupby 和 mean 绘制