logCustomPurchase method
Future<void>
logCustomPurchase({
- required TransactionType type,
- required int priceInCents,
- required String currency,
- required String productId,
- DateTime? startDate,
Log a custom purchase for revenue tracking
Tracks a non-store purchase (e.g. Stripe, PayPal) for revenue attribution.
type - The transaction type: buy, cancel, or refund
priceInCents - The price in cents (e.g. 999 for $9.99)
currency - ISO 4217 currency code (e.g. 'USD', 'EUR')
productId - A unique product identifier
startDate - Optional transaction date (defaults to now on the native side)
Throws GrovsException if the operation fails
Example:
await Grovs().logCustomPurchase(
type: TransactionType.buy,
priceInCents: 999,
currency: 'USD',
productId: 'premium_monthly',
);
Implementation
Future<void> logCustomPurchase({
required TransactionType type,
required int priceInCents,
required String currency,
required String productId,
DateTime? startDate,
}) {
return GrovsPlatform.instance.logCustomPurchase(
type: type,
priceInCents: priceInCents,
currency: currency,
productId: productId,
startDate: startDate,
);
}