Introducing the Square Connect Node SDK

As part of our goal of empowering our developers to innovate, build, and create, the developer platform team is happy to announce a new addition to the Square SDK family: the Square Connect Node SDK. With the release of the Square Connect Node SDK, Square now offers eight different SDKs ranging from iOS to C# to help developers effortlessly and seamlessly integrate with Square on any platform.

Getting Set Up with the Node SDK

Enabling Square for a Node.js application can be done in three easy steps.

Step 1: Installing the SDK

The Node.js SDK is catered for versions 6.0 or later. If your app meets this requirement, adding the SDK is as easy as adding the square-connect package to your application.

npm install square-connect --save

Step 2: Setting up Oauth2

Now that square-connect is added to your application, you need to add authorization. Your access token and other credentials can be found on your Square Application Dashboard located in the Square Developer Portal.

// Import square-connect 
const SquareConnect = require('square-connect');
const defaultClient = SquareConnect.ApiClient.instance;
// Configure Oauth2 access token for Authorizationconst 
oauth2 = defaultClient.authentications.oauth2;
oauth2.accessToken = 'YOUR ACCESS TOKEN';

Step 3: Create

Once the square-connect package is installed and Oauth2 is configured, you’re ready to make your first API call.

We can hit an endpoint simply by initializing a new API client and then calling a function named after your desired endpoint.

// Create a new Locations API Client
const locationsApi = new SquareConnect.LocationsApi();
// Make an API call to the listLocations endpoint
locationsApi.listLocations()
.then((response) => {
console.log('API called successfully, returned data: ' +
response);
});

The Node.js SDK, like all our other SDKs, was created to enhance your developer experience. By adding a Node.js SDK, we hope to lighten the load for our developers and make it easier to leverage the full power of the Square platform.

Learn More

  • The Public repo for the SDK can be found on Github.
  • To see the SDK in action, check out our example App.
  • To learn more about what you can do with Square’s APIs, check out our Docs.
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.