Skip to main content
Refund all or part of a protocol charge or capture before refundExpiry. The Commerce Payments Protocol maintains the refundable limit onchain and always sends the refund to paymentInfo.payer.

Demo

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

Fund and Submit the Refund

Captured funds have already left escrow. The deployed OperatorRefundCollector sources replacement liquidity from paymentInfo.operator, so approve it for the refund amount before calling refund.
TypeScript
Every charge or capture increases refundableAmount by its gross amount. Fees do not reduce that limit. Every refund decreases it by the amount returned.
Verify PaymentRefunded(paymentInfoHash, amount, tokenCollector), the transfer to the stored payer, and the updated refundableAmount before completing the return.
Refund accounting is not refund liquidity. The operator or another independently authorized source must provide the tokens. Never reuse residual payer authorization to fund a refund.

See Also

Verify a Payment

Confirm the original protocol settlement and payment hash.

Reconcile Payments

Match refunds to charges and captures.