palbaseDocs

API reference

Palbase IAP

Palbase's IAP module: what a project sells and what each of its customers has, in one shared, multi-tenant service; every project is isolated by row security in its database, and every key it keeps is sealed with the project's own data key.

One catalog, three channels. Each product is defined once — its kind, its plans and prices, its names in each language, what it gives (entitlements, credits, a quota) — and sold on the App Store, Google Play and the web through the project's own Stripe account, each channel configured with what is its own there: Apple's shorter names, a web price without the stores' commission. The stores are brought to the catalog by a plan a person sees and confirms; nothing is written store by store. Every purchase, from every channel, lands in one ledger, and a customer's apps read one answer, CustomerInfo — entitlements, subscriptions, IAP, credit balances and quota use — whatever store they bought in. Credits are spent in one step, or held for a job and committed after it; a quota counts use in a window and can overflow into credits. A guest's IAP go to the account it signs in to.

Three doors. A customer's own app reads the offerings with any of the project's keys, and what the customer has, buys on the web, reports what StoreKit gave it in the App Store and merges a guest with the publishable key and the user's access token (a guest's too). The project's backend, Studio and the CLI reach everything else with the secret key (apikey, role service_role): the catalog, the Stripe account and the App Store connection, every customer, credits and quotas. Stripe's and the App Store's notifications (signed by the provider) and the pages a Stripe key or an In-App Purchase key is handed over on (a one-time grant) take no key. Changes emit iap.* events to the project's webhooks (x-palbase-events); the customer's apps hear of their own changes on the realtime channel iap:<project ref>:<user id> (theirs alone, read-only), whose state and changed broadcast carry {"revision": N}: a revision above the one read means reading GET /iap/me again.

The contract itself: /openapi/iap.openapi.json

AppleAccount

AppStore

Connect

Catalog

Charts

Web

Coupons

Customers

Credits

Experiments

GoogleAccount

GooglePlay

Guests

Offerings

Offers

Paywalls

Placements

Settings

Notifications