Derive the lifecycle state of a payment from the escrow contract (amounts and expiry).
Copy
import { PaymentState } from '@x402r/core';const state = await client.getPaymentState(paymentInfo);// PaymentState enum:// 0 = NonExistent - Payment has never been authorized// 1 = InEscrow - Funds locked, capturableAmount > 0// 2 = Released - Funds released to receiver, may still be refundable// 3 = Settled - No funds in escrow or refundable// 4 = Expired - Authorization expired, payer can reclaim
This method scans event logs. Pass fromBlock to limit the scan range if your RPC limits eth_getLogs responses (Base Sepolia typically caps at 10,000 blocks).