php - 支付 API 返回 AuthenticationFailed 错误
问题描述
在通过以下代码创建电子支票借记时,我正在将付款集成到我的应用程序并使用 Intuit 的 PHP-Payments-SDK。
public function echeck(Request $request){
$this->refreshToken();
$record = QuickbookModel::first();
$client = new PaymentClient([
'access_token' => $record->accessToken,
'environment' => "sandbox" // or 'environment' => "production"
]);
$array = [
"bankAccount" => [
"phone" => $request->phone,
"routingNumber" => $request->routingNumber,
"name" => $request->name,
"accountType" => $request->accountType,
"accountNumber" => $request->accountNumber
],
"description" => "Easyfi Testing",
"paymentMode" => "WEB",
"amount" => "5.55",
];
$bank = ECheckOperations::buildFrom($array);
$response = $client->debit($bank);
if($response->failed()){
$code = $response->getStatusCode();
$errorMessage = $response->getBody();
return json_encode(["status" => $code, "message" => $errorMessage]);
}else{
$responseCharge = $response->getBody();
//Get the Id of the charge request
$id = $responseCharge->id;
//Get the Status of the charge request
$status = $responseCharge->status;
return json_encode(["status" => $status, "message" => $responseCharge, "data" => $id]);
}
}
我总是收到以下错误,即使一切都符合要求,包括访问令牌
{status: 401, message: "{"code":"AuthenticationFailed","type":"INPUT","message":null,"detail":null,"moreInfo":null}"}
解决方案
推荐阅读
- dynamics-crm - 在 Dynamics CRM 中查询以查找相关帐户的订单产品
- http - 响应后的异步工作
- spring-mvc - spring mvc:当请求内容类型为 x-www-form-urlencoded 时绑定嵌套请求参数
- reactjs - 在静态网站上使用 ReactJS
- odoo-11 - odoo11 :: wkhtmltopdf 无法识别 css
- android - 使用 Google 服务 v15 部署应用程序时出错
- grails - 没有这样的属性:类的属性名称:org.grails.orm.hibernate.cfg.HibernatePersistentEntity
- jquery - 根据在 Jquery 数据表的“显示下拉菜单”中选择的页面大小显示数据
- java - 在端口/适配器(洋葱)架构中,如果应用程序中没有持久性,我可以拥有域吗?
- mysql - 重置mysql密码结果:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)