How-to for developers · NFTs

Broker an NFT Sale Using JavaScript

In plain words

This tutorial shows how a third account can act as a broker for an NFT sale, using a JavaScript sample in your browser. The broker matches a sell offer with a buy offer and adds an agreed fee. The funds and the ownership of the NFT change hands at the same moment.

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

How a brokered sale works

The broker acts on behalf of the NFT owner. The seller creates an offer with the broker account as its destination. The broker gathers and weighs buy offers and chooses which one to accept, adding an agreed fee for arranging the sale. This lets an account act as a marketplace or a personal agent for NFT creators and traders.

What you need

You need a broker account, a Sell Offer with the broker account as its Destination, and one or more Buy Offers for the same NFT. The page points to its other sample forms for this: mint a new NFT with a different issuer account, create the Sell Offer from that account, and create Buy Offers from other accounts. Then open broker-nfts.html in a browser, choose Devnet or Testnet and load your test accounts.

The steps in short

Enter the NFT ID and click Get Offers to list the offers. Copy the nft_offer_index of the sell offer into the Sell Offer Index field and the nft_offer_index of the buy offer into the Buy Offer Index field. Enter a Broker Fee in drops. One drop is the smallest unit of XRP. Click Broker Sale. The code prepares an NFTokenAcceptOffer transaction that carries both offers and the broker fee. With those extra values the transaction is read as a brokered sale.

Good to know

After accepting a buy offer, the page advises the broker to cancel all other offers, if the broker has permission to do so. The Transfer NFTs form can get and cancel any existing Sell or Buy offers.

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.