Docs

Revenue

Log purchases from your web app with the Grovs SDK

Revenue tracking attributes purchases to links and campaigns and shows ARPU, LTV, and per-product breakdowns in the Grovs dashboard.

Purchase events require a Grovs Enterprise backend (GROVS_EE=true), on every platform. Grovs cloud runs the Enterprise edition; on a self-hosted Community edition the endpoint does not exist, and logCustomPurchase reports eventDispatchFailed naming the requirement rather than retrying.

Setup

  1. Open the Grovs dashboard
  2. Go to your project's Settings
  3. Under Revenue Tracking, click Enable

Logging purchases

There is no in-app purchase counterpart on the web — there is no StoreKit or Play Billing — so every web payment flow is a custom purchase:

await Grovs.logCustomPurchase({
  type: "buy",                  // "buy" | "cancel" | "refund" | "refund_reversed"
  priceInCents: 1999,
  currency: "USD",
  productID: "com.acme.coins.100",
  startDate: new Date(),        // optional, defaults to now
  transactionID: "order-8842",  // optional, but pass yours
});

Resolves true when the purchase was recorded.

FieldTypeDescription
typeTransactionType"buy", "cancel", "refund", or "refund_reversed"
priceInCentsnumberAmount in cents, e.g. 999 for $9.99
currencystringISO 4217 currency code
productIDstringYour product identifier
startDateDateTransaction date. Defaults to now. An invalid date reports through onError
transactionIDstringYour order or payment id. See below

Transaction ids

The backend deduplicates purchases on the transaction id, so passing your own order or payment id makes the call safe to repeat: a retry after a timeout, or a double-submitted checkout, is counted once. Omit it and the SDK mints one per call, which covers its own network retries but cannot recognize the same purchase sent from a later page load.

Next steps

Edit this page on GitHubLast updated 2026-09-15