@capgo/native-purchases 7.7.13 → 7.8.3
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 +11 -10
- package/android/src/main/java/ee/forgr/nativepurchases/NativePurchasesPlugin.java +690 -974
- package/dist/docs.json +18 -7
- package/dist/esm/definitions.d.ts +11 -5
- package/dist/esm/definitions.js +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +10 -10
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +11 -11
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +11 -11
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/NativePurchasesPlugin/NativePurchasesPlugin.swift +61 -44
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -401,7 +401,7 @@ const buyInAppProduct = async () => {
|
|
|
401
401
|
productIdentifier: 'com.yourapp.premium_features',
|
|
402
402
|
productType: PURCHASE_TYPE.INAPP,
|
|
403
403
|
quantity: 1,
|
|
404
|
-
appAccountToken: userUUID // Optional: iOS
|
|
404
|
+
appAccountToken: userUUID // Optional: iOS & Android - links purchases to a user (maps to Google Play ObfuscatedAccountId)
|
|
405
405
|
});
|
|
406
406
|
|
|
407
407
|
alert('Purchase successful! Transaction ID: ' + result.transactionId);
|
|
@@ -443,7 +443,7 @@ const buySubscription = async () => {
|
|
|
443
443
|
planIdentifier: 'monthly-plan', // REQUIRED for Android subscriptions
|
|
444
444
|
productType: PURCHASE_TYPE.SUBS, // REQUIRED for subscriptions
|
|
445
445
|
quantity: 1,
|
|
446
|
-
appAccountToken: userUUID // Optional: iOS
|
|
446
|
+
appAccountToken: userUUID // Optional: iOS & Android - links purchases to a user (maps to Google Play ObfuscatedAccountId)
|
|
447
447
|
});
|
|
448
448
|
|
|
449
449
|
alert('Subscription successful! Transaction ID: ' + result.transactionId);
|
|
@@ -828,15 +828,15 @@ Get the native Capacitor plugin version
|
|
|
828
828
|
### getPurchases(...)
|
|
829
829
|
|
|
830
830
|
```typescript
|
|
831
|
-
getPurchases(options?: { productType?: PURCHASE_TYPE | undefined; } | undefined) => Promise<{ purchases: Transaction[]; }>
|
|
831
|
+
getPurchases(options?: { productType?: PURCHASE_TYPE | undefined; appAccountToken?: string | undefined; } | undefined) => Promise<{ purchases: Transaction[]; }>
|
|
832
832
|
```
|
|
833
833
|
|
|
834
834
|
Gets all the user's purchases (both in-app purchases and subscriptions).
|
|
835
835
|
This method queries the platform's purchase history for the current user.
|
|
836
836
|
|
|
837
|
-
| Param | Type
|
|
838
|
-
| ------------- |
|
|
839
|
-
| **`options`** | <code>{ productType?: <a href="#purchase_type">PURCHASE_TYPE</a>; }</code> | - Optional parameters for filtering purchases |
|
|
837
|
+
| Param | Type | Description |
|
|
838
|
+
| ------------- | ---------------------------------------------------------------------------------------------------- | --------------------------------------------- |
|
|
839
|
+
| **`options`** | <code>{ productType?: <a href="#purchase_type">PURCHASE_TYPE</a>; appAccountToken?: string; }</code> | - Optional parameters for filtering purchases |
|
|
840
840
|
|
|
841
841
|
**Returns:** <code>Promise<{ purchases: Transaction[]; }></code>
|
|
842
842
|
|
|
@@ -848,7 +848,7 @@ This method queries the platform's purchase history for the current user.
|
|
|
848
848
|
### addListener('transactionUpdated', ...)
|
|
849
849
|
|
|
850
850
|
```typescript
|
|
851
|
-
addListener(eventName:
|
|
851
|
+
addListener(eventName: 'transactionUpdated', listenerFunc: (transaction: Transaction) => void) => Promise<PluginListenerHandle>
|
|
852
852
|
```
|
|
853
853
|
|
|
854
854
|
Listen for StoreKit transaction updates delivered by Apple's <a href="#transaction">Transaction</a>.updates.
|
|
@@ -883,8 +883,9 @@ Remove all registered listeners
|
|
|
883
883
|
|
|
884
884
|
| Prop | Type | Description |
|
|
885
885
|
| -------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
886
|
-
| **`transactionId`** | <code>string</code> |
|
|
886
|
+
| **`transactionId`** | <code>string</code> | Id associated to the transaction. |
|
|
887
887
|
| **`receipt`** | <code>string</code> | Receipt data for validation (iOS only - base64 encoded receipt) |
|
|
888
|
+
| **`appAccountToken`** | <code>string \| null</code> | Account token provided during purchase. Works on both platforms and maps to Google Play's ObfuscatedAccountId on Android. |
|
|
888
889
|
| **`productIdentifier`** | <code>string</code> | <a href="#product">Product</a> Id associated with the transaction. |
|
|
889
890
|
| **`purchaseDate`** | <code>string</code> | Purchase date of the transaction in ISO 8601 format. |
|
|
890
891
|
| **`originalPurchaseDate`** | <code>string</code> | Original purchase date of the transaction in ISO 8601 format (for subscriptions). |
|
|
@@ -957,8 +958,8 @@ Remove all registered listeners
|
|
|
957
958
|
|
|
958
959
|
| Members | Value | Description |
|
|
959
960
|
| ----------- | -------------------- | ---------------------------------- |
|
|
960
|
-
| **`INAPP`** | <code>
|
|
961
|
-
| **`SUBS`** | <code>
|
|
961
|
+
| **`INAPP`** | <code>'inapp'</code> | A type of SKU for in-app products. |
|
|
962
|
+
| **`SUBS`** | <code>'subs'</code> | A type of SKU for subscriptions. |
|
|
962
963
|
|
|
963
964
|
</docgen-api>
|
|
964
965
|
|