Appearance
Mart purchase and offline licence
Who: listener (buyer); creator (seller, via the product wizard); system for settlement and sweeps.
Entry points
| Kind | Entry |
|---|---|
| REST (browse) | GET /mart/products?type&sellerProfileId, GET /mart/products/:id |
| REST (sell) | POST /mart/products, GET /mart/products/:id/wizard, PUT /mart/products/:id/wizard/:step, POST /mart/products/:id/publish, /delist, /archive, GET /me/mart/products, GET /me/mart/sales |
| REST (buy) | POST /mart/orders (Idempotency-Key), GET /me/mart/orders, GET /me/mart/orders/:id, GET /payments/:id |
| REST (library) | GET /me/mart/library, GET /me/mart/library/:id, POST /me/mart/library/:id/downloads |
| REST (offline) | POST/GET /me/mart/device-keys, DELETE /me/mart/device-keys/:id, POST /me/mart/library/:id/offline-licences, POST /me/mart/offline-licences/:id/check-in, GET /me/mart/offline-licences?deviceKeyId |
| Deep link | mart, martProduct, martOrder, library, receipt, studioProduct |
| Push/email | mart.purchase (email mart.purchase_receipt), mart.sale |
Flow: sell
POST /mart/products { sellerProfileId, type, title }→ draft + wizard.- Steps
details,source(song/release),files,previews(optional),licences(personal, lease, premium, exclusive),pricing,splits(optional). POST /mart/products/:id/publish→mart.product.published→ search index.
Flow: buy
POST /mart/orders { productId, tier, currency, method }→{ order, payment { checkoutUrl } }. An exclusive tier is held while paying.- Payment settles → ledger split (fee per product type, splits to profiles) → library item granted →
mart.order.paid→ studiosale:madeon/studio. Exclusive: other tiers retired, product delisted (mart.product.delisted). mart.order-sweepexpires unpaid orders and releases held exclusives.
Flow: download and offline
- Non-audio files:
POST /me/mart/library/:id/downloads { fileId }→ signed URL with its own watermark fingerprint. - Audio/video play offline only: the app keeps an X25519 key pair and registers
POST /me/mart/device-keys. POST /me/mart/library/:id/offline-licences { deviceKeyId }→ content key wrapped to the device key +packageUrl(encrypted package frommedia.package).- Check in within 30 days:
POST /me/mart/offline-licences/:id/check-in→ freshly wrapped licence. Max 3 devices per purchase. - A new device key, deleting a key, a refund or a chargeback revokes licences;
GET /me/mart/offline-licenceslists revoked ones so the app deletes files.
Exit states
| State | Code | Actions | Client next |
|---|---|---|---|
| Owned, in library | — | — | Open library |
| Payment pending | — | — | Open checkoutUrl, poll GET /payments/:id |
| Low balance | WALLET_INSUFFICIENT_FUNDS | top_up | Top up, retry with the same key |
| Already owned | MART_ALREADY_OWNED | — | Open library item |
| Own product | MART_OWN_PRODUCT | — | — |
| Tier sold or missing | MART_LICENCE_SOLD_OUT, MART_LICENCE_TIER_NOT_FOUND, MART_PRICE_NOT_AVAILABLE | — | Refresh product |
| Not entitled | MART_NOT_ENTITLED | — | Hide download |
| Device limit | MART_DEVICE_LIMIT_REACHED | — | Remove another device key |
| Revoked | MART_OFFLINE_LICENCE_REVOKED | — | Delete local files |
| Package not built | MEDIA_PACKAGE_NOT_READY | wait | Retry later |
| Idempotency | IDEMPOTENCY_KEY_REQUIRED, IDEMPOTENCY_KEY_REUSED, IDEMPOTENCY_IN_PROGRESS | retry | — |
Notifications
Buyer mart.purchase and payment.receipt; every recipient profile owner mart.sale.
Known gaps
- Downloads get a recorded fingerprint, but media signs the master as is: no per-buyer watermark in the file (M10).
mart.order.refundedhas no consumer; the buyer and seller learn only from the refund receipt (M9).- Orders and library are not in the data export (I7); device keys survive account erasure (B3).