Skip to content
Concepts

Stores as merchant of record

Apple and Google sell, charge, tax and refund in-app digital goods. AppCore verifies purchases on the server and grants access. It never holds funds. Status of web checkout.

On this page

When a user buys a subscription or a digital item inside your iOS or Android app, Apple or Google is the merchant of record. The store charges the customer, handles sales tax or VAT under its own terms, issues the receipt, processes refunds and pays out to you. AppCore does none of that. It verifies each purchase with the store on the server, keeps a normalized record, and grants the matching entitlements.

The store (Apple / Google)AppCoreYou (the publisher)
Takes the payment, holds the funds, pays out✔✘ neverreceive payouts from the store
Customer receipt / invoice✔ issues itstores a store_receipt_reference only; issues no invoice for store sales—
Refunds✔ decides and executesrecords the result and reverses accesscan request refunds where the store allows it
Verifying the purchase is real and current—✔ server-side, against the store API—
Granting and revoking access—✔define products and plans
Commissions, developer membershipscharged by the storenot includedyour cost

Purchase flow

Diagram (Mermaid source)
sequenceDiagram
  participant App as Your app
  participant Store as App Store / Google Play
  participant RT as AppCore runtime
  participant Ent as Entitlements
  App->>RT: POST /v1/commerce/purchase-intents (product)
  RT-->>App: intent (binds purchase to this user)
  App->>Store: Native purchase sheet
  Store-->>App: Signed transaction / purchase token
  App->>RT: POST /v1/commerce/purchases/verify
  RT->>Store: Fetch current state (App Store Server API / Play Developer API)
  RT->>RT: Record verified purchase + event (one atomic batch)
  RT->>Ent: Apply grant / credit lot (idempotent)
  RT->>Store: Google only: acknowledge / consume after durable fulfilment
  RT-->>App: Purchase result
  Store-)RT: Server notifications (renewal, refund, expiry)
  RT->>Store: Re-fetch current state, then update grants

What the server checks:

  • Apple: the JWS signature chain must end at Apple Root CA G3 (or G2), with Apple's leaf and intermediate certificate OIDs. AppCore then fetches the current state from the App Store Server API and checks that the bundle ID and store environment match this runtime. App Store Server Notifications V2 arrive at /webhooks/apple-store/{connection_ref}.
  • Google Play: the purchase token is checked against the Play Developer API (subscriptions v2, one-time products). A subscription or product is acknowledged, and a consumable consumed, after the grant is durably committed. Pending purchases grant nothing. Real-time developer notifications arrive through a Pub/Sub push subscription at /webhooks/google-play/{connection_ref}. Each push is authenticated with Google's OIDC token (issuer, audience, service-account email).
  • Every webhook is stored durably before AppCore answers 2xx. Duplicates are recognized by provider event ID. A different payload under the same ID is quarantined. Current state is always re-fetched from the store instead of trusting the notification body.
  • Restore (POST /v1/commerce/restore) is idempotent for the owning account across devices. A purchase that belongs to another account is not moved. It becomes a support case (PURCHASE_OWNERSHIP_CONFLICT) and nothing leaks.
  • Reconciliation runs on a schedule: Apple transaction history for a bounded batch of purchases, and Play voided purchases from the last 30 days. Operators can also start it manually. A renewal or refund that was never notified is still picked up.

Refunds happen in the store

  • Apple: the customer requests a refund from Apple. When Apple sends a REFUND notification, AppCore marks the purchase refunded, reverses access and writes a negative journal entry. An operator "refund" request for an Apple purchase becomes awaiting_manual, because AppCore cannot refund on Apple's behalf.
  • Google Play: an operator with refund permission can submit a refund through the Play API. It needs an Idempotency-Key and the purchase's expected_version. The purchase changes state only after Google confirms, and voided purchases are confirmed through the voided-purchases API. A customer refund from Google arrives the same way.
  • A replayed older notification never brings a refunded purchase back. For what happens to credits, see Entitlements and credits → Refunds.

Prices, currency and amounts

  • Show prices from the store SDK on the device. They are localized and set by the store.
  • Where the store reports an amount, AppCore keeps it as integer minor units with a currency. If an amount is not known (for example some Google consumables), it is recorded as amount_status: "unknown". It is never estimated.
  • Upgrades and downgrades follow the store's lineage. AppCore does not compute proration.

Web checkout and PSPs

Warning

Not yet enabled: web checkout. Stripe returns 503 FEATURE_UNAVAILABLE everywhere. Razorpay signature verification and payment fetching are implemented but off by default. Even when that provider is switched on, purchase intents currently return checkout: { kind: "unavailable", reason_code: "web_checkout_policy_disabled" }. Activating an external-checkout policy requires a recorded legal evidence reference and a dedicated finance permission, separate from the platform owner.

If web checkout is enabled later, you (the publisher) become the merchant of record for those sales, not AppCore. Merchant-numbered invoices and credit notes are produced only when an approved legal issuer is configured. Without one, no invoice number is issued. Whether you may link out of a store-distributed app to web checkout is decided by Apple's and Google's rules for your region. Check them before you enable it.

Warning

Not yet enabled: PDF download of finance documents (returns 503), settlement/fee/payout/FX statement import, revenue reports by store, cross-store duplicate subscription warnings, tax extensions (R2), and OCSP revocation checks on Apple certificates.

Important

The store verification paths are runtime-tested with test fixtures. They have not yet been exercised against real App Store or Play sandbox credentials. Treat sandbox testing in your staging environment as a required launch step.

What this means for your app

  • Use the native store purchase APIs (the SDK wraps them). Always call verify and wait for the server result before unlocking anything.
  • Do not build your own "refund" button for store purchases. Link users to Apple's or Google's purchase history and refund flows.
  • Configure App Store Server Notifications V2 and Play real-time developer notifications for each environment. See App Store Connect and Google Play.
  • Store fees, taxes and payouts never pass through AppCore. Reconcile revenue with the store's own reports.
  • The "receipt" for a store purchase is the store's. AppCore's document endpoint says so and gives no invoice number.