Set up your Square SDK for a Node.js Project

Learn the basic steps to set up the Square SDK for a Node.js project.

Link to section

Start a new project

If you're new to developing Square integrations using the Square Node.js SDK, try the Quickstart. It provides step-by-step instructions to explore your first project.

You can quickly install the Square Node.js SDK as follows:

npm install square

Important

This SDK is for use with Node.js only. It doesn't support other usages, such as for web browsers or frontend applications.

Link to section

TypeScript support

TypeScript is a superset of JavaScript, offering static typing and other features to identify potential bugs in your code. TypeScript programs compile to JavaScript, which can then be executed by Node.js. For more information, see Node.js with TypeScript.

The Square Node.js SDK fully supports TypeScript and provides TypeScript declaration files for Square APIs. These files help you type-check Square SDK usage in your code, while also providing hints and code completion for IDEs that are compatible with TypeScript.

Link to section

Node.js Express and BigInt

The SDK sometimes returns a response that includes a value that's a BigInt. When this response is sent to a client from the server, typically using Express, it throws an error because BigInt.prototype.toJSON doesn't exist. MDN has a guide for working around this issue.

Link to section

See also