The reclaim function allows payers to recover their funds from escrow after the authorization expiry period has passed. This provides a safety mechanism ensuring payers can always retrieve their funds from abandoned or unfulfilled payments.
Reclaim protects payers by:
- Payer-controlled recovery: Puts fund recovery control in payer's hands
- Preventing permanent fund loss: Guarantees payers can recover escrowed funds
- Handling abandoned payments: Addresses cases where operators don't capture or void before authorization expiry
function reclaim(PaymentInfo calldata paymentInfo)
external nonReentrant onlySender(paymentInfo.payer)- Timing Validation: Ensures current time is after
authorizationExpiry - Authorization Check: Verifies that capturable funds exist for the payment
- State Clearing: Sets
capturableAmountto zero permanently - Fund Return: Transfers all capturable funds back to the payer
- Event Emission: Emits
PaymentReclaimedfor tracking
| Parameter | Type | Description |
|---|---|---|
paymentInfo |
PaymentInfo |
Original payment configuration identifying the payment to reclaim |
- Payer Only: Only
paymentInfo.payercan call this function - Requires Liquidity: Payment must have non-zero
capturableAmount, but can be partially captured - Time Restricted: Can only be called after
authorizationExpiry
PaymentState {
hasCollectedPayment: true,
capturableAmount: 1000e6, // $1000 USDC still authorized
refundableAmount: 0
}
PaymentState {
hasCollectedPayment: true,
capturableAmount: 0, // Cleared - cannot capture anymore
refundableAmount: 0 // No refundable amount (funds returned)
}
event PaymentReclaimed(
bytes32 indexed paymentInfoHash,
uint256 amount
);Track reclaimed payments for analytics and user notifications.
| Error | Cause |
|---|---|
InvalidSender |
Caller is not the original payer |
BeforeAuthorizationExpiry |
Called before authorization expiry time |
ZeroAuthorization |
Payment has no capturable amount to reclaim |
