@choochmeque/tauri-plugin-iap-api 0.9.0 → 0.9.1

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 CHANGED
@@ -46,7 +46,7 @@ Add the plugin to your Tauri project's `Cargo.toml`:
46
46
 
47
47
  ```toml
48
48
  [dependencies]
49
- tauri-plugin-iap = "0.8"
49
+ tauri-plugin-iap = "0.9"
50
50
  ```
51
51
 
52
52
  Configure the plugin permissions in your `capabilities/default.json`:
@@ -179,6 +179,49 @@ const listener = await onPurchaseUpdated((purchase) => {
179
179
  await listener.unregister();
180
180
  ```
181
181
 
182
+ ### Rust
183
+
184
+ ```rust
185
+ use tauri_plugin_iap::{IapExt, PurchaseRequest, PurchaseStateValue, Result};
186
+
187
+
188
+ // Get available products
189
+ let products = app.iap()
190
+ .get_products(
191
+ vec!["subscription_id_1".into(), "subscription_id_2".into()],
192
+ "subs".into(),
193
+ )
194
+ .await?;
195
+
196
+ // Check if user owns a specific product
197
+ let status = app.iap()
198
+ .get_product_status("subscription_id_1".into(), "subs".into())
199
+ .await?;
200
+ if status.is_owned && status.purchase_state == Some(PurchaseStateValue::Purchased) {
201
+ println!("User has active subscription");
202
+ if status.is_auto_renewing == Some(true) {
203
+ println!("Subscription will auto-renew");
204
+ }
205
+ }
206
+
207
+ // Purchase a subscription or in-app product
208
+ // Simple purchase (will use first available offer on Android if not specified)
209
+ let purchase_result = app.iap()
210
+ .purchase(PurchaseRequest {
211
+ product_id: "subscription_id_1".into(),
212
+ product_type: "subs".into(),
213
+ options: None,
214
+ })
215
+ .await?;
216
+
217
+ // Restore purchases (specify product type)
218
+ let restored = app.iap().restore_purchases("subs".into()).await?;
219
+
220
+ // Acknowledge a non-consumable purchase (subscriptions, durables).
221
+ // No-op on iOS/macOS — StoreKit auto-finishes transactions.
222
+ app.iap().acknowledge_purchase(purchase_result.purchase_token).await?;
223
+ ```
224
+
182
225
  ## Platform Setup
183
226
 
184
227
  ### iOS Setup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choochmeque/tauri-plugin-iap-api",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "license": "MIT",
5
5
  "author": "You",
6
6
  "description": "A Tauri v2 plugin that enables In-App Purchases (IAP)",
File without changes