Skip to main content
Glama

Check an x402 payment before paying

check_payment
Read-onlyIdempotent

Decide whether a specific x402 payment should go through: returns allow true/false with reasons. Checks the endpoint's trust verdict, that the amount is within your cap and not above the monitored price, and that the payTo wallet matches the one we've observed (catches swapped or hijacked wallets). Optionally (minOrganicShare) it also requires that enough of the seller's volume comes from independent buyers. Intended for right before a payment, with the amount, payTo, and network from the endpoint's 402 quote; allow is true only when every rule passes. Use check_endpoint instead if you only want an endpoint's grade without a quote in hand. MPP quotes (WWW-Authenticate: Payment) work too: pass the challenge's recipient as payTo, its amount as is, and network tempo:4217 (Tempo) or stripe (card, with the amount in 6-decimal USD: 50 cents is 500000). Read-only and free; it doesn't make or block the payment itself. When allow is false, the reasons list explains why. pauseDuringRetest: true also holds payments while a failed paid test awaits its re-test. API docs: https://github.com/Book0fEli/lumiere-paycheck/blob/main/docs/api.md

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "url": "<url>"
    },
    "name": "check_payment"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesFull URL of the x402 endpoint you are about to pay, including path
assetNoToken (asset) address from the quote. Send it: a quote asking for a different token than this endpoint charges is denied (asset swap).
payToNoWallet address from the endpoint's 402 quote
amountNoAmount about to be paid, atomic units (USDC has 6 decimals: 10000 = $0.01)
networkNoNetwork from the quote, e.g. eip155:8453. Send it: a quote on a network this endpoint never uses is denied.
hasAccessNotrue if you have your own account, API key or sign-in with this seller. For endpoints that need the seller's sign-in on top of x402, allowCaution/requireVerified then don't block (we couldn't confirm delivery only because we can't sign in).
maxAmountNoYour hard cap for this payment in atomic units (USDC: 1000000 = $1). Payments above it are denied.
allowCautionNofalse = deny endpoints with a caution verdict too, not just avoid (default true)
allowLookalikeNotrue = don't ask for review when the endpoint is flagged as a possible lookalike of an established seller (default false)
priceToleranceNoOptional, 0-0.5 (default 0.02 = 2%): how far above the endpoint's recent prices still counts as the same price, for sellers whose price drifts (pegged to BTC, gas or FX). Bigger jumps are denied as overcharges.
minOrganicShareNoOptional, 0-1: deny sellers where less than this share of 30-day volume comes from independent buyers (e.g. 0.5). Not applied to sellers whose buyers haven't been reviewed yet.
requireVerifiedNotrue = only allow endpoints that delivered on a real test payment (default false)
pauseDuringRetestNotrue = deny while our latest paid test of this endpoint failed and its re-test (about 2 hours later) hasn't run yet (default false: allowed, with a note and a retest field)

Output Schema

NameRequiredDescriptionDefault
urlNo
allowYesPay only when true
gradeNo
notesNo
scoreNo
buyersNoWho is really behind the seller's buyers. Never changes the grade.
intakeNoFor an endpoint we don't monitor yet: it's put in line for a first check, and joins the catalog within about 10 minutes if it answers a valid x402 payment quote
retestNoPresent while our latest paid test failed and its re-test (about 2 hours later) hasn't run: the grade still shows the earlier result and changes only if the re-test fails too
valuesNoAutomatic value checks on the latest paid response
listingNoPresent only when the latest paid response differs from the listing's example or schema. The data is delivered.
reasonsYesWhy it was allowed or denied
verdictNoproceed | caution | avoid | free | insufficient_data
deliveryNo
forTeamsNoShort note about team plans (per-agent keys, spend limits, audit trail)
observedNoThe latest payment quote our monitor saw
lookalikeNoPresent when this new endpoint looks like an imitation of an established seller (name one character off, lookalike characters, or a copied listing) and pays a different wallet. check_payment asks for review unless allowLookalike is true.
monitoredYesWhether the endpoint is in the monitored catalog
payToModeNo
protectedNoWhen allow is false and you sent an agent key or a free API key: what PayCheck has stopped for this key so far. Tell the user the message.
reviewableNoDenied only for reasons a person may approve
afterPayingNoHow to report the outcome after paying (free, verified on-chain)
authRequiredNotrue: the seller needs its own sign-in on top of x402; send hasAccess: true if you have it
buyerReportsNoWhat real buyers reported after paying. Never changes the grade; confirmations move the endpoint up our paid-test queue.
gradeReasonsNoEvery factor behind the endpoint's grade (same as check_endpoint's reasons)
declaredPayToNoPayout wallets the seller declared itself
gradeHeadlineNoWhy the endpoint has its grade, in one sentence
walletUnconfirmedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedOutput schema / properties / protected
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "When allow is false and you sent an agent key or a free API key: what PayCheck has stopped for this key so far. Tell the user the message.",
      +  "properties": {
      +    "blockedPayments": {
      +      "type": "number"
      +    },
      +    "blockedUsd": {
      +      "type": "number"
      +    },
      +    "last30Days": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "blockedPayments": {
      +          "type": "number"
      +        },
      +        "blockedUsd": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "blockedPayments",
      +        "blockedUsd"
      +      ],
      +      "type": "object"
      +    },
      +    "message": {
      +      "type": "string"
      +    },
      +    "since": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    }
      +  },
      +  "required": [
      +    "blockedPayments",
      +    "blockedUsd",
      +    "last30Days",
      +    "since",
      +    "message"
      +  ],
      +  "type": "object"
      +}
  2. Changed3 schema fields changed
    • addedInput schema / properties / pauseDuringRetest
      Added value: +{
      +  "description": "true = deny while our latest paid test of this endpoint failed and its re-test (about 2 hours later) hasn't run yet (default false: allowed, with a note and a retest field)",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / intake
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "For an endpoint we don't monitor yet: it's put in line for a first check, and joins the catalog within about 10 minutes if it answers a valid x402 payment quote",
      +  "properties": {
      +    "note": {
      +      "type": "string"
      +    },
      +    "status": {
      +      "description": "queued | checking | monitored | rejected_recently | host_full | busy | invalid",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "note"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / retest
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Present while our latest paid test failed and its re-test (about 2 hours later) hasn't run: the grade still shows the earlier result and changes only if the re-test fails too",
      +  "properties": {
      +    "firstFailureAt": {
      +      "type": "string"
      +    },
      +    "moneyTaken": {
      +      "type": "boolean"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "pending": {
      +      "type": "boolean"
      +    },
      +    "reason": {
      +      "type": "string"
      +    },
      +    "retestDueBy": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "pending",
      +    "firstFailureAt",
      +    "retestDueBy",
      +    "moneyTaken",
      +    "reason",
      +    "note"
      +  ],
      +  "type": "object"
      +}
  3. Changed5 schema fields changed
    • addedInput schema / properties / allowLookalike
      Added value: +{
      +  "description": "true = don't ask for review when the endpoint is flagged as a possible lookalike of an established seller (default false)",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / asset
      Added value: +{
      +  "description": "Token (asset) address from the quote. Send it: a quote asking for a different token than this endpoint charges is denied (asset swap).",
      +  "type": "string"
      +}
    • changedInput schema / properties / network / description
      Previous value: -"Network from the quote, e.g. eip155:8453"New value: +"Network from the quote, e.g. eip155:8453. Send it: a quote on a network this endpoint never uses is denied."
    • addedOutput schema / properties / lookalike
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Present when this new endpoint looks like an imitation of an established seller (name one character off, lookalike characters, or a copied listing) and pays a different wallet. check_payment asks for review unless allowLookalike is true.",
      +  "properties": {
      +    "of": {
      +      "type": "string"
      +    },
      +    "reason": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "of",
      +    "reason"
      +  ],
      +  "type": "object"
      +}
    • changedOutput schema / properties / observed / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "amount": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "network": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "payTo": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "seenAt": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      }
      -    },
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "amount": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "assets": {
      +        "description": "Tokens this endpoint has been seen quoting",
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "network": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "payTo": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "seenAt": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  4. Changed1 schema field changed
    • addedInput schema / properties / priceTolerance
      Added value: +{
      +  "description": "Optional, 0-0.5 (default 0.02 = 2%): how far above the endpoint's recent prices still counts as the same price, for sellers whose price drifts (pegged to BTC, gas or FX). Bigger jumps are denied as overcharges.",
      +  "maximum": 0.5,
      +  "minimum": 0,
      +  "type": "number"
      +}
  5. Changed2 schema fields changed
    • addedOutput schema / properties / gradeHeadline
      Added value: +{
      +  "description": "Why the endpoint has its grade, in one sentence",
      +  "type": "string"
      +}
    • addedOutput schema / properties / gradeReasons
      Added value: +{
      +  "description": "Every factor behind the endpoint's grade (same as check_endpoint's reasons)",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "at": {
      +        "description": "Date of the event it's based on (YYYY-MM-DD)",
      +        "type": "string"
      +      },
      +      "effect": {
      +        "description": "positive, neutral or negative",
      +        "type": "string"
      +      },
      +      "factor": {
      +        "description": "data, delivery, uptime, speed, wallet, price, listing, values, access or withdrawn",
      +        "type": "string"
      +      },
      +      "limit": {
      +        "description": "The ceiling this factor puts on the grade, e.g. \"F (max 39)\"",
      +        "type": "string"
      +      },
      +      "text": {
      +        "description": "What we found, in plain words (paid-test results include the date and what came back)",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "factor",
      +      "effect",
      +      "text"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  6. Changed2 schema fields changed
    • addedInput schema / properties / hasAccess
      Added value: +{
      +  "description": "true if you have your own account, API key or sign-in with this seller. For endpoints that need the seller's sign-in on top of x402, allowCaution/requireVerified then don't block (we couldn't confirm delivery only because we can't sign in).",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / authRequired
      Added value: +{
      +  "description": "true: the seller needs its own sign-in on top of x402; send hasAccess: true if you have it",
      +  "type": "boolean"
      +}
  7. Changed3 schema fields changed
    • addedOutput schema / properties / afterPaying
      Added value: +{
      +  "description": "How to report the outcome after paying (free, verified on-chain)",
      +  "type": "string"
      +}
    • addedOutput schema / properties / buyerReports
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "What real buyers reported after paying. Never changes the grade; confirmations move the endpoint up our paid-test queue.",
      +  "properties": {
      +    "confirmed": {
      +      "description": "Buyers (customers or wallets) who reported a usable response in 7 days",
      +      "type": "number"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "ourTestQueued": {
      +      "description": "Our own paid test is queued for this endpoint",
      +      "type": "boolean"
      +    },
      +    "problems": {
      +      "description": "Buyers who reported a problem in 7 days",
      +      "type": "number"
      +    },
      +    "windowDays": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "confirmed",
      +    "problems",
      +    "ourTestQueued",
      +    "windowDays",
      +    "note"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / values
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Automatic value checks on the latest paid response",
      +  "properties": {
      +    "checked": {
      +      "type": "boolean"
      +    },
      +    "warning": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "checked"
      +  ],
      +  "type": "object"
      +}
  8. Changed3 schema fields changed
    • changedOutput schema / properties / listing / description
      Previous value: -"Present only when the latest paid response doesn't match the listing's example. The data is delivered; the grade is capped at B until the listing matches."New value: +"Present only when the latest paid response differs from the listing's example or schema. The data is delivered."
    • addedOutput schema / properties / listing / properties / capped
      Added value: +{
      +  "description": "true: the data is reshaped vs the listing (nested, list vs item), grade capped at B; false: a minor gap, warning only",
      +  "type": "boolean"
      +}
    • changedOutput schema / properties / listing / properties / sellerFix / description
      Previous value: -"What the seller changes to lift the B cap"New value: +"What the seller can change"
  9. Changed1 schema field changed
    • addedOutput schema / properties / listing
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Present only when the latest paid response doesn't match the listing's example. The data is delivered; the grade is capped at B until the listing matches.",
      +  "properties": {
      +    "matchesExample": {
      +      "description": "false: the paid response differs from the seller's own example",
      +      "type": "boolean"
      +    },
      +    "sellerFix": {
      +      "description": "What the seller changes to lift the B cap",
      +      "type": "string"
      +    },
      +    "warning": {
      +      "description": "How the real response differs, and where to read the fields",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "matchesExample",
      +    "warning",
      +    "sellerFix"
      +  ],
      +  "type": "object"
      +}
  10. Changed2 schema fields changed
    • addedInput schema / properties / minOrganicShare
      Added value: +{
      +  "description": "Optional, 0-1: deny sellers where less than this share of 30-day volume comes from independent buyers (e.g. 0.5). Not applied to sellers whose buyers haven't been reviewed yet.",
      +  "maximum": 1,
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedOutput schema / properties / buyers
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Who is really behind the seller's buyers. Never changes the grade.",
      +  "properties": {
      +    "buyerWallets30d": {
      +      "description": "Buyer wallets that paid the seller in 30 days",
      +      "type": "number"
      +    },
      +    "estimated": {
      +      "description": "true when counted from a sample of buyers",
      +      "type": "boolean"
      +    },
      +    "flags": {
      +      "description": "coordinated_wallets, self_funded, concentrated_buyers, shared_operator, estimated, partial_lookup",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "independentBuyers30d": {
      +      "description": "Independent buyers behind the seller's buyer wallets in 30 days (wallets funded from one source count as one)",
      +      "type": "number"
      +    },
      +    "organicShare": {
      +      "description": "0-1: share of 30-day volume from independent buyers",
      +      "type": "number"
      +    },
      +    "reviewed": {
      +      "description": "false until the seller's buyers have been reviewed (the biggest sellers are reviewed daily)",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "reviewed"
      +  ],
      +  "type": "object"
      +}
  11. First observed

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint/ idempotent/ non-destructive, but the description adds real behavior context: it lists which rules are evaluated, that allow is true only when every rule passes, that rejected payments come back with reasons, and that pauseDuringRetest holds payments pending a re-test. It also clarifies that the tool itself neither makes nor blocks the payment, which prevents an agent from assuming it is an enforcement point. No contradiction with annotations; it only omits operational details such as rate limits or latency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the decision and return value, and the alternative tool and MPP edge cases follow in a logical order. It is one dense paragraph with stacked parentheticals (MPP mapping, pauseDuringRetest, docs link) that takes effort to parse, but nearly every clause carries decision-relevant information, so little is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter gating tool with an output schema, the description covers the decision logic, the deny-path explanation (reasons list), the identity/quote provenance requirements, and the one non-obvious protocol path (MPP/Tempo/stripe). It also points to external API docs for deeper detail, so an agent has everything needed to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description contributes meaning the schema cannot: network values may be tempo:4217 (Tempo) or stripe (card), stripe amounts are 6-decimal USD (50 cents = 500000), and allow semantics are conjunctive across all rules. minOrganicShare and pauseDuringRetest are explained with their default behavior and preconditions (not applied to sellers with unreviewed buyers).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb and resource ('Decide whether a specific x402 payment should go through') and immediately gives the return contract ('allow true/false with reasons'). It explicitly contrasts with the sibling check_endpoint ('use check_endpoint instead if you only want an endpoint's grade without a quote in hand'), so an agent can route correctly without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit invocation window ('right before a payment') and the exact inputs to source from the endpoint's 402 quote (amount, payTo, network). It names the alternative tool and the condition that selects it, plus specific handling guidance for MPP quotes (recipient as payTo, stripe amounts in 6-decimal USD).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.