TheJethFX

payloadcms plugin square

by TheJethFX
Stores & catalogs
v3
^3.59.1
^3.61.1 Β· prerelease
MIT

Overview

Summary generated from the README

Connects a Square account to Payload and syncs categories, items with variations, modifier lists and inventory counts into read-only collections. Sync runs on startup and can be triggered from admin refresh buttons. Optional webhooks with signature verification resync on catalog and inventory changes. Requires the Square Node.js SDK and an access token.

Features

  • Syncs categories, items, variations, images and modifier lists from Square
  • Tracks inventory counts across multiple locations and states
  • Read-only collections with Square as the source of truth
  • Manual refresh button and endpoint for each collection
  • Webhook support with signature verification for catalog and inventory events
  • Debug logging option and sandbox or production environment selection

Use cases

  • Display Square product catalog and stock levels on a Payload-powered storefront
  • Keep CMS product data current automatically when Square catalog changes
  • Expose Square modifiers and variations to a Next.js frontend through Payload APIs

From the author

Unofficial Square plugin for Payload

Installation

npm i payloadcms-plugin-square

5

Stars

0

Forks

0

Open Issues

1 years ago

Last Updated

130

Weekly Downloads

v1.3.0

npm Version

164.3 KB

Unpacked Size

0

Dependencies

GitHub stars

50 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20265
Dec 4, 20265
Dec 3, 20265
Dec 2, 20265
Dec 1, 20265
Nov 30, 20265
Nov 29, 20265
Nov 28, 20265
Nov 27, 20265
Nov 26, 20265
Nov 25, 20265
Nov 24, 20265
Nov 23, 20265
Nov 22, 20265
Nov 21, 20265
Nov 20, 20265
Nov 19, 20265
Nov 18, 20265
Nov 17, 20265
Nov 16, 20265
Nov 15, 20265
Nov 14, 20265
Nov 13, 20265
Nov 12, 20265
Nov 11, 20265
Nov 10, 20265
Nov 9, 20265
Nov 8, 20265
Nov 7, 20265
Nov 6, 20265
Nov 5, 20265
Nov 4, 20265
Nov 3, 20265
Nov 2, 20265
Nov 1, 20265
Oct 31, 20265
Oct 30, 20265
Oct 29, 20265
Oct 28, 20265
Oct 27, 20265
Oct 26, 20265
Oct 25, 20265
Oct 24, 20265
Oct 23, 20265
Oct 22, 20265
Oct 21, 20265
Oct 20, 20265
Oct 19, 20265
Oct 18, 20265
Oct 17, 20265
Oct 16, 20265
Oct 15, 20265
Oct 14, 20265
Oct 13, 20265
Oct 12, 20265
Oct 11, 20265
Oct 10, 20265
Oct 9, 20265
Oct 8, 20265
Oct 7, 20265
Oct 6, 20265
Oct 5, 20265
Oct 4, 20265
Oct 3, 20265
Oct 2, 20265
Oct 1, 20265
Sep 30, 20265
Sep 29, 20265
Sep 28, 20265
Sep 27, 20265
Sep 26, 20265
Sep 25, 20265
Sep 24, 20265
Sep 23, 20265
Sep 22, 20265
Sep 21, 20265
Sep 20, 20265
Sep 19, 20265
Sep 18, 20265
Sep 17, 20265
Sep 16, 20265
Sep 15, 20265
Sep 14, 20265
Sep 13, 20265
Sep 12, 20265
Sep 11, 20265
Sep 10, 20265
Sep 9, 20265
Sep 8, 20265
Sep 7, 20265
Sep 6, 20265
npm weekly downloads

25+13 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202625
Dec 4, 202624
Dec 3, 202628
Dec 2, 202615
Dec 1, 202616
Nov 30, 202618
Nov 29, 202651
Nov 28, 202651
Nov 27, 202652
Nov 26, 202646
Nov 25, 202646
Nov 24, 202644
Nov 23, 202643
Nov 22, 202612
Nov 21, 202612
Nov 20, 202614
Nov 19, 202615
Nov 18, 202619
Nov 17, 202619
Nov 16, 202618
Nov 15, 202620
Nov 14, 202620
Nov 13, 202613
Nov 12, 202625
Nov 11, 202621
Nov 10, 202624
Nov 9, 202626
Nov 8, 202623
Nov 7, 202625
Nov 6, 202627
Nov 5, 202619
Nov 4, 202620
Nov 3, 202618
Nov 2, 202616
Nov 1, 202616
Oct 31, 202615
Oct 30, 202615
Oct 29, 202610
Oct 28, 20268
Oct 27, 20266
Oct 26, 20269
Oct 25, 202610
Oct 24, 20268
Oct 23, 20266
Oct 22, 202619
Oct 21, 202637
Oct 20, 202659
Oct 19, 2026161
Oct 18, 2026160
Oct 17, 2026163
Oct 16, 2026163
Oct 15, 2026153
Oct 14, 2026136
Oct 13, 2026117
Oct 12, 202613
Oct 11, 202613
Oct 10, 202610
Oct 9, 202612
Oct 8, 202610
Oct 7, 20269
Oct 6, 20266
Oct 5, 20265
Oct 4, 20266
Oct 3, 20266
Oct 2, 20265
Oct 1, 20267
Sep 30, 20267
Sep 29, 202641
Sep 28, 202641
Sep 27, 202642
Sep 26, 202647
Sep 25, 202647
Sep 24, 202648
Sep 23, 202649
Sep 22, 202652
Sep 21, 202667
Sep 20, 202668
Sep 19, 202665
Sep 18, 202664
Sep 17, 202661
Sep 16, 202661
Sep 15, 202625
Sep 14, 202615
Sep 13, 202612
Sep 12, 202610
Sep 11, 202613
Sep 10, 202613
Sep 9, 202616
Sep 8, 202615
Sep 7, 202613
Sep 6, 202612

Each point is npm's rolling 7-day download count.

Health Score

0/100Archived

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/875287519-root.svg)](https://payloaddirectory.dev/plugins/875287519-root)
HTML
<a href="https://payloaddirectory.dev/plugins/875287519-root"><img src="https://payloaddirectory.dev/badge/875287519-root.svg" alt="Payload Directory"></a>
Updated Oct 30, 2025Created Oct 19, 2024Published Oct 14, 2025

README

Payload Square Plugin

npm version npm downloads JSDocs License

A plugin for Payload to connect Square to your Payload project.

Installation

npm install payloadcms-plugin-square

Note that this plugin also requires the Square Node.js SDK to be installed in your project:

npm install square

Quick Start

1. Install Dependencies

npm install payloadcms-plugin-square square
# or
pnpm add payloadcms-plugin-square square

2. Get Your Square Access Token

  1. Go to Square Developer Dashboard
  2. Create or select your application
  3. Copy your Access Token from the Credentials tab

3. Configure the Plugin

// payload.config.ts
import { squarePlugin } from 'payloadcms-plugin-square'
import { SquareEnvironment } from 'square'

export default buildConfig({
  plugins: [
    squarePlugin({
      accessToken: process.env.SQUARE_ACCESS_TOKEN || '',
      environment: SquareEnvironment.Production,
      enabled: true,
      debug: true, // Enable debug logging
    }),
  ],
})

4. Set Environment Variables

# .env
SQUARE_ACCESS_TOKEN=your_square_access_token_here

5. Start Your Application

The plugin will automatically sync all Square data on startup!

Advanced Configuration

import { squarePlugin } from 'payloadcms-plugin-square'
import { SquareEnvironment } from 'square'

export default buildConfig({
  plugins: [
    squarePlugin({
      accessToken: process.env.SQUARE_ACCESS_TOKEN || '',
      environment: SquareEnvironment.Production,
      debug: false,
      enabled: true,
      webhooks: {
        enabled: true,
        signatureKey: process.env.SQUARE_WEBHOOK_SIGNATURE_KEY || '',
        url: process.env.SQUARE_WEBHOOK_URL || 'https://yourdomain.com/api/square-webhook',
      },
    }),
  ],
})

Environment Variables:

# .env
SQUARE_ACCESS_TOKEN=your_square_access_token
SQUARE_WEBHOOK_SIGNATURE_KEY=your_webhook_signature_key
SQUARE_WEBHOOK_URL=https://yourdomain.com/api/square-webhook

Options

OptionTypeRequiredDescription
accessTokenstringYesYour Square access token. You can find this in your Square Developer Dashboard.
debugbooleanNoIf set to true, logs debug information to the console. Defaults to false.
enabledbooleanNoIf set to false, the plugin will not run. Defaults to true.
environmentEnvironmentNoThe Square API environment to use. Defaults to Environment.Sandbox.
webhooksobjectNoWebhook configuration for real-time updates from Square. See Webhook Configuration below.

Webhook Configuration

Enable real-time updates from Square by configuring webhooks:

squarePlugin({
  accessToken: process.env.SQUARE_ACCESS_TOKEN,
  webhooks: {
    enabled: true,
    signatureKey: process.env.SQUARE_WEBHOOK_SIGNATURE_KEY,
    url: 'https://yourdomain.com/api/square-webhook',
    events: ['catalog.version.updated', 'inventory.count.updated'] // Optional
  }
})

Webhook Options:

OptionTypeRequiredDescription
enabledbooleanYesEnable or disable webhook support
signatureKeystringYesWebhook signature key from Square Developer Dashboard
urlstringYesThe full URL where webhooks will be received (must match Square Dashboard)
eventsstring[]NoArray of event types to handle. Defaults to ['catalog.version.updated', 'inventory.count.updated']

Supported Events:

  • catalog.version.updated - Automatically resyncs categories, modifiers, and items when catalog changes
  • inventory.count.updated - Automatically resyncs inventory counts when stock changes

See WEBHOOK_TROUBLESHOOTING.md for detailed webhook setup and troubleshooting.

Features

πŸ“¦ Core Sync Features

βœ… Category Sync - Automatically syncs Square product categories
βœ… Item Sync - Syncs items with variations, images, and pricing
βœ… Variation Support - Full support for item variations with different prices
βœ… Image Sync - Syncs product images from Square
βœ… Measurement Units - Handles product measurements and units

πŸ”§ Modifiers & Customization

βœ… Modifier Lists - Sync modifier lists (sizes, add-ons, etc.)
βœ… Modifier Options - Full support for single and multi-select modifiers
βœ… Modifier Pricing - Handles price adjustments for modifiers
βœ… Default Selections - Supports "on by default" modifier options
βœ… Item Modifier Links - Items linked to their applicable modifier lists

πŸ“Š Inventory Management

βœ… Inventory Counts - Real-time inventory count synchronization
βœ… Multi-location Support - Tracks inventory across multiple locations
βœ… Inventory States - Supports all inventory states (IN_STOCK, SOLD, RESERVED, etc.)
βœ… Batch Processing - Efficient batch API calls for large inventories

πŸ”” Real-time Updates

βœ… Webhook Integration - Receive real-time updates from Square
βœ… Signature Verification - Secure webhook signature validation
βœ… Auto-sync on Changes - Automatically resyncs when catalog or inventory changes
βœ… Event Handling - Processes catalog and inventory update events

🎨 Admin Features

βœ… Manual Refresh Buttons - Admin UI buttons to manually trigger syncs for each collection
βœ… Read-only Collections - Square data is read-only (Square is source of truth)
βœ… Grouped Collections - All Square collections organized in admin sidebar
βœ… Debug Mode - Detailed logging for troubleshooting

Collections

The plugin creates the following read-only collections in your Payload CMS:

  • square-categories - Product categories from Square
  • square-items - Products/items with variations, images, and modifier lists
  • square-item-variations - Reusable variation field schema
  • square-modifier-lists - Modifier lists with options (sizes, add-ons, etc.)
  • square-inventory - Inventory counts by location and state

All collections include a manual refresh endpoint at /api/{collection-slug}/refresh and a refresh button in the admin UI.

Sync Behavior

Initial Sync

On Payload startup (onInit), the plugin automatically syncs all data from Square in this order:

  1. Categories
  2. Modifier Lists
  3. Items (with variations)
  4. Inventory Counts

Manual Sync

Each collection has a "Refresh" button in the admin UI that triggers a manual sync for that specific collection.

Real-time Sync (Webhooks)

When webhooks are enabled and configured:

  • Catalog changes trigger automatic resync of categories, modifiers, and items
  • Inventory changes trigger automatic resync of inventory counts

Contributing

If you want to contribute to this project, please read the CONTRIBUTING file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Similar plugins