@choochmeque/tauri-plugin-iap-api 0.1.8 → 0.1.9
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.
- package/README.md +10 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,13 +64,13 @@ await initialize();
|
|
|
64
64
|
// Get available products
|
|
65
65
|
const products = await getProducts(['subscription_id_1', 'subscription_id_2'], 'subs');
|
|
66
66
|
|
|
67
|
-
// Purchase a subscription
|
|
67
|
+
// Purchase a subscription or in-app product
|
|
68
68
|
// On Android: use the offer token from subscriptionOfferDetails
|
|
69
69
|
// On iOS: offer token is not used
|
|
70
|
-
const purchaseResult = await purchase('subscription_id_1', offerToken);
|
|
70
|
+
const purchaseResult = await purchase('subscription_id_1', 'subs', offerToken);
|
|
71
71
|
|
|
72
|
-
// Restore purchases
|
|
73
|
-
const restored = await restorePurchases();
|
|
72
|
+
// Restore purchases (specify product type)
|
|
73
|
+
const restored = await restorePurchases('subs');
|
|
74
74
|
|
|
75
75
|
// Acknowledge a purchase (Android only, iOS auto-acknowledges)
|
|
76
76
|
await acknowledgePurchase(purchaseResult.purchaseToken);
|
|
@@ -121,18 +121,22 @@ Fetches product details from the store.
|
|
|
121
121
|
- `formattedPrice`: Localized price string
|
|
122
122
|
- `subscriptionOfferDetails`: (subscriptions only) Array of offers
|
|
123
123
|
|
|
124
|
-
### `purchase(productId: string, offerToken?: string)`
|
|
124
|
+
### `purchase(productId: string, productType: 'subs' | 'inapp' = 'subs', offerToken?: string)`
|
|
125
125
|
Initiates a purchase flow.
|
|
126
126
|
|
|
127
127
|
**Parameters:**
|
|
128
128
|
- `productId`: The product to purchase
|
|
129
|
+
- `productType`: Type of product ('subs' for subscriptions, 'inapp' for one-time purchases), defaults to 'subs'
|
|
129
130
|
- `offerToken`: (Android only) The offer token for subscriptions
|
|
130
131
|
|
|
131
132
|
**Returns:** Purchase object with transaction details
|
|
132
133
|
|
|
133
|
-
### `restorePurchases()`
|
|
134
|
+
### `restorePurchases(productType: 'subs' | 'inapp' = 'subs')`
|
|
134
135
|
Queries and returns all active purchases.
|
|
135
136
|
|
|
137
|
+
**Parameters:**
|
|
138
|
+
- `productType`: Type of products to restore ('subs' or 'inapp'), defaults to 'subs'
|
|
139
|
+
|
|
136
140
|
### `getPurchaseHistory()`
|
|
137
141
|
Returns the complete purchase history.
|
|
138
142
|
|