Skip to content

Mart purchase and offline licence ​

Who: listener (buyer); creator (seller, via the product wizard); system for settlement and sweeps.

Entry points ​

KindEntry
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 linkmart, martProduct, martOrder, library, receipt, studioProduct
Push/emailmart.purchase (email mart.purchase_receipt), mart.sale

Flow: sell ​

  1. POST /mart/products { sellerProfileId, type, title } → draft + wizard.
  2. Steps details, source (song/release), files, previews (optional), licences (personal, lease, premium, exclusive), pricing, splits (optional).
  3. POST /mart/products/:id/publish → mart.product.published → search index.

Flow: buy ​

  1. POST /mart/orders { productId, tier, currency, method } → { order, payment { checkoutUrl } }. An exclusive tier is held while paying.
  2. Payment settles → ledger split (fee per product type, splits to profiles) → library item granted → mart.order.paid → studio sale:made on /studio. Exclusive: other tiers retired, product delisted (mart.product.delisted).
  3. mart.order-sweep expires unpaid orders and releases held exclusives.

Flow: download and offline ​

  1. Non-audio files: POST /me/mart/library/:id/downloads { fileId } → signed URL with its own watermark fingerprint.
  2. Audio/video play offline only: the app keeps an X25519 key pair and registers POST /me/mart/device-keys.
  3. POST /me/mart/library/:id/offline-licences { deviceKeyId } → content key wrapped to the device key + packageUrl (encrypted package from media.package).
  4. Check in within 30 days: POST /me/mart/offline-licences/:id/check-in → freshly wrapped licence. Max 3 devices per purchase.
  5. A new device key, deleting a key, a refund or a chargeback revokes licences; GET /me/mart/offline-licences lists revoked ones so the app deletes files.

Exit states ​

StateCodeActionsClient next
Owned, in library——Open library
Payment pending——Open checkoutUrl, poll GET /payments/:id
Low balanceWALLET_INSUFFICIENT_FUNDStop_upTop up, retry with the same key
Already ownedMART_ALREADY_OWNED—Open library item
Own productMART_OWN_PRODUCT——
Tier sold or missingMART_LICENCE_SOLD_OUT, MART_LICENCE_TIER_NOT_FOUND, MART_PRICE_NOT_AVAILABLE—Refresh product
Not entitledMART_NOT_ENTITLED—Hide download
Device limitMART_DEVICE_LIMIT_REACHED—Remove another device key
RevokedMART_OFFLINE_LICENCE_REVOKED—Delete local files
Package not builtMEDIA_PACKAGE_NOT_READYwaitRetry later
IdempotencyIDEMPOTENCY_KEY_REQUIRED, IDEMPOTENCY_KEY_REUSED, IDEMPOTENCY_IN_PROGRESSretry—

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.refunded has 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).

Plemuz API v2