Workspace IndexDev Notes › A refund is a new payment — support flows on irreversible rails

#64PoC

A refund is a new payment — support flows on irreversible rails

Settlement finality does not delete refunds from your product — it moves them from reverse-the-charge to issue-a-linked-counter-payment. The refund becomes a first-class payment with its own receipt, policy and budget.

Implement a refund flow where the refund transaction carries a reference to the original payment, gate it behind an approval policy and a funded refund budget, and reconcile the pair in one ledger view.

Why

Card rails bake refunds into the protocol: reverse the charge, the network handles the money. Crypto rails bake in the opposite: nobody can reverse anything, ever. Products read this as refunds are impossible — but the customer promise never went away, so what actually happened is that the refund moved up a layer: it is now a second payment, flowing the other way, that your application must create, fund, authorize and account for.

That relocation raises exactly the questions card networks answered internally: who approves (support agent, policy rule, second signer), within what window, from which pool of money (refunds need a funded balance — the original payment may already be swept), and how the pair is linked so accounting sees one net event rather than two unrelated transfers. An on-chain reference from refund to original makes the link auditable by anyone — one small advantage the transparent rail adds over the card networks it is imitating.

How it works

A payment, a linked counter-payment, a policy gate, and one reconciled ledger.

PoC

On anvil: a merchant contract (or plain transfers plus a server ledger) where checkout records { paymentId, payer, amount }. Refund path: a support action creates a refund intent referencing paymentId; policy engine checks window (≤ 14 days), amount (≤ original, cumulative across partial refunds), and approver role; the refund pays from a dedicated refund-budget wallet and emits or memos the original paymentId. Ledger view joins the pair and shows net. Tests: double-refund blocked, partial refunds sum-capped, empty refund budget fails loudly before promising the customer, and the x402-settlement-retry boundary — a refund of a payment whose settlement later failed.

What it proves

Irreversibility is a property of the rail, not of the business. The product re-creates reversal as composition — new payment plus reference plus policy — and the hard parts are the ones card networks hid: funding the refund pool and defining who may say yes. This card is the support-desk face of receipt-is-not-settlement.

← All Dev Notes · Workspace Index · Top ↑

환불은 새 결제다 — 되돌릴 수 없는 레일의 CS 플로우

정산 파이널리티는 제품에서 환불을 지우지 않습니다 — 청구 취소에서 원결제를 참조하는 역방향 결제 발행으로 옮길 뿐입니다. 환불은 자기 영수증·정책·예산을 가진 일급 결제가 됩니다.

환불 트랜잭션이 원결제 참조를 싣게 구현하고, 승인 정책과 자금이 채워진 환불 예산 뒤에 게이트하고, 한 장부 뷰에서 결제-환불 쌍을 대사합니다.

카드 레일은 환불을 프로토콜에 구웠습니다: 청구를 취소하면 네트워크가 돈을 처리합니다. 크립토 레일은 정반대를 구웠습니다: 누구도, 무엇도, 영원히 되돌릴 수 없습니다. 제품은 이것을 “환불 불가”로 읽지만 — 고객에 대한 약속은 사라진 적이 없으므로, 실제로 일어난 일은 환불이 한 층 위로 이사한 것입니다: 이제 환불은 반대 방향으로 흐르는 두 번째 결제이고, 애플리케이션이 그것을 만들고, 자금을 대고, 승인하고, 회계 처리해야 합니다.

그 이사는 카드 네트워크가 내부에서 답했던 질문들을 정확히 다시 제기합니다: 누가 승인하는가(상담원, 정책 규칙, 2차 서명자), 어떤 기한 안에, 어느 자금 풀에서(환불에는 채워진 잔액이 필요합니다 — 원결제 대금은 이미 쓸려 나갔을 수 있습니다), 그리고 회계가 무관한 전송 둘이 아니라 하나의 순 사건을 보도록 쌍을 어떻게 잇는가. 환불에서 원결제로의 온체인 참조는 그 연결을 누구나 감사할 수 있게 합니다 — 투명한 레일이 모방 대상인 카드 네트워크보다 나은 작은 지점 하나입니다.

동작 방식

결제 하나, 연결된 역결제 하나, 정책 게이트, 그리고 대사된 장부 하나.

PoC

anvil 위에서: 체크아웃이 { paymentId, payer, amount } 를 기록하는 상인 컨트랙트(또는 일반 전송 + 서버 장부). 환불 경로: CS 액션이 paymentId 를 참조하는 환불 의도를 만들고, 정책 엔진이 기한(≤ 14일)·금액(≤ 원금, 부분 환불 누적 상한)·승인자 역할을 검사하고, 환불은 전용 환불 예산 지갑에서 지급되며 원 paymentId 를 이벤트나 메모로 남깁니다. 장부 뷰는 쌍을 조인해 순액을 보여줍니다. 테스트: 이중 환불 차단, 부분 환불 합계 상한, 빈 환불 예산은 고객에게 약속하기 전에 시끄럽게 실패, 그리고 x402-settlement-retry 와의 경계 — 정산이 나중에 실패한 결제의 환불.

무엇을 증명하나

비가역성은 레일의 성질이지 사업의 성질이 아닙니다. 제품은 되돌림을 합성으로 재창조합니다 — 새 결제 + 참조 + 정책 — 그리고 어려운 부분은 카드 네트워크가 숨겨 왔던 것들입니다: 환불 풀에 자금을 대는 것과 누가 예라고 말할 수 있는지 정의하는 것. 이 카드는 receipt-is-not-settlement 의 CS 데스크 면입니다.

← 전체 개발 노트 · 워크스페이스 인덱스 · 맨 위 ↑