Architecture
Parts
| Class | |
|---|---|
expAppMarket | settings, the store, paid sales on or off, minimums, commission |
expAppMarketMoney, expAppMarketSplit, expAppMarketTax, expAppMarketPricing | pure rules: amounts, the split, tax, prices and promotions |
expAppMarketPaymentProvider and expAppMarketStripe, expAppMarketPaypal, expAppMarketTronPay | hosted payments, confirmation, webhooks, refunds, payouts |
expAppMarketCheckout | a purchase from start to license; renewals; the daily run |
expAppMarketSeller, expAppMarketPartner, expAppMarketScore | sellers, partner levels, the public score, strikes |
expAppMarketApp, expAppMarketPurchase, expAppMarketLicense, expAppMarketInvoice | the persistent rows |
expAppMarketRefund, expAppMarketPayout, expAppMarketReview | refunds, payouts, reviews |
expAppMarketIssuer (Local, Remote, Null) | registry license keys |
expAppMarketSignedURL | signed download links |
expAppMarketMail, expAppMarketQueueHandler, expAppMarketSupport | mail through expqueue, tickets |
expAppMarketSchema, expAppMarketObject | the tables on five engines |
expAppMarketCommand, expAppMarketView | console commands, the views' shared code |
Tables
expmkt_seller, expmkt_app, expmkt_purchase, expmkt_license, expmkt_refund, expmkt_payout,
expmkt_review, expmkt_invoice, expmkt_strike, expmkt_stat, expmkt_mail, expmkt_event. One definition
(expAppMarketSchema::definition()) generates share/db_schema.dba, sql/<engine>/schema.sql and
sql/mongodb/schema.json; install-schema creates and upgrades them with the kernel's schema handler of the
database. Money is in minor units (cents). The kernel shop's ezorder and ezproductcollection hold the checkout
(account identifier appmarket); a purchase points at its order, which is activated and marked delivered when paid.
A purchase
market/buy/<app>: tier, payment method, country, VAT id, coupon, acceptance of the terms.market/checkout(expAppMarketCheckout::start): the quote, the seller's tax for the buyer's country, a temporary kernel order, the purchase row, a claim token (its SHA-256 and the public key of a key pair derived from it are stored), the provider's hosted payment page.- The buyer pays there. The provider's webhook (
market/webhook/<provider>) or the return (market/return/<id>) completes the purchase (complete(), idempotent and guarded against a double run): the amount is checked; the split is computed with the provider's real fee; the order is activated; the license and its registry key are made; the key is sealed to the claim key pair (only the token opens it); the invoice in the seller's name is issued; the receipt with the key and the install commands is mailed (the mail's body is removed once sent). - The return page opens the sealed key with the token in the buyer's session and shows it once. A purchase from a
site's admin goes back to the site with the token instead; the site claims the key once at
market/api/claim. - Renewals come from the provider (
invoice.paid,PAYMENT.SALE.COMPLETED): a new payment row, its split and invoice; the license and its key move to the new period end. Crypto subscriptions renew by hand on a reminder. - The daily run: reminders, lapses, refunds past the seller's days, partner checks, security deadlines, crypto checks.
Security
- No card data on the store: hosted pages only. Webhooks are verified (Stripe HMAC with a 5-minute tolerance, PayPal's verification API). Live keys are refused in test mode; live providers while paid sales are off.
- No license key is stored readable: the registry keeps its SHA-256; the market keeps a sealed box that only the buyer's claim token opens; the receipt mail's body is removed after sending; the queue's payload has only an id.
- Download links are HMAC-signed with an expiry, the buyer and the version; the license is checked on every use. Downloads are logged with a hashed address; many addresses for one license in a day raise a flag.