tinyfiles.tv

Your cart

Demo only, no real order, no real charge.

Add items under $30 with free shipping Including ads

🍃 tinyfiles invests in climate solutions like electric trucks and carbon offsets for every delivery. See how
❤️ The Uplift Fund supports the nonprofit organizations and communities that help creative entrepreneurs thrive. You can donate your change at checkout. Learn more

Related items you may like Including ads

Change qty, Save for later, Remove, or Add to cart from below. Demo only.
Backend  ·  Template · Proposed · Not connected

Backend, Cart Backend, Template

Right now cart is a local demo list plus qty, coupon, gift, save for later, no order created, no payment taken. This backend is the map to make it real: cart, coupons, checkout, orders. Proposed, not connected.

01 / Files to create
api/marketplace/cart.php          GET /api/marketplace/cart
api/marketplace/cart_add.php     POST /api/marketplace/cart_add
api/marketplace/cart_update.php  POST /api/marketplace/cart_update
api/marketplace/cart_remove.php  POST /api/marketplace/cart_remove
api/marketplace/checkout.php     POST /api/marketplace/checkout
sql/marketplace_tables.sql

Keep the tinyfiles PHP pattern: /api/bootstrap.php, json_in() / json_out(), prepared PDO.

02 / Database tables
marketplace_carts
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  user_id BIGINT NOT NULL UNIQUE
  coupon_code VARCHAR(50) NULL
  is_gift TINYINT NOT NULL DEFAULT 0

marketplace_cart_items
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  cart_id BIGINT NOT NULL
  listing_id BIGINT NOT NULL
  shop_id BIGINT NOT NULL
  qty INT NOT NULL DEFAULT 1
  saved_for_later TINYINT NOT NULL DEFAULT 0

marketplace_orders
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  user_id BIGINT NOT NULL
  total_cents INT NOT NULL
  status VARCHAR(30) NOT NULL DEFAULT 'pending'
03 / API endpoints
GET /api/marketplace/cart
- returns items grouped by shop, totals, discounts, shipping

POST /api/marketplace/cart_add
{ "listing_id": 123, "qty": 1 }
- adds or increments, returns new cart count

POST /api/marketplace/cart_update
{ "item_id": 1, "qty": 2, "saved_for_later": false }
- updates qty or save for later

POST /api/marketplace/checkout
{ "is_gift": false, "gift_message": "...", "coupon_code": "TINY10" }
- creates order, clears cart, returns order id, never charges in demo

Totals must be calculated server-side, never trust client totals.

04 / Cooldown, moderation and validation
// Cooldown: 1 cart add per 2s, 1 update per 1s, 1 checkout per 10s
// Validation: qty 1 to 10, listing_id must exist and be public, coupon must be active
// Safety: escape output, prepared statements, never log card data, never store card data
// Privacy: cart is user only, gift message is buyer + seller only, never public

Keep disclaimer until this ships: Tinker toy, not live yet.

05 / Frontend wiring
// On Qty change: POST /api/marketplace/cart_update, recalc totals
// On Remove: POST /api/marketplace/cart_remove, remove row
// On Save for later: POST /api/marketplace/cart_update saved_for_later=1, move to saved list
// On Apply coupon: POST /api/marketplace/cart with coupon, show discount
// On Checkout: POST /api/marketplace/checkout, show order id, clear cart
// If API fails, fall back to local demo plus disclaimer.
Copy snippets into api/marketplace/ plus sql/marketplace_tables.sql, no GitHub needed. Cart stays safe by never charging a real fee in demo, never creating a real order, and never collecting card data.

Made by people,
for people.

Shop
Gift cards
Registry
Sitemap
Blog
tinyfiles United Kingdom
tinyfiles Germany
tinyfiles Canada
Sell
Seller handbook
Teams
Forums
Affiliates & Creators
About
tinyfiles, Inc.
Policies
Investors
Careers
Press
Impact
Help
Help Center
Privacy settings

United States | Terms of Use | Privacy | Interest-based ads | Local Shops | Regions | Help Center | © 2026 tinyfiles, Inc.