@choochmeque/tauri-plugin-iap-api 0.5.0 → 0.6.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.
- package/README.md +67 -7
- package/dist-js/index.cjs +2 -9
- package/dist-js/index.d.ts +2 -9
- package/dist-js/index.js +2 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,6 @@ A Tauri plugin for In-App Purchases (IAP) with support for subscriptions on iOS
|
|
|
10
10
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
|
-
- Initialize billing/store connection
|
|
14
13
|
- Query products and subscriptions with detailed pricing
|
|
15
14
|
- Purchase subscriptions with platform-specific features
|
|
16
15
|
- Restore previous purchases
|
|
@@ -70,13 +69,44 @@ fn main() {
|
|
|
70
69
|
}
|
|
71
70
|
```
|
|
72
71
|
|
|
72
|
+
## Example App
|
|
73
|
+
|
|
74
|
+
An example application is available in the [`examples/iap-demo`](examples/iap-demo) directory. The example demonstrates all core IAP functionality with a UI:
|
|
75
|
+
|
|
76
|
+
- Fetch and display products with pricing
|
|
77
|
+
- Purchase products and subscriptions
|
|
78
|
+
- Restore previous purchases
|
|
79
|
+
- Check product ownership status
|
|
80
|
+
- Real-time purchase update notifications
|
|
81
|
+
|
|
82
|
+
### Running the Example
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd examples/iap-demo
|
|
86
|
+
|
|
87
|
+
# Install dependencies
|
|
88
|
+
pnpm install
|
|
89
|
+
|
|
90
|
+
# Run in development mode
|
|
91
|
+
pnpm tauri dev
|
|
92
|
+
|
|
93
|
+
# Build for production
|
|
94
|
+
pnpm tauri build
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Important:** The app must be properly code-signed to test IAP functionality:
|
|
98
|
+
- **iOS/macOS**: Code signing is required by StoreKit. Configure signing in Xcode or via Tauri's configuration.
|
|
99
|
+
- **Android**: Sign your APK/AAB with a release keystore for production testing.
|
|
100
|
+
- **Windows**: App must be associated with Microsoft Store and signed for Store submission.
|
|
101
|
+
|
|
102
|
+
The example app provides a fully functional demo with inline documentation for each IAP feature, making it easy to understand how to integrate the plugin into your own application.
|
|
103
|
+
|
|
73
104
|
## Usage
|
|
74
105
|
|
|
75
106
|
### JavaScript/TypeScript
|
|
76
107
|
|
|
77
108
|
```typescript
|
|
78
109
|
import {
|
|
79
|
-
initialize,
|
|
80
110
|
getProducts,
|
|
81
111
|
purchase,
|
|
82
112
|
restorePurchases,
|
|
@@ -86,9 +116,6 @@ import {
|
|
|
86
116
|
PurchaseState
|
|
87
117
|
} from '@choochmeque/tauri-plugin-iap-api';
|
|
88
118
|
|
|
89
|
-
// Initialize the billing client
|
|
90
|
-
await initialize();
|
|
91
|
-
|
|
92
119
|
// Get available products
|
|
93
120
|
const products = await getProducts(['subscription_id_1', 'subscription_id_2'], 'subs');
|
|
94
121
|
|
|
@@ -163,10 +190,43 @@ await listener.unregister();
|
|
|
163
190
|
3. Associate your app with the Microsoft Store
|
|
164
191
|
4. Test with Windows sandbox environment
|
|
165
192
|
|
|
193
|
+
### macOS Setup
|
|
194
|
+
|
|
195
|
+
1. Configure your app in App Store Connect
|
|
196
|
+
2. Create subscription or in-app purchase products with pricing
|
|
197
|
+
3. Configure code signing in `tauri.conf.json`:
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"bundle": {
|
|
201
|
+
"macOS": {
|
|
202
|
+
"signingIdentity": "Developer ID Application: Your Name (TEAM_ID)",
|
|
203
|
+
"entitlements": "path/to/entitlements.plist"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
4. Add required entitlements for StoreKit (create `entitlements.plist`):
|
|
209
|
+
```xml
|
|
210
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
211
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
212
|
+
<plist version="1.0">
|
|
213
|
+
<dict>
|
|
214
|
+
<key>com.apple.security.app-sandbox</key>
|
|
215
|
+
<true/>
|
|
216
|
+
<key>com.apple.security.network.client</key>
|
|
217
|
+
<true/>
|
|
218
|
+
</dict>
|
|
219
|
+
</plist>
|
|
220
|
+
```
|
|
221
|
+
5. Test with sandbox accounts or StoreKit Configuration files
|
|
222
|
+
6. **Important**: App must be code-signed to use StoreKit APIs
|
|
223
|
+
|
|
166
224
|
## API Reference
|
|
167
225
|
|
|
168
|
-
### `initialize()`
|
|
169
|
-
|
|
226
|
+
### `initialize()` *(Deprecated)*
|
|
227
|
+
> **Deprecated**: This function is no longer needed and will be removed in a future major release. The billing client is now initialized automatically when the plugin loads.
|
|
228
|
+
|
|
229
|
+
Returns `{ success: true }` for backward compatibility.
|
|
170
230
|
|
|
171
231
|
### `getProducts(productIds: string[], productType: 'subs' | 'inapp')`
|
|
172
232
|
Fetches product details from the store.
|
package/dist-js/index.cjs
CHANGED
|
@@ -13,16 +13,9 @@ exports.PurchaseState = void 0;
|
|
|
13
13
|
})(exports.PurchaseState || (exports.PurchaseState = {}));
|
|
14
14
|
/**
|
|
15
15
|
* Initialize the IAP plugin.
|
|
16
|
-
* Must be called before any other IAP operations.
|
|
17
16
|
*
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const result = await initialize();
|
|
22
|
-
* if (result.success) {
|
|
23
|
-
* console.log('IAP initialized successfully');
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
17
|
+
* @deprecated This function is no longer needed. The billing client is now initialized automatically when the plugin loads. This function will be removed in the next major release.
|
|
18
|
+
* @returns Promise resolving to `{ success: true }` for backward compatibility
|
|
26
19
|
*/
|
|
27
20
|
async function initialize() {
|
|
28
21
|
return await core.invoke("plugin:iap|initialize");
|
package/dist-js/index.d.ts
CHANGED
|
@@ -144,16 +144,9 @@ export interface PurchaseOptions {
|
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Initialize the IAP plugin.
|
|
147
|
-
* Must be called before any other IAP operations.
|
|
148
147
|
*
|
|
149
|
-
* @
|
|
150
|
-
* @
|
|
151
|
-
* ```typescript
|
|
152
|
-
* const result = await initialize();
|
|
153
|
-
* if (result.success) {
|
|
154
|
-
* console.log('IAP initialized successfully');
|
|
155
|
-
* }
|
|
156
|
-
* ```
|
|
148
|
+
* @deprecated This function is no longer needed. The billing client is now initialized automatically when the plugin loads. This function will be removed in the next major release.
|
|
149
|
+
* @returns Promise resolving to `{ success: true }` for backward compatibility
|
|
157
150
|
*/
|
|
158
151
|
export declare function initialize(): Promise<InitializeResponse>;
|
|
159
152
|
/**
|
package/dist-js/index.js
CHANGED
|
@@ -11,16 +11,9 @@ var PurchaseState;
|
|
|
11
11
|
})(PurchaseState || (PurchaseState = {}));
|
|
12
12
|
/**
|
|
13
13
|
* Initialize the IAP plugin.
|
|
14
|
-
* Must be called before any other IAP operations.
|
|
15
14
|
*
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const result = await initialize();
|
|
20
|
-
* if (result.success) {
|
|
21
|
-
* console.log('IAP initialized successfully');
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
15
|
+
* @deprecated This function is no longer needed. The billing client is now initialized automatically when the plugin loads. This function will be removed in the next major release.
|
|
16
|
+
* @returns Promise resolving to `{ success: true }` for backward compatibility
|
|
24
17
|
*/
|
|
25
18
|
async function initialize() {
|
|
26
19
|
return await invoke("plugin:iap|initialize");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@choochmeque/tauri-plugin-iap-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "You",
|
|
6
6
|
"description": "A Tauri v2 plugin that enables In-App Purchases (IAP)",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@vitest/coverage-v8": "^4.0.13",
|
|
41
41
|
"@vitest/ui": "^4.0.13",
|
|
42
42
|
"happy-dom": "^20.0.10",
|
|
43
|
-
"prettier": "3.
|
|
43
|
+
"prettier": "3.7.4",
|
|
44
44
|
"rollup": "^4.9.6",
|
|
45
45
|
"tslib": "^2.6.2",
|
|
46
46
|
"typescript": "^5.3.3",
|