Revenue
Track in-app purchases and custom payments with the Grovs iOS 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.
On self-hosted deployments, revenue tracking is part of the Enterprise edition (GROVS_EE=true). On a Community edition backend the purchase endpoint does not exist, and calls report failure.
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 App Store Server Notifications
Required. In-app purchase tracking will not work without this step. Grovs relies on App Store Server Notifications to receive and process transaction data from Apple.
- Select your app and go to App Information
- Scroll to App Store Server Notifications
- Set the Production Server URL to the URL shown in the Grovs dashboard under Developers → iOS Setup → Revenue
- Set the Sandbox Server URL to the sandbox URL shown in the same section
If you already handle App Store Server Notifications on your own server, you can forward the events to the Grovs URLs instead.
Logging purchases
The SDK provides two methods depending on whether you use Apple's In-App Purchase system or a custom payment flow.
App Store purchases (StoreKit 2)
For purchases made through Apple's In-App Purchase system, pass the StoreKit 2 transaction ID:
import StoreKit
// After a successful purchase
let result = try await Product.purchase(...)
if case .success(let verification) = result,
case .verified(let transaction) = verification {
Grovs.logInAppPurchase(transactionID: transaction.id) { success in
if success {
// Revenue event recorded
Task { await transaction.finish() }
}
}
}The SDK sends only the transaction ID. The Grovs backend looks the transaction up through the App Store Server API, using the key you configure in the dashboard, and fills in the product, price, currency, and dates. App Store Server Notifications then keep renewals, cancellations, and refunds up to date, which is why both parts of the setup above are required. A transaction ID that was already logged is skipped, so you can call this method without worrying about double-counting.
The SDK method itself runs on iOS 13. The StoreKit 2 code in the snippet, which is where
transaction.idcomes from, requires iOS 15.
Custom purchases
For purchases processed through your own server, Stripe, or any non-IAP payment system:
Grovs.logCustomPurchase(
type: .buy,
priceInCents: 999, // $9.99
currency: "USD",
productID: "premium_monthly"
) { success in
// Revenue event recorded
}Parameters:
| Parameter | Type | Description |
|---|---|---|
type | TransactionType | .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 | Date? | Transaction date. Defaults to now |
Tracking cancellations and refunds
Use the .cancel and .refund transaction types to keep revenue data accurate:
// Log a cancellation
Grovs.logCustomPurchase(
type: .cancel,
priceInCents: 999,
currency: "USD",
productID: "premium_monthly"
) { success in }
// Log a refund
Grovs.logCustomPurchase(
type: .refund,
priceInCents: 999,
currency: "USD",
productID: "premium_monthly"
) { success in }For App Store purchases, cancellations and refunds are detected automatically when you configure App Store Server 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.