integration: add @code-402/langchain (x402 pay-per-call tools)
Author: 89ratCreated Sep 27, 2026Updated Sep 29, 2026
Summary
Requesting @code-402/langchain be added to the list of recommended integrations, per the CONTRIBUTING.md path for standalone packages.
What it is
@code-402/langchain exposes code402's x402 pay-per-call verification tools (IBAN, LEI, VAT, GSTIN, IFSC, SWIFT/BIC, sanctions screening, onboarding packs) as LangChain DynamicStructuredTools via getCode402Tools().
- Repo: https://github.com/89rat/langchain-code402
- npm: https://www.npmjs.com/package/@code-402/langchain
- License: MIT
Design
- Tool list and schemas are read live from the seller's
/.well-known/mcp.json; nothing is hardcoded. - Non-custodial: the agent's wallet signs an EIP-3009 transfer directly to the seller named in the 402 challenge (USDC on Base, chain 8453).
- Hard client-side spend cap (
maxAmountMinor, default "0" = never pay) enforced before any signature is produced; the live 402 challenge is the only price ever signed. - A free
code402_check_pricetool (x402 price index lookup) is included.
Verification
- 3/3 vitest tests, fully mocked (no network in CI): tool construction, execution through the LangChain tool path, and the payment guard refusing to sign without an account on a 402.
- Smoke-tested against the live catalog at https://hcrb.in: 13 real
DynamicStructuredToolinstances build, and the guard fires on a live 402.
Happy to adjust anything to fit the integration conventions.
Source: langchain-ai/langchainjs