Revenue
Track in-app purchases and custom payments with the Grovs React Native 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.
Setup
1. Enable revenue tracking in the dashboard
- Open the Grovs dashboard
- Go to your project's Settings
- Under Revenue Tracking, click Enable
2. Configure platform notifications
- Android: set up Google Play Real-Time Developer Notifications. See the Android Revenue guide for details.
- iOS: configure App Store Server Notifications in App Store Connect. See the iOS Revenue guide for the URLs to set.
Logging purchases
Platform store purchases
logInAppPurchase takes an object with one platform-specific field. Each platform ignores the other's field:
- iOS:
transactionId, the StoreKit 2 transaction ID as a decimal string. - Android:
originalJson, the Google Play Billing purchase'soriginalJsonstring.
import { Platform } from 'react-native';
import Grovs from 'react-native-grovs-wrapper';
try {
const success = await Grovs.logInAppPurchase(
Platform.OS === 'ios'
? { transactionId: transaction.id } // StoreKit 2 transaction ID
: { originalJson: purchase.originalJson } // Play Billing purchase JSON
);
console.log('Purchase tracked:', success);
} catch (error) {
console.error('Error tracking purchase:', error);
}The wrapper validates the input before calling native and rejects with an error if the field for the current platform is missing, or if transactionId is not a numeric string on iOS. What the resolved boolean means differs per platform:
- On iOS,
falsemeans the native SDK did not accept the purchase: the ID could not be parsed as a 64-bit integer, or the device runs iOS 14 or earlier (StoreKit 2 needs iOS 15). Only the ID is sent; product, price, and currency are resolved on the backend, and an ID already logged on the device is skipped. - On Android, the call resolves
trueas soon as the JSON has been handed to the native SDK. It does not confirm that the backend accepted the purchase. The SDK reads the product ID and purchase token from the JSON, the backend verifies it and fills in price and currency, and de-duplicates on the purchase token.
Log each purchase once, right after it completes.
In wrapper 1.x this method took a plain string. See the 3.0 upgrade guide.
Custom purchases
For purchases processed through Stripe, PayPal, or any non-store payment system:
try {
const success = await Grovs.logCustomPurchase(
'buy', // type: 'buy' | 'cancel' | 'refund'
999, // priceInCents: $9.99
'USD', // currency code
'premium_monthly', // product identifier
);
console.log('Custom purchase tracked:', success);
} catch (error) {
console.error('Error:', error);
}Parameters:
| Parameter | Type | Description |
|---|---|---|
type | TransactionType | 'buy', 'cancel', or 'refund' |
priceInCents | number | Amount in cents (e.g. 999 for $9.99). Converted to an integer natively |
currency | string | ISO 4217 currency code (e.g. 'USD', 'EUR') |
productId | string | Your product identifier |
startDate | string? | Optional ISO 8601 date string, e.g. 2026-09-14T10:21:33Z. Defaults to now on both platforms. iOS parses it with ISO8601DateFormatter, which does not accept fractional seconds; Android falls back to now if it cannot parse the value |
The promise resolves true once the purchase has been handed to the native SDK, which stores it and sends it when authenticated.
Tracking cancellations and refunds
// Log a cancellation
await Grovs.logCustomPurchase('cancel', 999, 'USD', 'premium_monthly');
// Log a refund
await Grovs.logCustomPurchase('refund', 999, 'USD', 'premium_monthly');For App Store and Google Play purchases, cancellations and refunds are detected automatically when you configure platform server notifications.