Skip to content

mykoman/square-api-with-expressjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Payments Quickstart With ExpressJS

Quickstart for using Square's Web Payments SDK with ExpressJS

Getting Started

Start by cloning this repository.

git clone https://github.com/mykoman/square-api-with-expressjs
cd square-payment-express

Install Node.js (>= v14) which will include npm. This repository contains an .nvmrc file if you use nvm to manage your node versions.

Then, to install dependencies run:

npm install

Run the development server.

npm run dev

Finally, open http://localhost:7000.

Credentials

Before you can take a payment, you'll need to configure your developer credentials which can be found in the Developer Dashboard.

Copy .env.exampleto .env.sandbox

cp .env.example .env.sandbox

Define SQUARE_ACCESS_TOKEN with your Sandbox Access Token from the Developer Dashboard.

SQUARE_ACCESS_TOKEN=eX@mpl3_t0k3n

Restart your server to use this new value.

Remember: Do not add your access tokens to git!

Development

Setup

When contributing to this project, you'll want to use Node v15 as defined by .nvmrc to take advantage of npm@7. You can use nvm to install the correct version:

nvm install $(cat .nvmrc)

Follow the "Getting Started" instructions above to install dependencies and verify your local server starts properly.