Getting started
Install the contract, then issue an ATR, claim a payment and read a record against a local stand-in door.
This page takes one x402 payment through the seller door: issue the ATR, claim the payment, and read the record. Every step is a complete program you can run.
1. Install
npm install @integraledger/agentic-connectorsThe package needs Node.js >=26.10.0 and is ESM only. Node.js 26 runs TypeScript files directly, so each
program below runs with node <file>.ts.
2. Point at a door
The programs read two variables:
SELLER_DOOR_URL: your door's base URL, such ashttps://seller.example/door;SELLER_CREDENTIAL: the tenant's seller credential,isk_and 43 base64url characters.
Without a door, use the stand-in in this repository. It answers exactly as the contract's vectors say, so the programs print what is shown here:
git clone https://github.com/IntegraLedger/integra-agentic-connectors.git
cd integra-agentic-connectors
pnpm install --frozen-lockfile && pnpm -r --if-present run build
node scripts/stand-in-door.mjs 4010 &
export SELLER_DOOR_URL=http://127.0.0.1:4010
export SELLER_CREDENTIAL=isk_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAThe stand-in knows only the requests the vectors hold; anything else answers 501 stand-in/no-vector.
3. Issue the ATR
Before the buyer approves, send the options the 402 will carry, the request they answer, and the parties' content. The door writes the ATR to the seller's storage, hashes it, and answers with the values to place.
import type { IssueRequest, IssueResponse, Refusal } from "@integraledger/agentic-connectors";
const = .. ?? "https://seller.example/door";
const = .. ?? "";
const : IssueRequest = {
: "chk_7Q2:v1",
: "quote",
: 60,
: [
{
: "x402/exact/eip155/eip3009",
: {
: "exact",
: "eip155:84532",
: "10000",
: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
: "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
: 60,
: { : "USDC", : "2" },
},
},
],
: {
: "GET",
: "/v1/report",
: "",
: "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
},
: [{ : "terms", : .('"Pay 10000 base units of USDC for one report."').("base64") }],
};
const = await (`${}/issue`, {
: "POST",
: { : `Bearer ${}`, "content-type": "application/json" },
: .(),
});
if (!.) {
const = (await .()) as Refusal;
throw new (`${.} ${.}: ${.}`);
}
const = (await .()) as IssueResponse;
.("H: ", .);
.("link:", .);
.("x402:", .(..));
.("until", .);H: 0x3c2394624c8c9a61ebaf7d8750a6f9ac21bf73e6369b7c0b64c83e34509cc3d3
link: https://atr.seller.example/0x3c2394624c8c9a61ebaf7d8750a6f9ac21bf73e6369b7c0b64c83e34509cc3d3
x402: {"type":"sha256","value":"0x3c2394624c8c9a61ebaf7d8750a6f9ac21bf73e6369b7c0b64c83e34509cc3d3","legalContextUrl":"https://atr.seller.example/0x3c2394624c8c9a61ebaf7d8750a6f9ac21bf73e6369b7c0b64c83e34509cc3d3"}
until 2026-09-21T14:14:20.000ZOn x402, carriers.legalContext is the info of the challenge's legalContext extension.
x402 beside a seller's stack places it with the LCP package.
4. Claim the payment
When the buyer presents its payment, claim it before your facilitator verifies it. The payment below is the one in
vector CV6: its EIP-3009 authorization's nonce is H.
import type { ClaimRequest, ClaimResponse, Refusal } from "@integraledger/agentic-connectors";
import { } from "@integraledger/agentic-connectors";
const = .. ?? "https://seller.example/door";
const = .. ?? "";
const = ["CV6"]!.[1]!.. as unknown as ClaimRequest;
const = await (`${}/claim`, {
: "POST",
: { : `Bearer ${}`, "content-type": "application/json" },
: .(),
});
const = (await .()) as ClaimResponse | Refusal;
if ("code" in ) throw new (`${.} ${.}`);
.(., .);
.("claimed:", .., "pattern:", ..?.);settling 0x3c2394624c8c9a61ebaf7d8750a6f9ac21bf73e6369b7c0b64c83e34509cc3d3
claimed: true pattern: native-fieldThe record is now settling. Send the payment to your facilitator's /verify and /settle, then report its
transaction (see report).
5. Read the record
import type { RecordView, Refusal } from "@integraledger/agentic-connectors";
const = .. ?? "https://seller.example/door";
const = .. ?? "";
// SHA-256("abc"): a hash this door never issued.
const = await (`${}/status/0xba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad`, {
: { : `Bearer ${}` },
});
const = (await .()) as RecordView | Refusal;
.(., "code" in ? . : .);404 door/not-foundNext
- The connector rules: what every connector does, and why.
- Issue, claim, report and status in depth.
- The seller door API: every field.
Last updated on