See Getting Started for prerequisites and installation.
Quick Overview
Fulfilling an order involves these steps:- Call fulfillOrder() - SDK prepares transaction actions and validates fees
- Execute approval (if needed) - One-time ERC-20 approval for currency
- Execute fulfillment - Submit the buy transaction
- Wait for confirmation - Order status transitions to
FILLED
Understanding Actions
ThefulfillOrder() call returns actions that must be executed in order:
Fee Validation: The
order object returned contains the most current fees, which may differ from when you queried the listing (e.g., protocol fee reductions during promotions). Always display the fees from this response to users before they sign.Filling an ERC-721 Order
ERC-721 orders are all-or-nothing—you must purchase the entire NFT.Basic Example
With Taker Fees
Marketplaces can charge taker fees when facilitating purchases:Filling collection bids, trait bids, and metadata bids
Collection bids, trait bids, and metadata bids are criteria-style buy orders: the seller (taker) must tell the orderbook whichtokenId they are selling into the bid. In the Orderbook SDK, pass tokenId as the fifth argument to fulfillOrder (after orderId, takerAddress, takerFees, and amountToFill). For a typical ERC-721 fill, set amountToFill to undefined and supply tokenId as a string.
- Collection bid: any token from the collection can be used (subject to order rules). See Collection bids.
- Trait bid: the same
tokenIdrequirement applies, and the token’s indexed metadata must match every trait filter on the bid. If metadata is missing or does not match, fulfillment will fail—treat as a validation error and choose another asset or refresh metadata. See Trait bids. - Metadata bid: the token must satisfy the bid’s matching spec — either its indexed
metadata_idequals the bid’smetadataId, or its indexed metadata satisfies every filter in the bid’smetadataCriteria. See Metadata bids.
Filling an ERC-1155 Order (Partial Fills)
ERC-1155 orders support partial fills—buy any quantity up to the available amount.Full Fill
Buy all available items:Partial Fill
Buy only some of the available items:Best-Effort Fulfillment
If you request more items than available, the orderbook attempts a “best-effort” fill:Best Effort: If
amountToFill exceeds available quantity, the orderbook fills up to the maximum available. No error is thrown—you get what’s available.ERC-1155 Taker Fee Rules
For ERC-1155 orders, taker fees have special rules:Complete ERC-1155 Example
Approval Handling
For ERC-20 currency listings, buyers must approve Seaport to spend tokens:One-Time Approval: Users only need to approve each ERC-20 currency once (or when allowance is insufficient). Subsequent purchases with the same currency skip the approval step.Native Currency: Listings priced in NATIVE (IMX) never require approval—only a fulfillment transaction.For architectural context, see the Approval Pattern documentation.
Fill Status
After fulfillment, check the fill status to see how much has been filled:Complete Purchase Flow
Full example with error handling and user feedback:Error Handling
Common errors during fulfillment:Checking Token Balance
Before fulfilling orders, validate that buyers have sufficient funds: Use ethers.js to check balance:Best Practices
- Show Expiration Timer: Display 3-minute countdown to user
- Validate Balance: Check buyer has sufficient funds before calling
fulfillOrder()(see above) - Display All Fees: Show protocol fee, royalty, maker fee, taker fee separately
- Handle Partial Fills: For ERC-1155, show available quantity and let users choose amount
- Optimistic UI: Show “Purchase Pending” immediately, update to “Purchased” after confirmation
- Refresh Listings: Poll or use webhooks to detect when orders are filled by others
Next Steps
Create Listings
Learn how to create NFT listings
Order Management
Query order status after purchase
Bulk Operations
Fill multiple orders in one transaction (shopping cart)
Cancel Orders
Cancel listings with soft or hard cancels
Example App
View complete Next.js example on GitHub