Skip to content
Skillv1.0.0

square

Accept payments and manage commerce with Square. Use when a user asks to accept in-person and online payments, process credit cards, manage inventory, handle subscriptions, or build a POS integration.

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/square/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill square. Copyright stays with the author (Apache-2.0).

Square

Overview

Square handles both online and in-person payments — credit cards, Apple Pay, Google Pay, and POS hardware. APIs cover payments, subscriptions, invoices, catalog, inventory, and customers. Popular for businesses that sell both online and in stores.

Instructions

Step 1: Online Payment

// lib/square.ts — Process a payment
import { Client, Environment } from 'square'

const client = new Client({
  accessToken: process.env.SQUARE_ACCESS_TOKEN!,
  environment: Environment.Production,
})

export async function createPayment(amount: number, currency: string, sourceId: string) {
  const { result } = await client.paymentsApi.createPayment({
    sourceId,         // payment token from Web Payments SDK
    idempotencyKey: crypto.randomUUID(),
    amountMoney: {
      amount: BigInt(amount),    // in smallest currency unit (cents)
      currency,
    },
  })
  return result.payment
}

Step 2: Web Payments SDK (Frontend)

// components/SquarePayment.tsx — Payment form
const payments = Square.payments(appId, locationId)
const card = await payments.card()
await card.attach('#card-container')

document.getElementById('pay-btn').addEventListener('click', async () => {
  const result = await card.tokenize()
  if (result.status === 'OK') {
    // Send result.token to your server
    await fetch('/api/pay', {
      method: 'POST',
      body: JSON.stringify({ sourceId: result.token, amount: 2999 }),
    })
  }
})

Step 3: Catalog and Inventory

// Manage products and inventory
const { result } = await client.catalogApi.upsertCatalogObject({
  idempotencyKey: crypto.randomUUID(),
  object: {
    type: 'ITEM',
    id: '#coffee-mug',
    itemData: {
      name: 'Coffee Mug',
      variations: [{
        type: 'ITEM_VARIATION',
        id: '#coffee-mug-regular',
        itemVariationData: {
          name: 'Regular',
          pricingType: 'FIXED_PRICING',
          priceMoney: { amount: BigInt(1499), currency: 'USD' },
        },
      }],
    },
  },
})

Guidelines

  • Square charges 2.9% + $0.30 per online transaction. In-person: 2.6% + $0.10.
  • No monthly fees for basic processing. Subscriptions start at $0/month.
  • Square is strongest for omnichannel (online + physical store) — synced inventory and customers.
  • For online-only SaaS billing, Stripe or Paddle are usually better choices.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-square/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-square.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-square",
  "kind": "skill",
  "name": "square",
  "description": "Accept payments and manage commerce with Square. Use when a user asks to accept in-person and online payments, process credit cards, manage inventory, handle subscriptions, or build a POS integration.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "finance"
    ],
    "tags": [
      "skill-md",
      "square",
      "payments",
      "pos",
      "ecommerce",
      "subscriptions",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Accept payments and manage commerce with Square. Use when a user asks to accept in-person and online payments, process credit cards, manage inventory, handle subscriptions, or build a POS integration."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/square/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/square/SKILL.md",
      "key": "terminalskills/skills/skills/square/SKILL.md"
    },
    "compatibility": "Any platform via REST API, mobile SDKs",
    "license": "Apache-2.0"
  },
  "instructions": "# Square\n\n## Overview\n\nSquare handles both online and in-person payments — credit cards, Apple Pay, Google Pay, and POS hardware. APIs cover payments, subscriptions, invoices, catalog, inventory, and customers. Popular for businesses that sell both online and in stores.\n\n## Instructions\n\n### Step 1: Online Payment\n\n```typescript\n// lib/square.ts — Process a payment\nimport { Client, Environment } from 'square'\n\nconst client = new Client({\n  accessToken: process.env.SQUARE_ACCESS_TOKEN!,\n  environment: Environment.Production,\n})\n\nexport async function createPayment(amount: number, currency: stri",
  "cost": {
    "context_tokens": 600
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-square/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.