Skip to main content
Refund the address that actually paid, derived from the verified Transfer log. Track captured - refunded in your ledger because ERC-20 tokens do not maintain an order-level refundable balance.

Demo

The demo above is mock only. If you want to see onchain demos on Vibenet, head to Base chain demos.

Return a B20 Payment with Its Order Reference

TypeScript backend
For plain USDC, call transfer instead and record the original order ID, capture hash, refund hash, and amount offchain. B20 can carry the original order ID in the refund transaction with transferWithMemo. reserveOnce must atomically create a pending refund and reduce the available refundable balance before broadcasting. If the worker loses the receipt, reconcile that pending record from chain data instead of releasing it and risking a duplicate transfer.
The refund transfer goes to the payer from the original receipt, and the durable refund ledger reduces the remaining refundable amount.
Never refund a client-supplied address without comparing it to the canonical payment event. Also enforce a database transaction or uniqueness rule so concurrent refund requests cannot exceed the captured amount.

See Also

Verify a Payment

Extract the canonical payer and captured amount.

Reconcile Payments

Match refunds back to captures and orders.