refund
Govern one refund linked to a sealed original charge receipt, with quote, reservation, approval, settlement evidence, and refund receipt sealing.
- License 许可
- MIT
- 所属仓库
- ZachDreamZ/runx
- 最近更新
- 2026-07-17
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- refund
- runx
- { "category": "payments" }
- description
- Govern one refund linked to a sealed original charge receipt, with quote, reservation, approval, settlement evidence, and refund receipt sealing.
02 资源文件 5
- 参考文档fixtures/refund-accept-ceiling.yaml3.7 KB
- 参考文档fixtures/refund-mock-path.yaml2.2 KB
- 参考文档fixtures/refund-mpp-path.yaml2.2 KB
- 参考文档fixtures/refund-stripe-path.yaml2.3 KB
- 参考文档X.yaml13.8 KB
03 SKILL.md 正文
Refund
Govern one refund linked to a sealed original charge receipt.
This skill is the public provider-side refund verb. It quotes refundable bounds from the original receipt, reserves refund authority, gates the refund decision, settles through one runtime path, and emits evidence for a refund receipt. The original receipt link is mandatory; a refund without provenance is not a governed refund.
The settlement family is a runtime path, not a separate public skill. Mock, MPP, and Stripe refunds share the same authority story: prove the original charge, quote the remaining refundable amount, reserve a refund under the same family, approve the reversal, settle once under idempotency, and seal the refund evidence.
What this skill does
- Link the original receipt. Require
original_receipt_refand a redacted original receipt summary before any refund authority is discussed. - Quote refundable bounds. Use
refund-quoteto calculate remaining amount, currency, settlement family, prior refund refs, and policy window. - Reserve refund authority. Use
refund-reserveto bind the refund decision to the original receipt, selected amount, same settlement family, and idempotency key. - Gate settlement. Record the approval decision before any runtime path settles the refund.
- Settle and seal evidence. Emit closure, proof ref, refund receipt ref, redactions, and recovery posture.
It does not silently refund an open dispute, refund across a different settlement family, or infer authority from operator intent alone.
When to use this skill
- A provider needs to reverse a previously sealed charge.
- A support or dispute workflow needs a receipt-linked refund artifact.
- A harness needs to prove refund behavior across mock, MPP, or Stripe runtime paths without exposing rail credentials.
When not to use this skill
- To answer a chargeback or dispute without deciding a refund. Use
dispute-respond. - To refund when the original charge receipt is missing or unsealed.
- To perform a cross-family refund unless a future policy explicitly models that authority. The current graph requires same-family refund semantics.
- To retry an ambiguous refund under a new idempotency key.
- To print raw provider credentials, merchant secrets, or unrestricted rail tokens into output.
Procedure
- Validate
original_receipt_ref,original_receipt,refund_request, andparent_payment_authority. - Confirm the original receipt is sealed and names amount, currency, counterparty, settlement family, and charge/refund lineage.
- Run
refund-quote. Stop when the original receipt, settlement family, refundable amount, prior refund set, or policy window is ambiguous. - Run
refund-reserve. The reserved refund authority must bind to the original receipt and stay within remaining refundable bounds. - Pause at the refund approval gate. A denied or missing approval prevents settlement.
- Settle through the selected runtime path and return refund closure, proof ref, refund receipt ref, redaction notes, and recovery posture.
- If settlement is ambiguous, require recovery under the same idempotency key before retrying.
Runtime paths
| Path | Use when | Required proof/evidence | Secret handling |
|---|---|---|---|
mock |
Deterministic local refund fixtures. | Mock refund proof ref, original receipt ref, refund idempotency key. | No real credentials; still redact fixture credential material. |
mpp |
The original charge settled through MPP and policy allows refund. | MPP refund proof ref, original receipt ref, idempotency key, settlement family. | Output refs only; do not expose rail session material. |
stripe |
The original charge settled through Stripe and policy allows refund. | Stripe refund proof/refund id when present, original charge receipt ref, idempotency key. | Never emit Stripe secret keys, webhook secrets, card data, PANs, or unrestricted tokens. |
There is no x402 refund runner in this skill. Current x402 support remains
buyer-side spend unless a separate product decision adds seller-side x402
refund semantics.
Edge cases and stop conditions
- Missing original receipt: return
needs_agent; a refund cannot be provenance-free. - Unsealed original receipt: return
needs_agent; the reversal must link to sealed charge evidence. - Prior refund already covers the amount: return
deniedorneeds_agent; do not double-refund. - Settlement family mismatch: return
needs_agent; same-family is required. - Approval denied or absent: do not settle.
- Ambiguous settlement: return
escalatedand require recovery under the same idempotency key. - Dispute is open: do not mask it with an untracked refund; route through
dispute-respondor record the dispute linkage explicitly.
Output schema (refund_execution)
decision: sealed | denied | needs_agent | escalated
runtime_path: mock | mpp | stripe
refund_quote_packet:
refund_quote: object
refundable_bounds: object
original_receipt_link: object
settlement_family: string
refund_reservation_packet:
payment_decision: object
reserved_payment_authority: object
idempotency: object
reservation: object
refund_approval:
approved: boolean
gate_id: string
refund_rail_packet:
refund_closure: object
refund_proof: object
refund_receipt_ref: string | null
open_questions: [string]
A sealed decision requires the original receipt link, same-family reservation,
approval, settlement proof, refund receipt ref, and no unresolved recovery
state.
Worked example
Receipt receipt:charge:stripe:paid-search-001 proves a sealed Stripe charge
for 1.25 USD. The operator requests a full refund. refund quotes remaining
refundable bounds of 1.25 USD, reserves refund authority bound to that receipt,
records approval, settles through the stripe runtime path, and emits
receipt:refund:stripe:paid-search-001. The result is decision: sealed.
If a prior refund receipt already covers 1.25 USD, the skill returns
decision: denied or needs_agent with the prior receipt refs. It does not
issue a second refund.
Inputs
original_receipt_ref(required): linked sealed charge receipt reference.original_receipt(required): redacted original charge receipt summary.refund_request(required): requested amount and reason.parent_payment_authority(required): parent payment authority term or ref.approval_context(optional): prior approval evidence.idempotency_seed(optional): stable refund idempotency seed.
04 同仓库更多 Skills
zapier-handoff
Validate a runx execution context and hand off a governed payload to a Zapier Catch Hook with scoped auth, idempotency, and receipt expectations.
x402-pay
Execute a governed x402 payment by delegating to the canonical spend flow with the x402 runtime path selected.
work-plan
Decompose a build objective into governed runx execution steps.
web-fetch
Fetch and extract one web source within an explicit allowlist, returning the content by digest with full provenance.
weather-forecast
Normalize provider weather evidence into an action-safe forecast packet with provenance, uncertainty, and stop conditions for downstream agents.
vuln-triage
Triage dependency or ecosystem vulnerability risk into remediation and advisory packets, grounding on verified CVE evidence when it is supplied.