public function SquareApi::__construct in Commerce Square Connect 7
Creates a new SquareApi object.
Parameters
string $access_token: The access token.
string $mode: The mode: test or live.
File
- includes/
SquareApi.php, line 30 - Square Connect SDK wrapper.
Class
- SquareApi
- A wrapper around the Square Connect SDK.
Code
public function __construct($access_token, $mode) {
libraries_load('square');
$configuration = new Configuration();
$configuration
->setAccessToken($access_token);
if ($mode === 'test') {
$configuration
->setHost('https://connect.squareupsandbox.com');
}
$this->client = new ApiClient($configuration);
}