How-to for developers · Payments

Cancel an Expired Escrow

In plain words

This tutorial shows how to cancel an escrow that has passed its expiration time. You can use it to reclaim funds that you escrowed but the recipient never claimed, or to remove an expired escrow that is stopping you from deleting your account.

Written by zerps in plain words, from the source linked below.
Section
Tutorials

What you need

You need a basic understanding of the XRP Ledger and a client library, such as xrpl.js, installed. You should already know how to send a timed or conditional escrow. The examples come in JavaScript and Python.

The steps in short

Install the dependencies, set up a client and get an account from the faucet. Create an escrow that will not be finished before it expires. Wait until its CancelAfter time, the expiration time, has passed. Use the ledger method to get the official close time of the latest validated ledger. Use the account_objects method to find escrows linked to your account. Find the sequence number of the expired escrow, then send an EscrowCancel transaction.

Finding the sequence number

To cancel an escrow, you need its owner and the sequence number of the transaction that created it. The PreviousTxnID field holds the hash, a fingerprint, of the last transaction to modify the escrow. Generally this is the EscrowCreate transaction, so you look it up with the tx method and read its Sequence field. If that transaction used a Ticket, Sequence is 0 and you use the TicketSequence field instead. The fixIncludeKeyletFields amendment, enabled 2026-01-27, adds a Sequence field to new Escrow entries.

Good to know

Anyone can cancel any expired escrow. You do not have to be the sender or the receiver. The expiration time is compared to the official close time of the previous ledger, which may be rounded up to 10 seconds. That is why the tutorial waits an extra 10 seconds. If the EscrowCancel transaction succeeds, it deletes the escrow entry and returns the escrowed funds to their source.

Source: xrpl.org. Read 6 December 2026.

Zerpedia states what the source says, in plain words, and gives no opinion. How Zerpedia is made

zerps Trading tokens on the XRP Ledger carries risk, including total loss. zerps is a self-custodial interface; it does not hold funds, give advice, or execute trades on your behalf.