npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@86d-app/square

v0.0.4

Published

Square payment provider for 86d commerce platform

Readme

[!WARNING] This project is under active development and is not ready for production use. Please proceed with caution. Use at your own risk.

@86d-app/square

Square payment provider implementing the PaymentProvider interface from @86d-app/payments. Uses Square's Payments API via raw fetch() — no Square SDK required.

Installation

import { SquarePaymentProvider } from "@86d-app/square";
import payments from "@86d-app/payments";

const provider = new SquarePaymentProvider("your-access-token");
const paymentsModule = payments({ currency: "USD", provider });

Options

import square from "@86d-app/square";

const squareModule = square({
  accessToken: "your-access-token",
  webhookSignatureKey: "optional-signature-key",
});

| Option | Type | Required | Description | |---|---|---|---| | accessToken | string | yes | Square access token (production or sandbox) | | webhookSignatureKey | string | no | Signature key for webhook verification |

API Mapping

| PaymentProvider method | Square API endpoint | |---|---| | createIntent | POST /v2/payments (autocomplete: false) | | confirmIntent | POST /v2/payments/{id}/complete | | cancelIntent | POST /v2/payments/{id}/cancel | | createRefund | POST /v2/refunds |

Status Mapping

| Square status | Provider status | |---|---| | COMPLETED | succeeded | | CANCELED | cancelled | | FAILED | failed | | APPROVED, PENDING | pending |

Webhook

The square() module registers a webhook endpoint at POST /square/webhook. Square uses the type field in its webhook payloads.

// Response: { received: true, type: "payment.updated" }

Signature verification must be implemented at the adapter level using the webhookSignatureKey.

Usage with payments module

import { SquarePaymentProvider } from "@86d-app/square";
import payments from "@86d-app/payments";
import square from "@86d-app/square";
import { createStore } from "@86d-app/core";

const provider = new SquarePaymentProvider(process.env.SQUARE_ACCESS_TOKEN);

const store = createStore({
  modules: [
    payments({ currency: "USD", provider }),
    square({ accessToken: process.env.SQUARE_ACCESS_TOKEN }),
  ],
});

Notes

  • Uses Square API version 2024-01-18
  • createIntent uses source_id: "EXTERNAL" and autocomplete: false — the payment is authorized but not completed until confirmIntent is called
  • createIntent includes an idempotency_key generated via crypto.randomUUID() to prevent duplicate charges
  • Amounts are in cents in the PaymentProvider interface; Square uses cents as well (amount_money.amount)
  • Content-Type is application/json (unlike Stripe which uses form-encoded)

Types

import type { SquareOptions } from "@86d-app/square";
import { SquarePaymentProvider } from "@86d-app/square";