Monitor Incoming Payments with WebSocket
This tutorial shows how to watch for payments arriving at an XRP Ledger address, live, over a WebSocket connection. All transactions on the XRP Ledger are public, so anyone can watch any address.
- Section
- Tutorials
What you will do
You open one connection to a server. It stays open and carries messages both ways. You subscribe to an account and then read each transaction message to see what the account received. The examples use plain JavaScript without a client library, so you can carry the steps over to other programming languages.
What you need
You need some JavaScript knowledge, a stable internet connection and access to an XRP Ledger server. The examples connect to Ripple's public servers. You also need a number type that can do math on 64-bit unsigned integers, so XRP values are not rounded. The tutorial uses big.js for that.
The steps in short
Connect to a server. Set up a dispatcher, a function that reads the type field of each incoming message and passes it to the right handler. Call the subscribe method with the account's address. The server then sends a message of type transaction for each validated transaction that affects the account.
Reading a payment
Check that validated is true and that the result is tesSUCCESS. If not, nothing was delivered. For a Payment, check that the Destination is your address and read delivered_amount to see how much really arrived, not the Amount field. Money can also arrive through CheckCash, EscrowFinish, OfferCreate and PaymentChannelClaim transactions. For those, look at the metadata.
Good to know
A response with the status success only means the server understood your request. To reach an xrpld server on your own machine with the default settings, the tutorial uses an unsecured connection on port 6006. The page also gives starting examples in Go and Python.
Source: xrpl.org. Read 6 December 2026.
Zerpedia states what the source says, in plain words, and gives no opinion. How Zerpedia is made