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
- Open the Grovs dashboard
- Go to your project's Settings
- 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.
| Field | Type | Description |
|---|---|---|
type | TransactionType | "buy", "cancel", "refund", or "refund_reversed" |
priceInCents | number | Amount in cents, e.g. 999 for $9.99 |
currency | string | ISO 4217 currency code |
productID | string | Your product identifier |
startDate | Date | Transaction date. Defaults to now. An invalid date reports through onError |
transactionID | string | Your 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.