@@ -20,6 +20,9 @@ A Tauri plugin for In-App Purchases (IAP) with support for subscriptions on both
2020- Real-time purchase state updates via events
2121- Automatic transaction verification (iOS)
2222- Support for introductory offers and free trials
23+ - Fraud prevention with obfuscated account/profile IDs (Android)
24+ - App account token support for tracking (iOS)
25+ - Automatic offer token selection (Android)
2326
2427## Platform Support
2528
@@ -98,9 +101,24 @@ if (status.isOwned && status.purchaseState === PurchaseState.PURCHASED) {
98101}
99102
100103// Purchase a subscription or in-app product
101- // On Android: use the offer token from subscriptionOfferDetails
102- // On iOS: offer token is not used
103- const purchaseResult = await purchase (' subscription_id_1' , ' subs' , offerToken );
104+ // Simple purchase (will use first available offer on Android if not specified)
105+ const purchaseResult = await purchase (' subscription_id_1' , ' subs' );
106+
107+ // With specific offer token (Android)
108+ const purchaseResult = await purchase (' subscription_id_1' , ' subs' , {
109+ offerToken: product .subscriptionOfferDetails [0 ].offerToken
110+ });
111+
112+ // With fraud prevention (Android)
113+ const purchaseResult = await purchase (' subscription_id_1' , ' subs' , {
114+ obfuscatedAccountId: ' hashed_account_id' ,
115+ obfuscatedProfileId: ' hashed_profile_id'
116+ });
117+
118+ // With app account token (iOS - must be valid UUID)
119+ const purchaseResult = await purchase (' subscription_id_1' , ' subs' , {
120+ appAccountToken: ' 550e8400-e29b-41d4-a716-446655440000'
121+ });
104122
105123// Restore purchases (specify product type)
106124const restored = await restorePurchases (' subs' );
@@ -154,13 +172,17 @@ Fetches product details from the store.
154172 - ` formattedPrice ` : Localized price string
155173 - ` subscriptionOfferDetails ` : (subscriptions only) Array of offers
156174
157- ### ` purchase(productId: string, productType: 'subs' | 'inapp' = 'subs', offerToken ?: string ) `
158- Initiates a purchase flow.
175+ ### ` purchase(productId: string, productType: 'subs' | 'inapp' = 'subs', options ?: PurchaseOptions ) `
176+ Initiates a purchase flow with enhanced options for fraud prevention and account management .
159177
160178** Parameters:**
161179- ` productId ` : The product to purchase
162180- ` productType ` : Type of product ('subs' for subscriptions, 'inapp' for one-time purchases), defaults to 'subs'
163- - ` offerToken ` : (Android only) The offer token for subscriptions
181+ - ` options ` : Optional purchase parameters:
182+ - ` offerToken ` : (Android) Specific offer to purchase. If not provided, uses first available offer
183+ - ` obfuscatedAccountId ` : (Android) Hashed account ID for fraud prevention
184+ - ` obfuscatedProfileId ` : (Android) Hashed profile ID for fraud prevention
185+ - ` appAccountToken ` : (iOS) UUID string for account tracking and fraud prevention
164186
165187** Returns:** Purchase object with transaction details
166188
0 commit comments