simple-square-sdk
v1.0.1
Published
Simple Square SDK for Node.js.
Maintainers
Readme
simple-square-sdk
Simple Square SDK for Node.js.
Install
$ npm i simple-square-sdk --saveExample
import Square from 'simple-square-sdk'
const squareClient = new Square({
applicationId: 'xxx',
accessToken: 'xxx',
environment: 'sandbox'
})
;(async () => {
const res = await squareClient.execute({
method: 'POST',
url: '/v2/online-checkout/payment-links',
body: {
idempotency_key: crypto.randomUUID(),
quick_pay: {
name: 'Total',
price_money: {
amount: 1000,
currency: 'USD'
},
location_id: 'LXXXXXXX'
}
}
})
/*
{
payment_link: {
id: 'xxx',
version: 1,
order_id: 'xxx',
url: 'https://sandbox.square.link/u/xxx',
long_url: 'https://connect.squareupsandbox.com/v2/online-checkout/sandbox-testing-panel/xxx/xxx',
created_at: '2026-07-13T15:10:16Z'
},
related_resources: {...}
}
*/
console.log(res)
})().catch(console.error)Worker
For Cloudflare Workers and other edge runtimes with native fetch:
import Square from 'simple-square-sdk/worker.js'
const squareClient = new Square({
applicationId: 'xxx',
accessToken: 'xxx',
environment: 'sandbox'
})