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

@facet-llc/payment-adapter-x402-coinbase

v0.1.2

Published

Facet Terminal payment-rail adapter for x402 USDC settlement on Base via the Coinbase facilitator. Handles agents originated by AWS AgentCore Payments, Coinbase AgentKit, or any other platform that settles over x402.

Downloads

460

Readme

@facet-llc/payment-adapter-x402-coinbase

Facet Terminal payment-rail adapter for x402 USDC settlement on Base via the Coinbase facilitator. Implements FacetPaymentRailAdapter from @facet-llc/protocol.

What this is

The settlement-rail half of Facet's multi-rail payment-acceptance layer. Handles agents originated by any platform that settles over x402: AWS Bedrock AgentCore Payments, Coinbase AgentKit, or direct x402 wallets. The platform difference lives at the attestation layer (handled by separate FacetOriginationVerifier packages), not at the rail.

This adapter is a thin wrapper. It delegates the heavy lifting to the official x402 SDK:

  • Verification: verify(payload, requirements) from x402/verify does on-chain signature recovery, nonce-availability check, and amount validation.
  • Settlement: settle(payload, requirements) from the same SDK posts the signed transferWithAuthorization through the facilitator and returns the on-chain tx hash.
  • Facilitator routing: @coinbase/x402's preconfigured facilitator (free tier: 1000 tx/month, then $0.001/tx).

The adapter adds:

  • FacetPaymentRailAdapter shape (verifyAuthority, reserveAuthority, capture, refund, handleWebhook) so Terminal dispatches to it generically alongside other rails.
  • Result normalization into FacetErrorCode so failures surface identically across rails.
  • Per-network metadata (coin/usdc-base vs coin/usdc-base-sepolia) for Terminal's rail dispatcher.
  • CaptureOk envelope conformance: settlement_id is the on-chain tx hash, settled_at is the block timestamp.

Install

npm install @facet-llc/payment-adapter-x402-coinbase
# or
pnpm add @facet-llc/payment-adapter-x402-coinbase

Usage

import { X402CoinbaseAdapter } from "@facet-llc/payment-adapter-x402-coinbase";

// Default: Coinbase's hosted facilitator, anonymous (free) tier.
const adapter = new X402CoinbaseAdapter({
  network: "base",
});

// Authenticated higher rate-limit tier:
import { createFacilitatorConfig } from "@facet-llc/payment-adapter-x402-coinbase";

const authenticated = new X402CoinbaseAdapter({
  network: "base",
  facilitator: createFacilitatorConfig(process.env.CDP_API_KEY_ID, process.env.CDP_API_KEY_SECRET),
});

const result = await adapter.verifyAuthority({
  ctx: { trace_id, idempotency_key, merchant_id, site_id, received_at },
  merchant_config: {},
  authority: { x_payment: req.headers["x-payment"] },
  amount: { amount: 1_000_000, currency: "USDC" }, // 1.00 USDC (6 decimals)
});

if (result.kind === "ok") {
  const captured = await adapter.capture({
    ctx,
    merchant_config: {},
    authority_handle: result.value.authority_handle,
    amount: { amount: 1_000_000, currency: "USDC" },
  });
  // captured.value.settlement_id === "0xabc..."  (on-chain tx hash)
  // captured.value.settled_at === "2026-05-26T..."  (block timestamp)
}

Networks

Inherits all x402-supported EVM networks from the SDK. This adapter currently exposes the two Base networks:

| Network | Chain ID | Rail id | | ------------------------ | -------- | ------------------------ | | base (mainnet) | 8453 | coin/usdc-base | | base-sepolia (testnet) | 84532 | coin/usdc-base-sepolia |

Adding Polygon, Avalanche, etc. is a one-line change once merchant-config UI allows merchants to opt into each.

Refunds

The Coinbase facilitator does not yet expose programmatic refunds. Calls to refund() return METHOD_NOT_ALLOWED with a native_code of unsupported_by_facilitator. Merchants can issue manual refunds against the on-chain settlement tx; the next version of this adapter will wire that path through merchant-side signing once merchant_config supports it.

Tests

pnpm test runs 17 conformance and flow tests using deterministic hardhat test keys and a mocked facilitator. The tests exercise the real x402 and @coinbase/x402 SDK code paths. Only the network boundary is mocked.

License

Apache-2.0. See LICENSE.