@choochmeque/tauri-plugin-iap-api 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +49 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  # Tauri Plugin IAP
9
9
 
10
- A Tauri plugin for In-App Purchases (IAP) with support for subscriptions on both iOS (StoreKit 2) and Android (Google Play Billing).
10
+ A Tauri plugin for In-App Purchases (IAP) with support for subscriptions on iOS (StoreKit 2), Android (Google Play Billing) and Windows (Microsoft Store).
11
11
 
12
12
  ## Features
13
13
 
@@ -20,11 +20,15 @@ A Tauri plugin for In-App Purchases (IAP) with support for subscriptions on both
20
20
  - Real-time purchase state updates via events
21
21
  - Automatic transaction verification (iOS)
22
22
  - 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)
23
26
 
24
27
  ## Platform Support
25
28
 
26
29
  - **iOS**: StoreKit 2 (requires iOS 15.0+)
27
30
  - **Android**: Google Play Billing Library v8.0.0
31
+ - **Windows**: Microsoft Store API (Windows 10/11)
28
32
 
29
33
  ## Installation
30
34
 
@@ -42,7 +46,7 @@ Add the plugin to your Tauri project's `Cargo.toml`:
42
46
 
43
47
  ```toml
44
48
  [dependencies]
45
- tauri-plugin-iap = "0.1"
49
+ tauri-plugin-iap = "0.4"
46
50
  ```
47
51
 
48
52
  Configure the plugin permissions in your `capabilities/default.json`:
@@ -98,9 +102,24 @@ if (status.isOwned && status.purchaseState === PurchaseState.PURCHASED) {
98
102
  }
99
103
 
100
104
  // 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);
105
+ // Simple purchase (will use first available offer on Android if not specified)
106
+ const purchaseResult = await purchase('subscription_id_1', 'subs');
107
+
108
+ // With specific offer token (Android)
109
+ const purchaseResult = await purchase('subscription_id_1', 'subs', {
110
+ offerToken: product.subscriptionOfferDetails[0].offerToken
111
+ });
112
+
113
+ // With fraud prevention (Android)
114
+ const purchaseResult = await purchase('subscription_id_1', 'subs', {
115
+ obfuscatedAccountId: 'hashed_account_id',
116
+ obfuscatedProfileId: 'hashed_profile_id'
117
+ });
118
+
119
+ // With app account token (iOS - must be valid UUID)
120
+ const purchaseResult = await purchase('subscription_id_1', 'subs', {
121
+ appAccountToken: '550e8400-e29b-41d4-a716-446655440000'
122
+ });
104
123
 
105
124
  // Restore purchases (specify product type)
106
125
  const restored = await restorePurchases('subs');
@@ -137,6 +156,13 @@ unlisten();
137
156
  3. Configure your app's billing permissions (already included in the plugin)
138
157
  4. Test with test accounts or sandbox environment
139
158
 
159
+ ### Windows Setup
160
+
161
+ 1. Register your app in Microsoft Partner Center
162
+ 2. Create add-on products (consumables, durables, or subscriptions)
163
+ 3. Associate your app with the Microsoft Store
164
+ 4. Test with Windows sandbox environment
165
+
140
166
  ## API Reference
141
167
 
142
168
  ### `initialize()`
@@ -154,13 +180,17 @@ Fetches product details from the store.
154
180
  - `formattedPrice`: Localized price string
155
181
  - `subscriptionOfferDetails`: (subscriptions only) Array of offers
156
182
 
157
- ### `purchase(productId: string, productType: 'subs' | 'inapp' = 'subs', offerToken?: string)`
158
- Initiates a purchase flow.
183
+ ### `purchase(productId: string, productType: 'subs' | 'inapp' = 'subs', options?: PurchaseOptions)`
184
+ Initiates a purchase flow with enhanced options for fraud prevention and account management.
159
185
 
160
186
  **Parameters:**
161
187
  - `productId`: The product to purchase
162
188
  - `productType`: Type of product ('subs' for subscriptions, 'inapp' for one-time purchases), defaults to 'subs'
163
- - `offerToken`: (Android only) The offer token for subscriptions
189
+ - `options`: Optional purchase parameters:
190
+ - `offerToken`: (Android) Specific offer to purchase. If not provided, uses first available offer
191
+ - `obfuscatedAccountId`: (Android) Hashed account ID for fraud prevention
192
+ - `obfuscatedProfileId`: (Android) Hashed profile ID for fraud prevention
193
+ - `appAccountToken`: (iOS) UUID string for account tracking and fraud prevention
164
194
 
165
195
  **Returns:** Purchase object with transaction details
166
196
 
@@ -211,6 +241,11 @@ Listens for purchase state changes.
211
241
  - Offer tokens required for subscription purchases
212
242
  - More detailed pricing phase information
213
243
 
244
+ ### Windows (Microsoft Store)
245
+ - Automatic acknowledgment handled by the Store
246
+ - Supports consumables, durables, and subscriptions
247
+ - Uses SKUs for subscription offer variations
248
+
214
249
  ## Testing
215
250
 
216
251
  ### iOS
@@ -223,6 +258,12 @@ Listens for purchase state changes.
223
258
  2. Add test accounts in Google Play Console
224
259
  3. Test with test payment methods
225
260
 
261
+ ### Windows
262
+ 1. Use Microsoft Store sandbox environment
263
+ 2. Configure test accounts in Partner Center
264
+ 3. Test with Windows Dev Center test payment methods
265
+ 4. Ensure app is associated with Store listing
266
+
226
267
  ## License
227
268
 
228
269
  [MIT](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-plugin-iap-api",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "author": "You",
6
6
  "description": "A Tauri v2 plugin that enables In-App Purchases (IAP)",