Commerce
How you sell products and subscriptions, and how paid content stays locked to the people who bought it.
How you sell products and subscriptions, and how paid content stays locked to the people who bought it.
The short version
You connect a payout account (Stripe), create products, and mark content as premium or product-gated. When a user buys, their purchase becomes an entitlement on their sign-in token, and the server only sends them the unlocked content. Payments run through Stripe and PayPal (and Apple/Google in-app purchases on native).
Already selling in Shopify, WooCommerce or Tiendanube? Connect that store instead: its orders start the same workflows. See Online stores.
How content gating works
Every content row has an availability field, and gating happens on the server at
sync-read time, so locked content never reaches an unauthorized device:
free(the default), sent to everyone.premium, sent only if the user's token hashas_pro(an active subscription or entitlement). Otherwise the row is stripped: it comes down as a preview (a small allowlist of fields like title and cover image) plus a_stripped: truemarker, so the app can show a paywall.product, sent in full only if the row'sproduct_idis in the user'spurchased_products. Otherwise stripped the same way.draft, never sent to members or signed-out visitors, not even as a preview. Any other value is treated the same way.
The app shows a paywall when it sees _stripped: true, never by reading
availability directly.
After a purchase nothing re-syncs by itself. The buyer comes back from
checkout to the app's return_url with purchase=success added. The app then
refreshes the member's token (its purchased_products now has the product),
forgets the tables' sync position, reconnects and pulls (nullOutSeqnums,
disconnect, connect, then syncUnified() once the client is ready). The
rows that came down stripped then come down in full. The apps Oalo builds do
this in their checkout-return handler. For a frontend you build yourself, see
Connect your own frontend.
Courses use the same mechanism: linking a course to a product sets its lessons to
product gating with that product id, so lesson content is locked server-side.
Payments
- Checkout. A hosted, themed checkout page handles Stripe and PayPal, including
subscriptions, trials, and promo codes. In the app, a
BuyButtonlinks to it. The link is/checkout?productId=<id>&return_url=<where to go after paying>, optionally withprefilledEmail, and the member's access token in the fragment (#token=<token>). After paying, Continue opensreturn_urlwithpurchase=successadded. With the token the order is the member's; without it, it is matched to a member by the email typed at checkout. - In-widget payment. For a custom flow, the server can prepare a Stripe payment (a PaymentIntent or a subscription setup) and the app collects the card with Stripe Elements, then confirms the order. A Stripe webhook records the order as a safety net so nothing is lost.
- Stripe (your own account). Commerce charges run on your own Stripe account. You connect it by pasting your Stripe secret API key into Payment Settings (a test key, a live key, or both). Payments go straight to your account and Oalo takes no per-transaction cut.
- Apple / Google. Native apps support in-app purchases. Apple pricing and Google base-plan activation are manual steps in those stores' consoles. Each purchase is checked with the store before it grants anything, and kept current (see "App Store and Google Play purchases" below).
App Store and Google Play purchases
The app sends the store's transaction (Apple) or purchase token (Google) to the Base, which asks the store about that exact purchase: it must be for the product claimed and for one of the product's apps (its bundle id or Android package). Apple's answers are checked against Apple's signing root. Each purchase becomes one order, and a renewal or a restore finds the same order.
- Set up, in Commerce > Settings. App Store: an In-App Purchase key (App Store
Connect, Users and Access, Integrations, In-App Purchase): add the
.p8and its Key ID; the team's Issuer ID comes from Integrations, Apple. Google Play: the service account in Integrations, Google is enough. - Notifications keep orders current as things happen. Paste the App Store address shown there into each app's App Store Server Notifications (Version 2, Production and Sandbox) in App Store Connect. For Google Play, set a Cloud Pub/Sub topic for real-time developer notifications in Play Console and add a push subscription with the Google address shown (it carries a private token).
- A nightly check is the backstop for anything a notification missed.
- Access. An auto-renewing subscription keeps access for a day and a half past its period end, so a renewal the store hasn't reported yet doesn't cut anyone off. One that won't renew (cancelled but paid up) keeps access until the period ends. A failed renewal stops access unless the store grants a grace period. A refund or revocation ends access.
How an order gets recorded
- In-app widget and the hosted Oalo checkout page both record the order the
moment payment is confirmed (a server-verified
confirm-orderstep). No webhook is required for these paths. - A Stripe webhook is the idempotent backstop for edge cases (e.g. the buyer
closes the tab right after paying) and for the Stripe-hosted Checkout Session path,
whose completion only arrives as a webhook. Because commerce runs on your own
Stripe account, you register this webhook in your own Stripe dashboard,
pointing at your app's
/api/checkout/stripe-webhook, and save the signing secret in Payment Settings. The order upsert is idempotent, so it never double-records.
The commerce tools
The assistant handles commerce through a set of tools, so you can just ask it to create a product, link a product to an app, look up a buyer's orders, check a subscriber's status, change pricing, and cancel a subscription. Money-sensitive actions ask for confirmation (live mode, prices over $500, cancellations) and are rate-limited. The assistant does not issue refunds. Do those in the Stripe or PayPal dashboard.
From the CLI, and product ids in code
oalo products lists what the workspace sells. The rest:
oalo products create premium --name "Premium" --price 9.99 --monthly(--oncefor a one-time purchase,--yearly,--trial 7). It uses the test Stripe key unless you pass--live, which needs--yes, as does a price over 500.oalo products price premium 12.99makes a new Stripe price and archives the old one. New buyers pay the new price; existing subscriptions keep theirs.oalo products archive premium --yesstops it being sold. Its orders stay and its buyers keep their access.oalo products delete premium --yesremoves an archived product nobody bought, and frees its id.oalo products orders [premium]lists the latest orders.
The id (premium) is what code names: BuyButton productId, a row's
product_id with availability: product, and the member's
purchased_products. oalo typegen writes the workspace's ids as PRODUCTS
and a ProductId type (oalo typegen --dart: a Products class), so a
mistyped id fails to compile instead of showing "Product not found" at
checkout. oalo typegen --check fails when a product is added or archived.
Billing (how you pay Oalo)
Separate from what you sell to your users, Oalo bills you for usage. AI usage (bot replies, AI steps, generated images and video) comes out of a prepaid credit balance, kept filled by auto top-up. WhatsApp is billed by Meta directly. See Usage and billing.
Note: there is also a per-bot daily cost cap and a per-user daily message cap. Those are abuse guards, not billing.
Step-by-step
- Connect a payout account. In Commerce > Payment Settings (the same page
is the Keys tab under Integrations), paste your Stripe secret API key (a
test key
sk_test_...to try it, a live keysk_live_...for real charges). Payments run on your own Stripe account. PayPal credentials go on the same page. Optionally, add a Stripe webhook in your own Stripe dashboard (pointing at your app's checkout webhook) and save its signing secret here as a backstop for hosted-checkout completions. - Create a product. Tell the assistant what to sell (an id like
premium, a display name, a price, one-time or subscription). It defaults to Stripe test mode; live mode or a price over $500 asks you to confirm. Apple pricing and Google activation are manual console steps. - (Multiple apps) scope the product to the apps that should show it.
- Gate content. Mark rows or lessons
premium(needs a subscription) orproductwith a product id (needs that purchase). Link a course to a product to gate all its lessons at once. Optionally set which fields show in the preview. - Wire the storefront. The assistant adds a buy button, wraps gated UI in a paywall, and adds a checkout-return handler that refreshes the token and unlocks content after purchase.
- Manage after the sale. Ask the assistant to look up buyers, check subscriber status, change a price, or cancel a subscription. Refunds happen in the Stripe/PayPal dashboard.
Your own Base, with every feature, from $99 a month.