public function Connect::getClient in Commerce Square Connect 8
Gets a Square API client.
Parameters
string $mode: The mode.
Return value
\SquareConnect\ApiClient A configured API client for the Connect application.
File
- src/
Connect.php, line 137
Class
- Connect
- Represents the Connect application for Square.
Namespace
Drupal\commerce_squareCode
public function getClient($mode) {
$config = new Configuration();
if ($mode === 'sandbox') {
$config
->setHost('https://connect.squareupsandbox.com');
}
$config
->setAccessToken($this
->getAccessToken($mode));
return new ApiClient($config);
}