Skip to content

Install

PQ-402 is four packages on npm. All four are ES modules, need Node.js 22 or later, and move together: install the same version of each.

Package You need it to
@pq402/server charge for routes: PaymentGate and the node:http adapter
@pq402/client pay: createPq402Fetch, a fetch that answers 402s
@pq402/scheme-qorechain talk to QoreChain: chain reader, settler, facilitators, the in-memory chain
@pq402/core the signed bytes, ML-DSA-87, sealing, receipts and error codes

The server also imports x402Facilitator from @x402/core, the x402 package PQ-402 is built on.

Terminal window
pnpm add @pq402/server @pq402/scheme-qorechain @pq402/core @x402/core@2.31.0 viem
Terminal window
pnpm add @pq402/client @pq402/scheme-qorechain @pq402/core

On the testnet, derive an account’s keys from its phrase with QoreChain’s SDK and QoreSeal:

Terminal window
pnpm add @qorechain/sdk@0.14.0 @qorechain/qoreseal@0.1.0

The guides use a small helper for this, account.ts.

The samples are TypeScript with top-level await. Run them with tsx: npx tsx file.ts. Your package.json needs "type": "module".