> 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.
curl "https://skillshub.wtf/TerminalSkills/skills/square?format=md"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.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zoho
Integrate and automate Zoho products. Use when a user asks to work with Zoho CRM, Zoho Books, Zoho Desk, Zoho Projects, Zoho Mail, or Zoho Creator, build custom integrations via Zoho APIs, automate workflows with Deluge scripting, sync data between Zoho apps and external systems, manage leads and deals, automate invoicing, build custom Zoho Creator apps, set up webhooks, or manage Zoho organization settings. Covers Zoho CRM, Books, Desk, Projects, Creator, and cross-product integrations.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> zipkin
Deploy and configure Zipkin for distributed tracing and request flow visualization. Use when a user needs to set up trace collection, instrument Java/Spring or other services with Zipkin, analyze service dependencies, or configure storage backends for trace data.