x402 合规一致性规范 v0.1
给 Agent 支付(x402 / MCP)结算前合规的一套机读契约:每一种合规判决对应一个稳定 reason_code、一个 signal_class、一条 retry 规则。1:1 对齐线上真实的 11 道闸,可对免费端点复现。
端点【今天就返回】 reason_code / signal_class / retry / retry_hint(HTTP 状态码仍是 200/403/409)。 451/-4510 的换码 = 提议中、尚未上线(换 HTTP 状态码是破坏性变更,须版本协商)。
1 · 信号类别与 retry 规则
| signal_class | 含义 | retry |
|---|---|---|
| ok | 未发现拦截信号 | not_applicable |
| payment | 额度/预算(可补足) | retryable_after_funding |
| regulatory | 确定性合规 FAIL(制裁/混币/吊销/重放) | non_retryable |
| authorization | 归因/授权/白名单/凭证 | retry_after_authorization |
| uncertain | 筛查不可得/不确定 | policy_dependent_backoff |
| client_error | 请求格式错误 | retry_after_fix |
2 · reason_code 分类(对齐真实检查项)
| reason_code | signal_class | retry | 来自 |
|---|---|---|---|
| kya_unattributed | authorization | retry_after_authorization | KYA |
| mandate_revoked | authorization | non_retryable | KYA/Revoked |
| kya_proof_missing | authorization | retry_after_authorization | KYA/Proof |
| kyc_required | authorization | retry_after_authorization | KYA/KYC |
| invalid_input | client_error | retry_after_fix | Input |
| over_per_tx_limit | payment | retryable_after_funding | Firewall/Limit |
| over_daily_limit | payment | retryable_after_funding | Firewall/Velocity |
| payee_not_allowlisted | authorization | retry_after_authorization | Firewall/Allowlist |
| mandate_intent_mismatch | authorization | retry_after_authorization | Mandate |
| sanctioned_or_high_risk_payee | regulatory | non_retryable | Screening/AML |
| behavioral_anomaly | uncertain | policy_dependent_backoff | Behavior/Anomaly |
| replay_detected | authorization | non_retryable | Mandate/Replay |
| clear | ok | not_applicable | allow |
| elevated_risk_payee | uncertain | policy_dependent_backoff | screening: review |
| screening_unavailable | uncertain | policy_dependent_backoff | screening unavailable |
| free_allowance_exhausted | payment | retryable_after_funding | anonymous monthly allowance used up on /api/decide, /api/risk or /api/payee/decide (HTTP 402): pay per call or use a free key |
| screening_partially_unavailable | uncertain | policy_dependent_backoff | screening: part of the on-chain data could not be fetched and nothing else was found; re-check later |
| payment_request_untrusted | authorization | non_retryable | POST /api/payment-request: spoofed sender, phishing link, listed payee, AI-aimed instructions, or a changed-payment-details pattern |
| payment_request_needs_confirmation | uncertain | retry_after_authorization | POST /api/payment-request: suspicious traits worth confirming through a trusted channel |
| phishing_endpoint | regulatory | non_retryable | GET /api/endpoint: the URL or its parent domain is on a phishing-domain list |
| elevated_risk_endpoint | uncertain | policy_dependent_backoff | GET /api/endpoint: suspicious hostname shape or an unknown host |
| payee_differs_from_listing | authorization | retry_after_authorization | POST /api/decide: payment_intent.payee differs from the payout wallet listed for resource_ref in the public x402 directory |
| payee_changed_since_previous | authorization | retry_after_authorization | POST /api/decide: payee, network or asset differs from previous_payment_intent |
| payee_not_bound_to_origin | authorization | retry_after_fix | POST /api/decide: the origin of payment_intent.resource_ref quotes a different payee (RAP §6.5, proposed) |
| payee_origin_binding_unavailable | uncertain | policy_dependent_backoff | POST /api/decide: the origin of payment_intent.resource_ref could not be checked (RAP §6.5, proposed) |
| payee_not_authorized_by_origin | authorization | retry_after_authorization | POST /api/decide: the controller of the resource_ref origin published a signed payout-address list for this network that does not include the payee (payee_authorization.status not_bound); raises allow to review |
| payee_change_not_authorized_by_origin | authorization | retry_after_authorization | POST /api/decide: the payee changed since previous_payment_intent and the origin's signed payout-address list excludes the new payee; decline |
| payee_is_token_contract | client_error | retry_after_fix | screening: payee is a token contract address, not a recipient |
| payer_screening_declined | regulatory | non_retryable | x402 paid endpoints: the paying wallet is on a sanctions or risk list, so OceanAlt does not settle the payment |
| idempotency_key_invalid | client_error | retry_after_fix | POST /api/pay: malformed Idempotency-Key (400) |
| idempotency_key_reused | client_error | retry_after_fix | POST /api/pay: Idempotency-Key reused with a different body (422) |
| idempotency_request_in_progress | uncertain | policy_dependent_backoff | POST /api/pay: original request with this Idempotency-Key still running (409) |
| key_scope_denied | authorization | retry_after_authorization | API key restricted to other scopes by its holder (403) |
| key_ip_denied | authorization | retry_after_authorization | API key restricted to an IP allowlist by its holder; this request came from elsewhere (403) |
| x402_v1_payment_unmatched | client_error | retry_after_fix | x402 paid endpoints: an x402 v1 payment header that matches none of the offered requirements (402 with payment_error) |
| beta_wallet_daily_limit | payment | policy_dependent_backoff | paid endpoints on mainnet: this wallet reached its daily call limit (429); nothing was settled |
| beta_ip_daily_limit | payment | policy_dependent_backoff | paid endpoints on mainnet: this caller reached its daily call limit (429) |
| beta_global_daily_limit | payment | policy_dependent_backoff | paid endpoints on mainnet: the daily limit for all callers was reached (429) |
| beta_monthly_fee_cap | payment | policy_dependent_backoff | paid endpoints on mainnet: the monthly fee cap was reached (429) |
| mainnet_disabled | uncertain | policy_dependent_backoff | paid endpoints on mainnet: paid access is closed (503); free tools are unaffected |
| mainnet_kill_switch | uncertain | policy_dependent_backoff | paid endpoints on mainnet: paid access is paused for maintenance (503); free tools are unaffected |
| mainnet_guard_unavailable | uncertain | policy_dependent_backoff | POST /api/mpp/decision: the pre-payment guard could not be evaluated (503); nothing was charged |
| geo_blocked | regulatory | non_retryable | paid endpoints on mainnet: paid access is not offered in the caller's region (451) |
| decision_failed_after_payment | uncertain | non_retryable | POST /api/mpp/decision: the payment settled but no decision was produced (503); recorded for a manual refund, do not treat it as allow and do not pay again for the same call |
| credit_malformed | client_error | retry_after_fix | POST /api/x402/decision with a credit token: the token is malformed (403) |
| credit_unknown | client_error | retry_after_fix | POST /api/x402/decision with a credit token: the token is not known (403) |
| credit_pending | payment | policy_dependent_backoff | POST /api/x402/decision with a credit token: the pack's payment has not settled yet (403) |
| credit_failed | payment | retryable_after_funding | POST /api/x402/decision with a credit token: the pack's payment never settled, so it never activated (403) |
| credit_revoked | authorization | non_retryable | POST /api/x402/decision with a credit token: the pack was revoked (403) |
| credit_expired | payment | retryable_after_funding | POST /api/x402/decision with a credit token: the pack expired (402); buy a new one at POST /api/x402/credits |
| credit_exhausted | payment | retryable_after_funding | POST /api/x402/decision with a credit token: no credits left (402); buy a new pack at POST /api/x402/credits |
| mandate_signature_invalid | authorization | non_retryable | POST /api/mandate/check: mandate_signature_check.reason_code when the mandate signature does not verify |
| mandate_signature_unverifiable | uncertain | policy_dependent_backoff | POST /api/mandate/check: mandate_signature_check.reason_code when the signature could not be checked |
| ok | ok | not_applicable | POST /api/x402/verify-requirements: the signed payment requirements verify under the seller's published key |
| no_signature | uncertain | not_applicable | POST /api/x402/verify-requirements: the 402 response carries no signed requirements, so nothing was verified |
| digest_mismatch | authorization | non_retryable | POST /api/x402/verify-requirements: the protected fields differ from the digest the seller signed |
| signature_invalid | authorization | non_retryable | POST /api/x402/verify-requirements: the signature does not verify under the seller's published key |
| key_unavailable | uncertain | policy_dependent_backoff | POST /api/x402/verify-requirements: no public key with that key_id at the seller's keys_url |
| payto_mismatch | authorization | non_retryable | POST /api/x402/verify-requirements: the signed requirements are genuine but name a different payTo |
| amount_mismatch | authorization | non_retryable | POST /api/x402/verify-requirements: the signed requirements are genuine but name a different amount |
3 · 可复现测试向量(对免费端点)
curl "https://oceanalt.com/api/risk?addr=0x8589427373D6D84E98730D7795D8f6f8731FDA16" # → verdict:"risky", reason_code:"sanctioned_or_high_risk_payee", signal_class:"regulatory", retry:"non_retryable"
curl "https://oceanalt.com/api/risk?addr=0x742d35Cc6634C0532925a3b844Bc454e4438f44e" # → verdict:"clear", reason_code:"clear", signal_class:"ok", retry:"not_applicable"

