How to install Square’s beta SDKs
We recently released a big update to SDKs—here’s how to upgrade.
[Update: the beta has completed, download the latest version of our SDKs here] As a reminder, if you want help with installation, to give us feedback on the new design and features, or simply to learn more about the APIs, request an invite to our new ***Slack community here.***
The differences in version 2.1.0 of our new SDKs are the same for each language (of course, these changes look a little different in each language). The main differences are:
-
Support for v1 endpoints including items and inventory management, employee management, and the v1 version of transaction reporting.
-
Renaming and reorganizing of some of the generated APIs:
<=2.0.2 2.1.0+
CheckoutApi CheckoutApi
LocationApi Location**s**Api
TransactionApi Transaction**s**Api
RefundApi Transaction**s**Api
CustomerApi Customer**s**Api
CustomerCardApi Customer**s**Api
**V1EmployeesApi
V1LocationsApi
V1ItemsApi
V1TransactionsApi**
- We’ve removed the per request Authorization parameter. With our new design you’ll only need to set your access token once in the beginning, and not in every request. To visualize this difference in
php
, our current model looks like this:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new SquareConnect\Api\CheckoutApi();
$result = $api_instance->createCheckout(**$authorization**, $location_id, $body);
?>
and with version 2.1.0 and forward, that same request would look like:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
**// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');**
$result = $api_instance->createCheckout($location_id, $body);
?>
Installation Guides
PHP
You can install the beta 2.1.0 version of our SDK with composer with the command line:
composer require square/connect:dev-release/2.1.0
or by adding the following to your composer.json
file for your project.
{
“require”: {
“square/connect”: “dev-release/2.1.0”
}
}
You can also install from GitHub with:
git clone [https://github.com/square/connect-php-sdk.git](https://github.com/square/connect-php-sdk.git)
cd connect-php-sdk
git checkout release/2.1.0
and use the familiar require('connect-php-sdk/autoload.php');
within your application.
Java
You’ll need to get the source from GitHub and:
git clone [https://github.com/square/connect-php-sdk.git](https://github.com/square/connect-php-sdk.git)
cd connect-php-sdk
git checkout release/2.1.0
`mvn install -DskipTests`
You should now have a new .jar
file to include with your project.
Ruby
With Ruby, you can specify the 2.1.0.beta version of the square-connect gem to install by running:
`gem install square_connect -v 2.1.0.beta`
Python
You can install the Python package straight from GitHub with:
`git clone `[https://github.com/square/connect-python-sdk.git](https://github.com/square/connect-python-sdk.git)
git checkout release/2.1.0
`sudo python setup.py install`
C#
You’ll need to download the files from GitHub and switch to the 2.1.0 version:
`git clone `[https://github.com/square/connect-csharp-sdk.git](https://github.com/square/connect-csharp-sdk.git)
git checkout release/2.1.0
You can then build the .dll
by running./build.sh
for Unix-based systems or build.bat
for Windows. You will likely need to download the dependencies, but you should be prompted to do so to build.
To learn more about how our SDKs are made, as well as the release of our Java SDK, check out our earlier post announcing new versions of our client SDKs.