{"uid":"cap_JPAOL61_pPoaAIb3SOxjs","slug":"agent-payment-retry-and-idempotency-decision-procedure-x402-f6dd252f","name":"Agent Payment Retry and Idempotency Decision Procedure (x402)","description":"Paid agent-facing brief on Agent payment retry and idempotency decision procedure: when an x402 payment attempt fails, times out, returns ambiguous settlement state, or the paid call errors after payment, decide whether to retry, refund-path, or abandon. Covers retry budget, idempotency keys, duplicate-settlement detection, timeout semantics, double-payment risk, and the boundary between retrying delivery vs refunding the payment.. Blunt decision procedure, not marketing.","url":"https://k2so.wrong.systems/api/services/agent-payment-retry-and-idempotency-decision-pro","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","properties":{"meta":{"enum":["0","1"],"type":"string","description":"Set to 1 for free metadata JSON (no payment required)"},"topic":{"type":"string","description":"Optional topic override for the decision procedure"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","title":"Agent payment retry and idempotency decision procedure: when an x402 p paid response","$schema":"https://json-schema.org/draft/2020-12/schema","required":["ok","paid","service","provider","result"],"properties":{"ok":{"type":"boolean"},"paid":{"type":"boolean"},"result":{"type":"object","required":["ok","service"],"properties":{"ok":{"type":"boolean","description":"Handler success"},"brief":{"type":"string","description":"Decision procedure prose for agents"},"model":{"type":"string"},"topic":{"type":"string"},"service":{"type":"string","description":"Service slug"},"procedure":{"type":"string"},"generatedAt":{"type":"string","description":"ISO-8601 timestamp"},"generationSource":{"enum":["llm","reasoning","deterministic"],"type":"string"}}},"payment":{"type":"object","properties":{"code":{"type":"string"},"payer":{"type":"string"},"detail":{"type":"string"},"selfPay":{"type":"boolean"},"transaction":{"type":"string"}}},"service":{"type":"string"},"provider":{"type":"string","const":"K-2SO"}}}}}}},"responseSchema":{"type":"json","example":{"ok":true,"paid":true,"result":{"ok":true,"brief":"plain prose decision procedure (120+ words)","model":"deepseek/deepseek-v4-flash-0731","topic":"string topic","service":"agent-payment-retry-and-idempotency-decision-pro","procedure":"same as brief","generatedAt":"2026-01-01T00:00:00.000Z","generationSource":"deterministic"},"service":"agent-payment-retry-and-idempotency-decision-pro","provider":"K-2SO"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"down","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_qMXIitgxonKD9Dpq5g6VP","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns a blunt, agent-facing decision procedure for handling x402 payment failures, timeouts, ambiguous settlement states, and post-payment errors — covering retry budgets, idempotency keys, duplicate-settlement detection, and refund-vs-abandon logic.","exampleAgentPrompt":"I just attempted an x402 payment and it timed out — I'm not sure if it settled or not. Walk me through the decision procedure: should I retry with a new idempotency key, wait and check settlement, or abandon and flag for a refund?","exampleUseCases":[{"title":"Handling ambiguous settlement after timeout","prompt":"My agent sent an x402 payment but the response timed out before I got confirmation — I don't know if USDC left the wallet or not. What's the correct procedure: retry, check settlement state first, or abandon?"},{"title":"Avoiding double-payment on retry","prompt":"An x402 payment went through but the downstream API call returned a 500 error. Should I retry the whole thing including the payment, or is there a way to retry just the delivery without paying again?"},{"title":"Setting retry budget for payment loop","prompt":"I'm building an agent that makes x402 payments in a loop and I need to know how many retries are safe, what idempotency keys to use, and at what point I should give up and flag the payment for review instead of retrying."}],"resultDescription":"A prose decision procedure brief (and structured fields) covering: whether to retry, refund-path, or abandon a failed/ambiguous x402 payment; retry budget recommendations; idempotency key semantics; how to detect duplicate settlements; timeout handling; double-payment risk boundaries; and the distinction between retrying delivery versus refunding the payment. Also includes generation metadata (model, timestamp, generation source).","failureModes":["Payment required (402) if USDC payment not attached — must pay $0.002 USDC per call","Topic override not recognized — returns default procedure without topic customization","Service unavailable or timeout on the k2so.wrong.systems host","Ambiguous or stale generation if generationSource is 'deterministic' rather than 'llm' or 'reasoning'"],"whenToPreferThis":"Choose this endpoint when an AI agent needs authoritative, blunt procedural guidance specifically for x402 payment error scenarios — particularly ambiguous settlement, timeouts, duplicate-payment risk, and idempotency key management. Prefer this over general payment documentation when the agent must make an autonomous real-time decision about retrying, refunding, or abandoning a failed x402 USDC payment on Base.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T19:02:44.583Z","isFirstParty":false}