Marketplace and trading
Let customers list collectibles, buy from each other, make offers and trade. These flows use the same marketplace and P2P contracts as DYLI. No separate inventory or contracts to deploy.
The example app includes a homepage marketplace preview, searchable listings and offers, price and product filters, vault actions, a trade composer, and incoming and sent trades.
Choose your community
Save the settings on your app with PATCH /config:
{
"community_settings": {
"marketplace_enabled": true,
"trading_enabled": true,
"include_dyli_marketplace": false,
"include_dyli_collectors": false
}
}
| Setting | Off | On |
|---|---|---|
include_dyli_marketplace | Orders created through your Commerce app | Listings and offers across DYLI |
include_dyli_collectors | Customers synchronized to your app | Collectors across DYLI |
Both inclusion settings default off and can be changed independently. They control discovery and which outside orders or collectors your app can act on. They do not make activity private. Listings and offers created in your app always appear on DYLI, regardless of these settings. Trades use DYLI's normal inbox and activity, including trades with DYLI collectors. Contract activity is public.
In the example, set INCLUDE_DYLI_MARKETPLACE=true and/or INCLUDE_DYLI_COLLECTORS=true in your server environment. MARKETPLACE_ENABLED and TRADING_ENABLED control each feature. Restart locally or redeploy; the running server saves explicit values to your app automatically. Unspecified settings stay unchanged. Use the same settings in deployments that share a Commerce key. Builds do not change app configuration. npm run community:configure remains available to preview settings, with -- --apply to save manually.
Keep configuration on your backend. Never let a customer change these settings through a public proxy.
Check availability
GET / returns capabilities.community.marketplace and capabilities.community.trading. Each contains ready and include_dyli. Bootstrap also exposes them under storefront.community. GET /community/settings reads the current capability state directly.
If ready is false after enabling the feature, request activation from DYLI. Include your app name and the feature you want. Your key cannot enable a platform capability that hasn't been activated. Turning a feature off blocks new preparations and discovery, but existing action receipts and trade history remain available for recovery.
Discover listings, offers and collectors
All paths below are relative to https://www.dyli.io/api/commerce/v1. Every request uses your server-side Commerce key.
| Request | Returns |
|---|---|
GET /community/market?kind=listing | Active listings with current on-chain price and quantity |
GET /community/market?kind=offer&token_id=123 | Offers for a collectible |
GET /community/market?kind=listing&external_customer_id=customer-123 | That customer's active listings within the app's scope |
GET /community/collectors?q=collector | Up to 20 matching usernames; type at least two characters |
GET /community/collectors/{username}/holdings?page=1 | Live, visible collectibles in that collector's wallet |
GET /community/trades?external_customer_id=customer-123 | Incoming and outgoing trade history for that customer |
Market results accept q, token_id, offset, brand, category, subcategory, seller (username), min_price, max_price and sort=newest|price_low|price_high. Price filters are decimal USDC amounts from 0 to 1,000,000. Filters and sorting apply before pagination. The response includes facets.brands, facets.categories and facets.subcategories from orders visible to your app, respecting the search and seller scope.
Trade history accepts offset and view=all|incoming|outgoing|history. Both feeds return up to 25 rows and pagination.next_offset (null at the end). Holdings use pagination.has_more. Market rows include order_id, token_id, kind, unit_amount, price, quantity, expiration, maker, product and collector. unit_amount is an integer string in USDC base units (six decimals); price is a decimal amount for display. Feed prices are indicative until preparation and confirmation.
Use the Collection token ID, not the product ID. Collector responses contain public profile fields, never their login subject or email. A collector outside your allowed community returns not found.
With DYLI collectors off, the inbox shows trades with your app's customers and trades created through your app. It does not pull in the customer's unrelated DYLI trades. Trades already created through your app stay in its history if you later turn broader discovery off.
Prepare, sign, confirm
The same flow handles every marketplace or on-chain trade action:
- Authenticate the customer on your backend. Supply their synchronized
external_customer_idyourself. - Call
POST /community/actionswith a savedIdempotency-Keyand the action terms below. - Show the returned
action.inputand preview. Ifapprovalsis nonempty, send those instructions in order and wait for success. They grant item-transfer or USDC permissions, not a purchase by themselves. - Have the customer sign
action.transactionexactly as returned. Persist the action ID and transaction hash immediately. - Call
POST /community/actions/{id}/confirmwith{ "tx_hash": "0x..." }. Show success whenaction.statusiscompleted.
The API checks the customer wallet, ownership, app settings, live contract order, price, quantity and normal DYLI sale restrictions. Confirmation verifies the exact sender, contract, calldata and receipt before recording native DYLI activity.
On Base, confirmation also accepts partner-relayed Calibur wallet transactions. Send the prepared call from the synchronized customer wallet inside an atomic Calibur execute batch (revertOnFailure: true), then confirm with the outer transaction hash. The batch may contain one prepared action plus the configured Collection/USDC approvals for that action's contract; do not combine multiple marketplace or trade actions in one transaction. DYLI verifies the wallet delegation, canonical receipt, actual execution trace, exact inner call and matching settlement events. No relayer address replaces the customer wallet in your API requests. The same relay verification covers offer acceptances, item gifts and shipping-redemption confirmation; pack buys and openings retain their existing wallet verification.
Preparation lasts 10 minutes. It does not reserve stock or lock funds. A public listing can sell or an offer can expire before your customer confirms. Never replace the wallet, contract, data, value or network in a returned instruction. Use the existing gas-sponsorship configuration when supported by the wallet.
Marketplace action terms
Every body includes external_customer_id and kind.
kind | Other fields |
|---|---|
list | token_id, quantity, unit_amount, expiration |
offer | token_id, quantity: 1, unit_amount, expiration |
buy | token_id, order_id, quantity, expected_amount |
accept_offer | token_id, order_id, quantity: 1, expected_amount |
cancel_listing / cancel_offer | token_id, order_id |
unit_amount is the per-item price in integer USDC base units. expected_amount is the selected order's unit amount multiplied by quantity. Use strings for both. Listings allow 1–20 copies; offers and offer acceptance cover one copy. Expiration is a Unix timestamp between five minutes and 30 days in the future. A maker can cancel their own order, not someone else's.
{
"external_customer_id": "customer-123",
"kind": "list",
"token_id": "456",
"quantity": 2,
"unit_amount": "25000000",
"expiration": 1900000000
}
This lists two copies at $25 each. Replace the sample expiration with a timestamp in the allowed window.
Trade action terms
Send kind: "trade", the other collector's collector username, give and receive item arrays, and give_usdc / receive_usdc in base-unit strings. Each item is { "token_id": "456", "quantity": 1 }. Each side must contribute an item or cash. Only one side can include cash; use the difference. There can be up to 20 different items per side and 20 copies of each item.
{
"external_customer_id": "customer-123",
"kind": "trade",
"collector": "collector1234",
"give": [{ "token_id": "456", "quantity": 1 }],
"receive": [{ "token_id": "789", "quantity": 1 }],
"give_usdc": "5000000",
"receive_usdc": "0"
}
The customer offers one item plus $5 for the other item. Nothing exchanges at creation. Keep the offered assets in the wallet until the other collector accepts or the sender cancels.
To accept or cancel, prepare kind: "accept_trade" or kind: "cancel_trade" with trade_id from trade history, then follow the same sign-and-confirm flow. Only the receiver can accept; only the sender can cancel. Trade IDs are not marketplace order IDs. Current trades include a verified creation receipt so the items shown can be checked against the on-chain terms. Older trades without a receipt must be recreated before accepting through Commerce.
The receiver can decline with POST /community/trades/{id}/decline and their external_customer_id. Declining updates the native inbox without transferring assets or charging a fee. It does not cancel the sender's on-chain order. Diamonds remain available on DYLI, not in Commerce trade preparation.
Gift items between customers
Send vaulted items to another customer in your app. These items are on Base, so a gift transfers them between the customers' existing wallets. This differs from sealed pack transfers, which move an unopened paid checkout using a signed message without an on-chain transfer.
Check capabilities.community.gifting.ready on the API root, or gifting.ready from GET /community/settings. Both customers must have registered, verified wallets on the same Base network in the same Commerce app. Gifting does not depend on enabling marketplace or trading, and does not include USDC transfers or exchanges for payment.
-
Authenticate the sender in your backend. Resolve their
external_customer_idfrom that session and choose the recipient's registered customer ID. -
Prepare with
POST /community/gifts, a stableIdempotency-Key, and:{"external_customer_id": "sender-customer","recipient_external_customer_id": "recipient-customer","items": [{ "token_id": "456", "quantity": 1 }],"message": "enjoy!"}Use Collection token IDs, not product IDs. A gift can contain 1–20 different items, with 1–20 copies of each. The optional message allows up to 500 characters.
-
Save
gift.idand show the returned recipient username, wallet, items and quantities for confirmation. Preparation checks ownership and item restrictions but does not transfer or reserve the items. The instruction lasts ten minutes. -
Have the sender sign and send
gift.transactionunchanged. It transfers only the selected items to the saved recipient, with zero native value and no USDC payment or operator approval. The recipient does not need to sign or accept. -
Persist the transaction hash, then call
POST /community/gifts/{id}/confirmwith{ "external_customer_id": "sender-customer", "tx_hash": "0x…" }. DYLI checks the exact call, gift reference and transfer event before returninggift.status: "completed"andgift.gift_idsfrom normal DYLI gift history. -
Refresh both customers' holdings. The gift retains their profiles and usernames, records
item.giftedin the app's events, and does not create a purchase or Commerce revenue.
For DYLI-managed wallets, check wallet.gas_sponsorship.item_gifts.available in bootstrap and use the sponsored gift sender. DYLI pays gas for that exact gift. Apps using their own wallet infrastructure send the same transaction with their existing Base gas funding or sponsorship.
Recover with GET /community/gifts/{id}?external_customer_id=…. List gifts using GET /community/gifts?external_customer_id=…&view=all (sent and received are also supported), with offset pagination of 25 gifts. Your backend must verify the requesting customer before forwarding reads.
Retry preparation with the same key and body. If submission is uncertain, recover the saved wallet operation and confirm its original transaction hash. Each gift uses one saved sponsored operation; another intent request recovers it. gift_transaction_pending means retry confirmation. gift_reconciliation_required means the transfer succeeded and recording needs another confirmation attempt. Neither means send the items again. Only after a verified reverted operation should you offer to prepare a new gift with a new key.
Fees and payments
Marketplace and trade cash settle in Base USDC from the customer wallet. These actions do not use Stripe Checkout or a partner treasury payer. Customers can fund the wallet through their own supported transfer or conversion flow first.
DYLI's normal marketplace and cash-trade fees apply. The contract determines the seller's net proceeds. By default, your app earns 10% of DYLI's collected fee on completed secondary sales (including accepted offers) and cash trades confirmed through your Commerce integration. This share comes from DYLI's fee, with no extra charge to the customer. Item-only trades and gifts earn no fee share. Pack profit share and optional pack fees are separate. There is no payout-recipient override.
GET /community/settings returns revenue_share.secondary_fee_share_bps and revenue_share.cash_trade_fee_share_bps (both default to 1000, meaning 10% of the fee). Prepared settlement actions include their saved revenue_share.share_bps. After confirmation, action.revenue_share also includes gross_units, fee_units and earned_units as integer strings in USDC base units. Earlier actions can return null when they are not eligible. Confirm the successful action to record attribution; merely displaying the feed does not generate earnings. Revenue share, examples and custom rates.
Recovery
Use GET /community/actions/{id} or GET /community/actions?external_customer_id=customer-123 (the latest 50 actions). Prepared actions return instructions until they expire. Completed actions return their result and transaction reference, not another transaction to send.
Always reuse the saved idempotency key and body when retrying preparation. Reusing a key with different terms returns idempotency_conflict. If a transaction was sent, confirm that hash even after the preparation timer expires. Do not prepare and pay again.
requires_action or community_reconciliation_required means the chain transaction succeeded but recording needs a retry. Keep the same hash and call confirmation again. transaction_not_confirmed means wait and retry; it is not permission to send another transaction. An uncertain wallet submission without a hash needs wallet-history recovery before another send. Poll action and trade history for updates; community-specific webhooks are not emitted in this release.
Confirmation performs short, bounded retries for temporary RPC/indexing failures. If a response has details.retryable: true, honor Retry-After and retry confirmation with the same action ID and original hash, using bounded backoff. Keep the UI in a confirming/syncing state while retrying. transaction_verification_unavailable means the proof service is temporarily unavailable, not that the transaction failed. A genuine transaction_mismatch, failed receipt or changed terms is not a retryable proof and must not trigger another transaction automatically. Never wrap a payment/send operation in your confirmation retry loop.