Revenue
Track in-app purchases and custom payments with the Grovs Android SDK
Revenue tracking lets you attribute purchases to links and campaigns, monitor metrics like ARPU and LTV, and view breakdowns by product and platform — all from the Grovs dashboard.
Revenue tracking is currently in beta. There may be minor discrepancies in currency conversion rates while processing is being fine-tuned.
Setup
1. Enable revenue tracking in the dashboard
- Open the Grovs dashboard
- Go to your project's Settings
- Under Revenue Tracking, click Enable
Revenue data will only be collected while this setting is active.
2. Configure Google Play Real-Time Notifications
Required. In-app purchase tracking will not work without this step. Grovs relies on Google Play Real-Time Developer Notifications to receive and process transaction data.
Automatic setup (recommended)
The Grovs dashboard provides a script that automates the Google Cloud Platform configuration:
- In the Grovs dashboard, go to Developers → Android Setup → Revenue
- Click Download Script
- Open Google Cloud Shell and run the script — it creates the required GCP resources and generates a service account key file
Manual setup
If you prefer to set things up manually:
- In the Google Cloud Console, create a Pub/Sub topic for your app
- Create a service account with access to the Android Publisher API
- Download the service account's JSON key file
Upload the key and set the endpoint
- In the Grovs dashboard under Developers → Android Setup → Revenue, upload the JSON key file
- Copy the Notifications endpoint URL shown in the dashboard
- In the Google Play Console, go to your app's Monetization setup and paste the endpoint URL under Real-time developer notifications
If you already receive Google Play notifications on your own server, you can forward the events to the Grovs endpoint URL instead.
Logging purchases
The SDK provides two methods depending on whether you use Google Play Billing or a custom payment flow.
Google Play purchases
For purchases made through Google Play Billing, pass the purchase object's originalJson:
// After a successful purchase via Google Play Billing Library
billingClient.launchBillingFlow(activity, billingFlowParams)
// In your PurchasesUpdatedListener
override fun onPurchasesUpdated(billingResult: BillingResult, purchases: List<Purchase>?) {
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK && purchases != null) {
for (purchase in purchases) {
Grovs.logInAppPurchase(purchase.originalJson)
}
}
}The SDK automatically extracts the product ID, purchase token, price, and currency from the purchase JSON. Duplicate transactions are filtered — you can safely call this method without worrying about double-counting.
Custom purchases
For purchases processed through your own server, Stripe, or any non-Play Store payment system:
Grovs.logCustomPurchase(
type = PaymentEventType.BUY,
priceInCents = 999, // $9.99
currency = "USD",
productId = "premium_monthly"
)Parameters:
| Parameter | Type | Description |
|---|---|---|
type | PaymentEventType | BUY, CANCEL, or REFUND |
priceInCents | Int | Amount in cents (e.g. 999 for $9.99) |
currency | String | ISO 4217 currency code (e.g. "USD", "EUR") |
productId | String | Your product identifier |
startDate | InstantCompat? | Transaction date. Defaults to now |
Tracking cancellations and refunds
Use the CANCEL and REFUND event types to keep revenue data accurate:
// Log a cancellation
Grovs.logCustomPurchase(
type = PaymentEventType.CANCEL,
priceInCents = 999,
currency = "USD",
productId = "premium_monthly"
)
// Log a refund
Grovs.logCustomPurchase(
type = PaymentEventType.REFUND,
priceInCents = 999,
currency = "USD",
productId = "premium_monthly"
)For Google Play purchases, cancellations and refunds are detected automatically when you configure Google Play Real-Time Notifications.
Dashboard metrics
Once revenue tracking is enabled and events are flowing in, the dashboard shows:
- Total Revenue — aggregate revenue with currency conversion
- ARPU — average revenue per user
- ARPPU — average revenue per paying user
- LTV — lifetime value per product
- Units Sold — total purchases
- First-time vs. Repeat Purchases — new vs. returning customers
- Cancellations — cancelled transactions
All metrics can be filtered by date range, platform, and product.