@capgo/native-purchases 7.12.7 → 7.13.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 CHANGED
@@ -1450,14 +1450,14 @@ Restores a user's previous and links their appUserIDs to any user's also using
1450
1450
  ### purchaseProduct(...)
1451
1451
 
1452
1452
  ```typescript
1453
- purchaseProduct(options: { productIdentifier: string; planIdentifier?: string; productType?: PURCHASE_TYPE; quantity?: number; appAccountToken?: string; }) => Promise<Transaction>
1453
+ purchaseProduct(options: { productIdentifier: string; planIdentifier?: string; productType?: PURCHASE_TYPE; quantity?: number; appAccountToken?: string; isConsumable?: boolean; }) => Promise<Transaction>
1454
1454
  ```
1455
1455
 
1456
1456
  Started purchase process for the given product.
1457
1457
 
1458
- | Param | Type | Description |
1459
- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
1460
- | **`options`** | <code>{ productIdentifier: string; planIdentifier?: string; productType?: <a href="#purchase_type">PURCHASE_TYPE</a>; quantity?: number; appAccountToken?: string; }</code> | - The product to purchase |
1458
+ | Param | Type | Description |
1459
+ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
1460
+ | **`options`** | <code>{ productIdentifier: string; planIdentifier?: string; productType?: <a href="#purchase_type">PURCHASE_TYPE</a>; quantity?: number; appAccountToken?: string; isConsumable?: boolean; }</code> | - The product to purchase |
1461
1461
 
1462
1462
  **Returns:** <code>Promise&lt;<a href="#transaction">Transaction</a>&gt;</code>
1463
1463
 
@@ -39,7 +39,7 @@ import org.json.JSONArray;
39
39
  @CapacitorPlugin(name = "NativePurchases")
40
40
  public class NativePurchasesPlugin extends Plugin {
41
41
 
42
- private final String pluginVersion = "7.12.7";
42
+ private final String pluginVersion = "7.13.0";
43
43
  public static final String TAG = "NativePurchases";
44
44
  private static final Phaser semaphoreReady = new Phaser(1);
45
45
  private BillingClient billingClient;
@@ -120,19 +120,27 @@ public class NativePurchasesPlugin extends Plugin {
120
120
 
121
121
  if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
122
122
  Log.d(TAG, "Purchase state is PURCHASED");
123
- // Grant entitlement to the user, then acknowledge the purchase
124
- // if sub then acknowledgePurchase
125
- // if one time then consumePurchase
123
+ boolean isConsumable = purchaseCall != null && purchaseCall.getBoolean("isConsumable", false);
124
+ PurchaseAction action = PurchaseActionDecider.decide(isConsumable, purchase);
125
+
126
126
  AccountIdentifiers accountIdentifiers = purchase.getAccountIdentifiers();
127
127
  String purchaseAccountId = accountIdentifiers != null ? accountIdentifiers.getObfuscatedAccountId() : null;
128
128
  Log.d(TAG, "Purchase account identifier present: " + (purchaseAccountId != null ? "[REDACTED]" : "none"));
129
- if (purchase.isAcknowledged()) {
130
- Log.d(TAG, "Purchase already acknowledged, consuming...");
131
- ConsumeParams consumeParams = ConsumeParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build();
132
- billingClient.consumeAsync(consumeParams, this::onConsumeResponse);
133
- } else {
134
- Log.d(TAG, "Purchase not acknowledged, acknowledging...");
135
- acknowledgePurchase(purchase.getPurchaseToken());
129
+
130
+ switch (action) {
131
+ case CONSUME:
132
+ Log.d(TAG, "Purchase flagged as consumable, consuming...");
133
+ ConsumeParams consumeParams = ConsumeParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build();
134
+ billingClient.consumeAsync(consumeParams, this::onConsumeResponse);
135
+ break;
136
+ case ACKNOWLEDGE:
137
+ Log.d(TAG, "Purchase not acknowledged, acknowledging...");
138
+ acknowledgePurchase(purchase.getPurchaseToken());
139
+ break;
140
+ case NONE:
141
+ default:
142
+ Log.d(TAG, "No additional purchase handling required");
143
+ break;
136
144
  }
137
145
 
138
146
  JSObject ret = new JSObject();
@@ -307,12 +315,14 @@ public class NativePurchasesPlugin extends Plugin {
307
315
  Number quantity = call.getInt("quantity", 1);
308
316
  String appAccountToken = call.getString("appAccountToken");
309
317
  final String accountIdentifier = appAccountToken != null && !appAccountToken.isEmpty() ? appAccountToken : null;
318
+ boolean isConsumable = call.getBoolean("isConsumable", false);
310
319
 
311
320
  Log.d(TAG, "Product identifier: " + productIdentifier);
312
321
  Log.d(TAG, "Plan identifier: " + planIdentifier);
313
322
  Log.d(TAG, "Product type: " + productType);
314
323
  Log.d(TAG, "Quantity: " + quantity);
315
324
  Log.d(TAG, "Account identifier provided: " + (accountIdentifier != null ? "[REDACTED]" : "none"));
325
+ Log.d(TAG, "Is consumable: " + isConsumable);
316
326
 
317
327
  // cannot use quantity, because it's done in native modal
318
328
  Log.d("CapacitorPurchases", "purchaseProduct: " + productIdentifier);
@@ -341,6 +351,12 @@ public class NativePurchasesPlugin extends Plugin {
341
351
  call.reject("quantity is less than 1");
342
352
  return;
343
353
  }
354
+ if (isConsumable && productType.equals("subs")) {
355
+ Log.d(TAG, "isConsumable is not supported for subscriptions, ignoring flag");
356
+ isConsumable = false;
357
+ }
358
+
359
+ call.getData().put("isConsumable", isConsumable);
344
360
 
345
361
  // For subscriptions, always use the productIdentifier (subscription ID) to query
346
362
  // The planIdentifier is used later when setting the offer token
@@ -456,13 +472,12 @@ public class NativePurchasesPlugin extends Plugin {
456
472
  Log.d(TAG, "Processing purchase: " + purchase.getOrderId());
457
473
  Log.d(TAG, "Purchase state: " + purchase.getPurchaseState());
458
474
  if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
459
- if (purchase.isAcknowledged()) {
460
- Log.d(TAG, "Purchase already acknowledged, consuming");
461
- ConsumeParams consumeParams = ConsumeParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build();
462
- billingClient.consumeAsync(consumeParams, this::onConsumeResponse);
463
- } else {
475
+ PurchaseAction action = PurchaseActionDecider.decide(false, purchase);
476
+ if (action == PurchaseAction.ACKNOWLEDGE) {
464
477
  Log.d(TAG, "Purchase not acknowledged, acknowledging");
465
478
  acknowledgePurchase(purchase.getPurchaseToken());
479
+ } else {
480
+ Log.d(TAG, "Purchase already acknowledged, skipping consume");
466
481
  }
467
482
  }
468
483
  }
@@ -0,0 +1,58 @@
1
+ package ee.forgr.nativepurchases;
2
+
3
+ import com.android.billingclient.api.Purchase;
4
+
5
+ enum PurchaseAction {
6
+ CONSUME,
7
+ ACKNOWLEDGE,
8
+ NONE
9
+ }
10
+
11
+ final class PurchaseActionDecider {
12
+
13
+ private PurchaseActionDecider() {}
14
+
15
+ static PurchaseAction decide(boolean isConsumable, Purchase purchase) {
16
+ return decide(isConsumable, purchase == null ? null : new PurchaseDetailsAdapter(purchase));
17
+ }
18
+
19
+ static PurchaseAction decide(boolean isConsumable, PurchaseDetails purchase) {
20
+ if (purchase == null) {
21
+ return PurchaseAction.NONE;
22
+ }
23
+ if (purchase.getPurchaseState() != Purchase.PurchaseState.PURCHASED) {
24
+ return PurchaseAction.NONE;
25
+ }
26
+ if (isConsumable) {
27
+ return PurchaseAction.CONSUME;
28
+ }
29
+ if (purchase.isAcknowledged()) {
30
+ return PurchaseAction.NONE;
31
+ }
32
+ return PurchaseAction.ACKNOWLEDGE;
33
+ }
34
+
35
+ interface PurchaseDetails {
36
+ int getPurchaseState();
37
+ boolean isAcknowledged();
38
+ }
39
+
40
+ private static final class PurchaseDetailsAdapter implements PurchaseDetails {
41
+
42
+ private final Purchase purchase;
43
+
44
+ PurchaseDetailsAdapter(Purchase purchase) {
45
+ this.purchase = purchase;
46
+ }
47
+
48
+ @Override
49
+ public int getPurchaseState() {
50
+ return purchase.getPurchaseState();
51
+ }
52
+
53
+ @Override
54
+ public boolean isAcknowledged() {
55
+ return purchase.isAcknowledged();
56
+ }
57
+ }
58
+ }
package/dist/docs.json CHANGED
@@ -17,12 +17,12 @@
17
17
  },
18
18
  {
19
19
  "name": "purchaseProduct",
20
- "signature": "(options: { productIdentifier: string; planIdentifier?: string; productType?: PURCHASE_TYPE; quantity?: number; appAccountToken?: string; }) => Promise<Transaction>",
20
+ "signature": "(options: { productIdentifier: string; planIdentifier?: string; productType?: PURCHASE_TYPE; quantity?: number; appAccountToken?: string; isConsumable?: boolean; }) => Promise<Transaction>",
21
21
  "parameters": [
22
22
  {
23
23
  "name": "options",
24
24
  "docs": "- The product to purchase",
25
- "type": "{ productIdentifier: string; planIdentifier?: string | undefined; productType?: PURCHASE_TYPE | undefined; quantity?: number | undefined; appAccountToken?: string | undefined; }"
25
+ "type": "{ productIdentifier: string; planIdentifier?: string | undefined; productType?: PURCHASE_TYPE | undefined; quantity?: number | undefined; appAccountToken?: string | undefined; isConsumable?: boolean | undefined; }"
26
26
  }
27
27
  ],
28
28
  "returns": "Promise<Transaction>",
@@ -50,6 +50,10 @@
50
50
  {
51
51
  "name": "param",
52
52
  "text": "options.appAccountToken - Optional identifier uniquely associated with the user's account in your app.\n PLATFORM REQUIREMENTS:\n - iOS: Must be a valid UUID format (StoreKit 2 requirement)\n - Android: Can be any obfuscated string (max 64 chars), maps to ObfuscatedAccountId\n SECURITY: DO NOT use PII like emails in cleartext - use UUID or hashed value.\n RECOMMENDED: Use UUID v5 with deterministic generation for cross-platform compatibility."
53
+ },
54
+ {
55
+ "name": "param",
56
+ "text": "options.isConsumable - Only Android, when true the purchase token is consumed after granting entitlement (for consumable in-app items). Defaults to false."
53
57
  }
54
58
  ],
55
59
  "docs": "Started purchase process for the given product.",
@@ -459,6 +459,7 @@ export interface NativePurchasesPlugin {
459
459
  * - Android: Can be any obfuscated string (max 64 chars), maps to ObfuscatedAccountId
460
460
  * SECURITY: DO NOT use PII like emails in cleartext - use UUID or hashed value.
461
461
  * RECOMMENDED: Use UUID v5 with deterministic generation for cross-platform compatibility.
462
+ * @param options.isConsumable - Only Android, when true the purchase token is consumed after granting entitlement (for consumable in-app items). Defaults to false.
462
463
  */
463
464
  purchaseProduct(options: {
464
465
  productIdentifier: string;
@@ -466,6 +467,7 @@ export interface NativePurchasesPlugin {
466
467
  productType?: PURCHASE_TYPE;
467
468
  quantity?: number;
468
469
  appAccountToken?: string;
470
+ isConsumable?: boolean;
469
471
  }): Promise<Transaction>;
470
472
  /**
471
473
  * Gets the product info associated with a list of product identifiers.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,qFAAoB,CAAA;IACpB,iEAAU,CAAA;IACV,uEAAa,CAAA;IACb,iEAAU,CAAA;IACV,iEAAU,CAAA;IACV,qEAAY,CAAA;AACd,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,MAAM,CAAN,IAAY,aAUX;AAVD,WAAY,aAAa;IACvB;;OAEG;IACH,gCAAe,CAAA;IAEf;;OAEG;IACH,8BAAa,CAAA;AACf,CAAC,EAVW,aAAa,KAAb,aAAa,QAUxB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAyBX;AAzBD,WAAY,eAAe;IACzB;;OAEG;IACH,uEAAa,CAAA;IAEb;;OAEG;IACH,qFAAoB,CAAA;IAEpB;;OAEG;IACH,iFAAkB,CAAA;IAElB;;OAEG;IACH,mFAAmB,CAAA;IAEnB;;OAEG;IACH,+FAAyB,CAAA;AAC3B,CAAC,EAzBW,eAAe,KAAf,eAAe,QAyB1B;AACD,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,qIAAiD,CAAA;IAEjD;;;OAGG;IACH,qGAAiC,CAAA;IAEjC;;;;OAIG;IACH,iHAAuC,CAAA;IAEvC;;;OAGG;IACH,iGAA+B,CAAA;IAE/B;;;OAGG;IACH,2DAAY,CAAA;AACd,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAED,MAAM,CAAN,IAAY,YA6CX;AA7CD,WAAY,YAAY;IACtB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,qCAAqB,CAAA;IAErB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,2CAA2B,CAAA;IAE3B;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EA7CW,YAAY,KAAZ,YAAY,QA6CvB;AAED,MAAM,CAAN,IAAY,wBAaX;AAbD,WAAY,wBAAwB;IAClC;;OAEG;IACH,+HAAoC,CAAA;IACpC;;OAEG;IACH,qIAAmC,CAAA;IACnC;;OAEG;IACH,iIAAiC,CAAA;AACnC,CAAC,EAbW,wBAAwB,KAAxB,wBAAwB,QAanC","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport enum ATTRIBUTION_NETWORK {\n APPLE_SEARCH_ADS = 0,\n ADJUST = 1,\n APPSFLYER = 2,\n BRANCH = 3,\n TENJIN = 4,\n FACEBOOK = 5,\n}\n\nexport enum PURCHASE_TYPE {\n /**\n * A type of SKU for in-app products.\n */\n INAPP = 'inapp',\n\n /**\n * A type of SKU for subscriptions.\n */\n SUBS = 'subs',\n}\n\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport enum BILLING_FEATURE {\n /**\n * Purchase/query for subscriptions.\n */\n SUBSCRIPTIONS,\n\n /**\n * Subscriptions update/replace.\n */\n SUBSCRIPTIONS_UPDATE,\n\n /**\n * Purchase/query for in-app items on VR.\n */\n IN_APP_ITEMS_ON_VR,\n\n /**\n * Purchase/query for subscriptions on VR.\n */\n SUBSCRIPTIONS_ON_VR,\n\n /**\n * Launch a price change confirmation flow.\n */\n PRICE_CHANGE_CONFIRMATION,\n}\nexport enum PRORATION_MODE {\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n IMMEDIATE_WITHOUT_PRORATION = 3,\n\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n DEFERRED = 4,\n}\n\nexport enum PACKAGE_TYPE {\n /**\n * A package that was defined with a custom identifier.\n */\n UNKNOWN = 'UNKNOWN',\n\n /**\n * A package that was defined with a custom identifier.\n */\n CUSTOM = 'CUSTOM',\n\n /**\n * A package configured with the predefined lifetime identifier.\n */\n LIFETIME = 'LIFETIME',\n\n /**\n * A package configured with the predefined annual identifier.\n */\n ANNUAL = 'ANNUAL',\n\n /**\n * A package configured with the predefined six month identifier.\n */\n SIX_MONTH = 'SIX_MONTH',\n\n /**\n * A package configured with the predefined three month identifier.\n */\n THREE_MONTH = 'THREE_MONTH',\n\n /**\n * A package configured with the predefined two month identifier.\n */\n TWO_MONTH = 'TWO_MONTH',\n\n /**\n * A package configured with the predefined monthly identifier.\n */\n MONTHLY = 'MONTHLY',\n\n /**\n * A package configured with the predefined weekly identifier.\n */\n WEEKLY = 'WEEKLY',\n}\n\nexport enum INTRO_ELIGIBILITY_STATUS {\n /**\n * doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_INELIGIBLE,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE,\n}\n\nexport interface Transaction {\n /**\n * Unique identifier for the transaction.\n *\n * @since 1.0.0\n * @platform ios Numeric string (e.g., \"2000001043762129\")\n * @platform android Alphanumeric string (e.g., \"GPA.1234-5678-9012-34567\")\n */\n readonly transactionId: string;\n /**\n * Receipt data for validation (base64 encoded StoreKit receipt).\n *\n * Send this to your backend for server-side validation with Apple's receipt verification API.\n * The receipt remains available even after refund - server validation is required to detect refunded transactions.\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Not available (use purchaseToken instead)\n */\n readonly receipt?: string;\n /**\n * An optional obfuscated identifier that uniquely associates the transaction with a user account in your app.\n *\n * PURPOSE:\n * - Fraud detection: Helps platforms detect irregular activity (e.g., many devices purchasing on the same account)\n * - User linking: Links purchases to in-game characters, avatars, or in-app profiles\n *\n * PLATFORM DIFFERENCES:\n * - iOS: Must be a valid UUID format (e.g., \"550e8400-e29b-41d4-a716-446655440000\")\n * Apple's StoreKit 2 requires UUID format for the appAccountToken parameter\n * - Android: Can be any obfuscated string (max 64 chars), maps to Google Play's ObfuscatedAccountId\n * Google recommends using encryption or one-way hash\n *\n * SECURITY REQUIREMENTS (especially for Android):\n * - DO NOT store Personally Identifiable Information (PII) like emails in cleartext\n * - Use encryption or a one-way hash to generate an obfuscated identifier\n * - Maximum length: 64 characters (both platforms)\n * - Storing PII in cleartext will result in purchases being blocked by Google Play\n *\n * IMPLEMENTATION EXAMPLE:\n * ```typescript\n * // For iOS: Generate a deterministic UUID from user ID\n * import { v5 as uuidv5 } from 'uuid';\n * const NAMESPACE = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; // Your app's namespace UUID\n * const appAccountToken = uuidv5(userId, NAMESPACE);\n *\n * // For Android: Can also use UUID or any hashed value\n * // The same UUID approach works for both platforms\n * ```\n */\n readonly appAccountToken?: string | null;\n /**\n * Product identifier associated with the transaction.\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Always present\n */\n readonly productIdentifier: string;\n /**\n * Purchase date of the transaction in ISO 8601 format.\n *\n * @since 1.0.0\n * @example \"2025-10-28T06:03:19Z\"\n * @platform ios Always present\n * @platform android Always present\n */\n readonly purchaseDate: string;\n /**\n * Original purchase date of the transaction in ISO 8601 format.\n *\n * For subscription renewals, this shows the date of the original subscription purchase,\n * while purchaseDate shows the date of the current renewal.\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions only\n * @platform android Not available\n */\n readonly originalPurchaseDate?: string;\n /**\n * Expiration date of the transaction in ISO 8601 format.\n *\n * Check this date to determine if a subscription is still valid.\n * Compare with current date: if expirationDate > now, subscription is active.\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions only\n * @platform android Not available (query Google Play Developer API instead)\n */\n readonly expirationDate?: string;\n /**\n * Whether the subscription is still active/valid.\n *\n * For iOS subscriptions, check if isActive === true to verify an active subscription.\n * For expired or refunded iOS subscriptions, this will be false.\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions only (true if expiration date is in the future)\n * @platform android Not available (check purchaseState === \"1\" instead)\n */\n readonly isActive?: boolean;\n /**\n * Whether the subscription will be cancelled at the end of the billing cycle.\n *\n * - `true`: User has cancelled but subscription remains active until expiration\n * - `false`: Subscription will auto-renew\n * - `null`: Status unknown or not available\n *\n * @since 1.0.0\n * @default null\n * @platform ios Present for subscriptions only (boolean or null)\n * @platform android Always null (use Google Play Developer API for cancellation status)\n */\n readonly willCancel: boolean | null;\n /**\n * Purchase state of the transaction (numeric string value).\n *\n * **Android Values:**\n * - `\"1\"`: Purchase completed and valid (PURCHASED state)\n * - `\"0\"`: Payment pending (PENDING state, e.g., cash payment processing)\n * - Other numeric values: Various other states\n *\n * Always check `purchaseState === \"1\"` on Android to verify a valid purchase.\n * Refunded purchases typically disappear from getPurchases() rather than showing a different state.\n *\n * @since 1.0.0\n * @platform ios Not available (use isActive for subscriptions or receipt validation for IAP)\n * @platform android Always present\n */\n readonly purchaseState?: string;\n /**\n * Order ID associated with the transaction.\n *\n * Use this for server-side verification on Android. This is the Google Play order ID.\n *\n * @since 1.0.0\n * @example \"GPA.1234-5678-9012-34567\"\n * @platform ios Not available\n * @platform android Always present\n */\n readonly orderId?: string;\n /**\n * Purchase token associated with the transaction.\n *\n * Send this to your backend for server-side validation with Google Play Developer API.\n * This is the Android equivalent of iOS's receipt field.\n *\n * @since 1.0.0\n * @platform ios Not available (use receipt instead)\n * @platform android Always present\n */\n readonly purchaseToken?: string;\n /**\n * Whether the purchase has been acknowledged.\n *\n * Purchases must be acknowledged within 3 days or they will be refunded.\n * This plugin automatically acknowledges purchases.\n *\n * @since 1.0.0\n * @platform ios Not available\n * @platform android Always present (should be true after successful purchase)\n */\n readonly isAcknowledged?: boolean;\n /**\n * Quantity purchased.\n *\n * @since 1.0.0\n * @default 1\n * @platform ios 1 or higher (as specified in purchaseProduct call)\n * @platform android Always 1 (Google Play doesn't support quantity > 1)\n */\n readonly quantity?: number;\n /**\n * Product type.\n *\n * - `\"inapp\"`: One-time in-app purchase\n * - `\"subs\"`: Subscription\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Always present\n */\n readonly productType?: string;\n /**\n * Whether the transaction is in a trial period.\n *\n * - `true`: Currently in free trial period\n * - `false`: Not in trial period\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions with trial offers\n * @platform android Present for subscriptions with trial offers\n */\n readonly isTrialPeriod?: boolean;\n /**\n * Whether the transaction is in an introductory price period.\n *\n * Introductory pricing is a discounted rate, different from a free trial.\n *\n * - `true`: Currently using introductory pricing\n * - `false`: Not in intro period\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions with intro pricing\n * @platform android Present for subscriptions with intro pricing\n */\n readonly isInIntroPricePeriod?: boolean;\n /**\n * Whether the transaction is in a grace period.\n *\n * Grace period allows users to fix payment issues while maintaining access.\n * You typically want to continue providing access during this time.\n *\n * - `true`: Subscription payment failed but user still has access\n * - `false`: Not in grace period\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions in grace period\n * @platform android Present for subscriptions in grace period\n */\n readonly isInGracePeriod?: boolean;\n}\n\nexport interface SubscriptionPeriod {\n /**\n * The Subscription Period number of unit.\n */\n readonly numberOfUnits: number;\n /**\n * The Subscription Period unit.\n */\n readonly unit: number;\n}\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n */\n readonly type: number;\n /**\n * The Product discount price.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * The Product discount currency symbol.\n */\n readonly currencySymbol: string;\n /**\n * The Product discount currency code.\n */\n readonly currencyCode: string;\n /**\n * The Product discount paymentMode.\n */\n readonly paymentMode: number;\n /**\n * The Product discount number Of Periods.\n */\n readonly numberOfPeriods: number;\n /**\n * The Product discount subscription period.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n}\nexport interface Product {\n /**\n * Product Id.\n */\n readonly identifier: string;\n /**\n * Description of the product.\n */\n readonly description: string;\n /**\n * Title of the product.\n */\n readonly title: string;\n /**\n * Price of the product in the local currency.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * Currency code for price and original price.\n */\n readonly currencyCode: string;\n /**\n * Currency symbol for price and original price.\n */\n readonly currencySymbol: string;\n /**\n * Boolean indicating if the product is sharable with family\n */\n readonly isFamilyShareable: boolean;\n /**\n * Group identifier for the product.\n */\n readonly subscriptionGroupIdentifier: string;\n /**\n * The Product subcription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * The Product discounts list.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Restores a user's previous and links their appUserIDs to any user's also using those .\n */\n restorePurchases(): Promise<void>;\n\n /**\n * Started purchase process for the given product.\n *\n * @param options - The product to purchase\n * @param options.productIdentifier - The product identifier of the product you want to purchase.\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @param options.planIdentifier - Only Android, the identifier of the base plan you want to purchase from Google Play Console. REQUIRED for Android subscriptions, ignored on iOS.\n * @param options.quantity - Only iOS, the number of items you wish to purchase. Will use 1 by default.\n * @param options.appAccountToken - Optional identifier uniquely associated with the user's account in your app.\n * PLATFORM REQUIREMENTS:\n * - iOS: Must be a valid UUID format (StoreKit 2 requirement)\n * - Android: Can be any obfuscated string (max 64 chars), maps to ObfuscatedAccountId\n * SECURITY: DO NOT use PII like emails in cleartext - use UUID or hashed value.\n * RECOMMENDED: Use UUID v5 with deterministic generation for cross-platform compatibility.\n */\n purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n appAccountToken?: string;\n }): Promise<Transaction>;\n\n /**\n * Gets the product info associated with a list of product identifiers.\n *\n * @param options - The product identifiers you wish to retrieve information for\n * @param options.productIdentifiers - Array of product identifiers\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProducts(options: { productIdentifiers: string[]; productType?: PURCHASE_TYPE }): Promise<{ products: Product[] }>;\n\n /**\n * Gets the product info for a single product identifier.\n *\n * @param options - The product identifier you wish to retrieve information for\n * @param options.productIdentifier - The product identifier\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProduct(options: { productIdentifier: string; productType?: PURCHASE_TYPE }): Promise<{ product: Product }>;\n\n /**\n * Check if billing is supported for the current device.\n *\n *\n */\n isBillingSupported(): Promise<{ isBillingSupported: boolean }>;\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n /**\n * Gets all the user's purchases (both in-app purchases and subscriptions).\n * This method queries the platform's purchase history for the current user.\n *\n * @param options - Optional parameters for filtering purchases\n * @param options.productType - Only Android, filter by product type (inapp or subs). If not specified, returns both types.\n * @param options.appAccountToken - Optional filter to restrict results to purchases that used the provided account token.\n * Must be the same identifier used during purchase (UUID format for iOS, any obfuscated string for Android).\n * iOS: UUID format required. Android: Maps to ObfuscatedAccountId.\n * @returns {Promise<{ purchases: Transaction[] }>} Promise that resolves with array of user's purchases\n * @throws An error if the purchase query fails\n * @since 7.2.0\n */\n getPurchases(options?: {\n productType?: PURCHASE_TYPE;\n appAccountToken?: string;\n }): Promise<{ purchases: Transaction[] }>;\n\n /**\n * Opens the platform's native subscription management page.\n * This allows users to view, modify, or cancel their subscriptions.\n *\n * - iOS: Opens the App Store subscription management page for the current app\n * - Android: Opens the Google Play subscription management page\n *\n * @returns {Promise<void>} Promise that resolves when the management page is opened\n * @throws An error if the subscription management page cannot be opened\n * @since 7.10.0\n */\n manageSubscriptions(): Promise<void>;\n\n /**\n * Listen for StoreKit transaction updates delivered by Apple's Transaction.updates.\n * Fires on app launch if there are unfinished transactions, and for any updates afterward.\n * iOS only.\n */\n addListener(\n eventName: 'transactionUpdated',\n listenerFunc: (transaction: Transaction) => void,\n ): Promise<PluginListenerHandle>;\n\n /** Remove all registered listeners */\n removeAllListeners(): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,qFAAoB,CAAA;IACpB,iEAAU,CAAA;IACV,uEAAa,CAAA;IACb,iEAAU,CAAA;IACV,iEAAU,CAAA;IACV,qEAAY,CAAA;AACd,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,MAAM,CAAN,IAAY,aAUX;AAVD,WAAY,aAAa;IACvB;;OAEG;IACH,gCAAe,CAAA;IAEf;;OAEG;IACH,8BAAa,CAAA;AACf,CAAC,EAVW,aAAa,KAAb,aAAa,QAUxB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAyBX;AAzBD,WAAY,eAAe;IACzB;;OAEG;IACH,uEAAa,CAAA;IAEb;;OAEG;IACH,qFAAoB,CAAA;IAEpB;;OAEG;IACH,iFAAkB,CAAA;IAElB;;OAEG;IACH,mFAAmB,CAAA;IAEnB;;OAEG;IACH,+FAAyB,CAAA;AAC3B,CAAC,EAzBW,eAAe,KAAf,eAAe,QAyB1B;AACD,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,qIAAiD,CAAA;IAEjD;;;OAGG;IACH,qGAAiC,CAAA;IAEjC;;;;OAIG;IACH,iHAAuC,CAAA;IAEvC;;;OAGG;IACH,iGAA+B,CAAA;IAE/B;;;OAGG;IACH,2DAAY,CAAA;AACd,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAED,MAAM,CAAN,IAAY,YA6CX;AA7CD,WAAY,YAAY;IACtB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,qCAAqB,CAAA;IAErB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,2CAA2B,CAAA;IAE3B;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EA7CW,YAAY,KAAZ,YAAY,QA6CvB;AAED,MAAM,CAAN,IAAY,wBAaX;AAbD,WAAY,wBAAwB;IAClC;;OAEG;IACH,+HAAoC,CAAA;IACpC;;OAEG;IACH,qIAAmC,CAAA;IACnC;;OAEG;IACH,iIAAiC,CAAA;AACnC,CAAC,EAbW,wBAAwB,KAAxB,wBAAwB,QAanC","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport enum ATTRIBUTION_NETWORK {\n APPLE_SEARCH_ADS = 0,\n ADJUST = 1,\n APPSFLYER = 2,\n BRANCH = 3,\n TENJIN = 4,\n FACEBOOK = 5,\n}\n\nexport enum PURCHASE_TYPE {\n /**\n * A type of SKU for in-app products.\n */\n INAPP = 'inapp',\n\n /**\n * A type of SKU for subscriptions.\n */\n SUBS = 'subs',\n}\n\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport enum BILLING_FEATURE {\n /**\n * Purchase/query for subscriptions.\n */\n SUBSCRIPTIONS,\n\n /**\n * Subscriptions update/replace.\n */\n SUBSCRIPTIONS_UPDATE,\n\n /**\n * Purchase/query for in-app items on VR.\n */\n IN_APP_ITEMS_ON_VR,\n\n /**\n * Purchase/query for subscriptions on VR.\n */\n SUBSCRIPTIONS_ON_VR,\n\n /**\n * Launch a price change confirmation flow.\n */\n PRICE_CHANGE_CONFIRMATION,\n}\nexport enum PRORATION_MODE {\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n IMMEDIATE_WITHOUT_PRORATION = 3,\n\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n DEFERRED = 4,\n}\n\nexport enum PACKAGE_TYPE {\n /**\n * A package that was defined with a custom identifier.\n */\n UNKNOWN = 'UNKNOWN',\n\n /**\n * A package that was defined with a custom identifier.\n */\n CUSTOM = 'CUSTOM',\n\n /**\n * A package configured with the predefined lifetime identifier.\n */\n LIFETIME = 'LIFETIME',\n\n /**\n * A package configured with the predefined annual identifier.\n */\n ANNUAL = 'ANNUAL',\n\n /**\n * A package configured with the predefined six month identifier.\n */\n SIX_MONTH = 'SIX_MONTH',\n\n /**\n * A package configured with the predefined three month identifier.\n */\n THREE_MONTH = 'THREE_MONTH',\n\n /**\n * A package configured with the predefined two month identifier.\n */\n TWO_MONTH = 'TWO_MONTH',\n\n /**\n * A package configured with the predefined monthly identifier.\n */\n MONTHLY = 'MONTHLY',\n\n /**\n * A package configured with the predefined weekly identifier.\n */\n WEEKLY = 'WEEKLY',\n}\n\nexport enum INTRO_ELIGIBILITY_STATUS {\n /**\n * doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_INELIGIBLE,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE,\n}\n\nexport interface Transaction {\n /**\n * Unique identifier for the transaction.\n *\n * @since 1.0.0\n * @platform ios Numeric string (e.g., \"2000001043762129\")\n * @platform android Alphanumeric string (e.g., \"GPA.1234-5678-9012-34567\")\n */\n readonly transactionId: string;\n /**\n * Receipt data for validation (base64 encoded StoreKit receipt).\n *\n * Send this to your backend for server-side validation with Apple's receipt verification API.\n * The receipt remains available even after refund - server validation is required to detect refunded transactions.\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Not available (use purchaseToken instead)\n */\n readonly receipt?: string;\n /**\n * An optional obfuscated identifier that uniquely associates the transaction with a user account in your app.\n *\n * PURPOSE:\n * - Fraud detection: Helps platforms detect irregular activity (e.g., many devices purchasing on the same account)\n * - User linking: Links purchases to in-game characters, avatars, or in-app profiles\n *\n * PLATFORM DIFFERENCES:\n * - iOS: Must be a valid UUID format (e.g., \"550e8400-e29b-41d4-a716-446655440000\")\n * Apple's StoreKit 2 requires UUID format for the appAccountToken parameter\n * - Android: Can be any obfuscated string (max 64 chars), maps to Google Play's ObfuscatedAccountId\n * Google recommends using encryption or one-way hash\n *\n * SECURITY REQUIREMENTS (especially for Android):\n * - DO NOT store Personally Identifiable Information (PII) like emails in cleartext\n * - Use encryption or a one-way hash to generate an obfuscated identifier\n * - Maximum length: 64 characters (both platforms)\n * - Storing PII in cleartext will result in purchases being blocked by Google Play\n *\n * IMPLEMENTATION EXAMPLE:\n * ```typescript\n * // For iOS: Generate a deterministic UUID from user ID\n * import { v5 as uuidv5 } from 'uuid';\n * const NAMESPACE = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; // Your app's namespace UUID\n * const appAccountToken = uuidv5(userId, NAMESPACE);\n *\n * // For Android: Can also use UUID or any hashed value\n * // The same UUID approach works for both platforms\n * ```\n */\n readonly appAccountToken?: string | null;\n /**\n * Product identifier associated with the transaction.\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Always present\n */\n readonly productIdentifier: string;\n /**\n * Purchase date of the transaction in ISO 8601 format.\n *\n * @since 1.0.0\n * @example \"2025-10-28T06:03:19Z\"\n * @platform ios Always present\n * @platform android Always present\n */\n readonly purchaseDate: string;\n /**\n * Original purchase date of the transaction in ISO 8601 format.\n *\n * For subscription renewals, this shows the date of the original subscription purchase,\n * while purchaseDate shows the date of the current renewal.\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions only\n * @platform android Not available\n */\n readonly originalPurchaseDate?: string;\n /**\n * Expiration date of the transaction in ISO 8601 format.\n *\n * Check this date to determine if a subscription is still valid.\n * Compare with current date: if expirationDate > now, subscription is active.\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions only\n * @platform android Not available (query Google Play Developer API instead)\n */\n readonly expirationDate?: string;\n /**\n * Whether the subscription is still active/valid.\n *\n * For iOS subscriptions, check if isActive === true to verify an active subscription.\n * For expired or refunded iOS subscriptions, this will be false.\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions only (true if expiration date is in the future)\n * @platform android Not available (check purchaseState === \"1\" instead)\n */\n readonly isActive?: boolean;\n /**\n * Whether the subscription will be cancelled at the end of the billing cycle.\n *\n * - `true`: User has cancelled but subscription remains active until expiration\n * - `false`: Subscription will auto-renew\n * - `null`: Status unknown or not available\n *\n * @since 1.0.0\n * @default null\n * @platform ios Present for subscriptions only (boolean or null)\n * @platform android Always null (use Google Play Developer API for cancellation status)\n */\n readonly willCancel: boolean | null;\n /**\n * Purchase state of the transaction (numeric string value).\n *\n * **Android Values:**\n * - `\"1\"`: Purchase completed and valid (PURCHASED state)\n * - `\"0\"`: Payment pending (PENDING state, e.g., cash payment processing)\n * - Other numeric values: Various other states\n *\n * Always check `purchaseState === \"1\"` on Android to verify a valid purchase.\n * Refunded purchases typically disappear from getPurchases() rather than showing a different state.\n *\n * @since 1.0.0\n * @platform ios Not available (use isActive for subscriptions or receipt validation for IAP)\n * @platform android Always present\n */\n readonly purchaseState?: string;\n /**\n * Order ID associated with the transaction.\n *\n * Use this for server-side verification on Android. This is the Google Play order ID.\n *\n * @since 1.0.0\n * @example \"GPA.1234-5678-9012-34567\"\n * @platform ios Not available\n * @platform android Always present\n */\n readonly orderId?: string;\n /**\n * Purchase token associated with the transaction.\n *\n * Send this to your backend for server-side validation with Google Play Developer API.\n * This is the Android equivalent of iOS's receipt field.\n *\n * @since 1.0.0\n * @platform ios Not available (use receipt instead)\n * @platform android Always present\n */\n readonly purchaseToken?: string;\n /**\n * Whether the purchase has been acknowledged.\n *\n * Purchases must be acknowledged within 3 days or they will be refunded.\n * This plugin automatically acknowledges purchases.\n *\n * @since 1.0.0\n * @platform ios Not available\n * @platform android Always present (should be true after successful purchase)\n */\n readonly isAcknowledged?: boolean;\n /**\n * Quantity purchased.\n *\n * @since 1.0.0\n * @default 1\n * @platform ios 1 or higher (as specified in purchaseProduct call)\n * @platform android Always 1 (Google Play doesn't support quantity > 1)\n */\n readonly quantity?: number;\n /**\n * Product type.\n *\n * - `\"inapp\"`: One-time in-app purchase\n * - `\"subs\"`: Subscription\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Always present\n */\n readonly productType?: string;\n /**\n * Whether the transaction is in a trial period.\n *\n * - `true`: Currently in free trial period\n * - `false`: Not in trial period\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions with trial offers\n * @platform android Present for subscriptions with trial offers\n */\n readonly isTrialPeriod?: boolean;\n /**\n * Whether the transaction is in an introductory price period.\n *\n * Introductory pricing is a discounted rate, different from a free trial.\n *\n * - `true`: Currently using introductory pricing\n * - `false`: Not in intro period\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions with intro pricing\n * @platform android Present for subscriptions with intro pricing\n */\n readonly isInIntroPricePeriod?: boolean;\n /**\n * Whether the transaction is in a grace period.\n *\n * Grace period allows users to fix payment issues while maintaining access.\n * You typically want to continue providing access during this time.\n *\n * - `true`: Subscription payment failed but user still has access\n * - `false`: Not in grace period\n *\n * @since 1.0.0\n * @platform ios Present for subscriptions in grace period\n * @platform android Present for subscriptions in grace period\n */\n readonly isInGracePeriod?: boolean;\n}\n\nexport interface SubscriptionPeriod {\n /**\n * The Subscription Period number of unit.\n */\n readonly numberOfUnits: number;\n /**\n * The Subscription Period unit.\n */\n readonly unit: number;\n}\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n */\n readonly type: number;\n /**\n * The Product discount price.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * The Product discount currency symbol.\n */\n readonly currencySymbol: string;\n /**\n * The Product discount currency code.\n */\n readonly currencyCode: string;\n /**\n * The Product discount paymentMode.\n */\n readonly paymentMode: number;\n /**\n * The Product discount number Of Periods.\n */\n readonly numberOfPeriods: number;\n /**\n * The Product discount subscription period.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n}\nexport interface Product {\n /**\n * Product Id.\n */\n readonly identifier: string;\n /**\n * Description of the product.\n */\n readonly description: string;\n /**\n * Title of the product.\n */\n readonly title: string;\n /**\n * Price of the product in the local currency.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * Currency code for price and original price.\n */\n readonly currencyCode: string;\n /**\n * Currency symbol for price and original price.\n */\n readonly currencySymbol: string;\n /**\n * Boolean indicating if the product is sharable with family\n */\n readonly isFamilyShareable: boolean;\n /**\n * Group identifier for the product.\n */\n readonly subscriptionGroupIdentifier: string;\n /**\n * The Product subcription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * The Product discounts list.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Restores a user's previous and links their appUserIDs to any user's also using those .\n */\n restorePurchases(): Promise<void>;\n\n /**\n * Started purchase process for the given product.\n *\n * @param options - The product to purchase\n * @param options.productIdentifier - The product identifier of the product you want to purchase.\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @param options.planIdentifier - Only Android, the identifier of the base plan you want to purchase from Google Play Console. REQUIRED for Android subscriptions, ignored on iOS.\n * @param options.quantity - Only iOS, the number of items you wish to purchase. Will use 1 by default.\n * @param options.appAccountToken - Optional identifier uniquely associated with the user's account in your app.\n * PLATFORM REQUIREMENTS:\n * - iOS: Must be a valid UUID format (StoreKit 2 requirement)\n * - Android: Can be any obfuscated string (max 64 chars), maps to ObfuscatedAccountId\n * SECURITY: DO NOT use PII like emails in cleartext - use UUID or hashed value.\n * RECOMMENDED: Use UUID v5 with deterministic generation for cross-platform compatibility.\n * @param options.isConsumable - Only Android, when true the purchase token is consumed after granting entitlement (for consumable in-app items). Defaults to false.\n */\n purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n appAccountToken?: string;\n isConsumable?: boolean;\n }): Promise<Transaction>;\n\n /**\n * Gets the product info associated with a list of product identifiers.\n *\n * @param options - The product identifiers you wish to retrieve information for\n * @param options.productIdentifiers - Array of product identifiers\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProducts(options: { productIdentifiers: string[]; productType?: PURCHASE_TYPE }): Promise<{ products: Product[] }>;\n\n /**\n * Gets the product info for a single product identifier.\n *\n * @param options - The product identifier you wish to retrieve information for\n * @param options.productIdentifier - The product identifier\n * @param options.productType - Only Android, the type of product, can be inapp or subs. Will use inapp by default.\n * @returns - The requested product info\n */\n getProduct(options: { productIdentifier: string; productType?: PURCHASE_TYPE }): Promise<{ product: Product }>;\n\n /**\n * Check if billing is supported for the current device.\n *\n *\n */\n isBillingSupported(): Promise<{ isBillingSupported: boolean }>;\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n /**\n * Gets all the user's purchases (both in-app purchases and subscriptions).\n * This method queries the platform's purchase history for the current user.\n *\n * @param options - Optional parameters for filtering purchases\n * @param options.productType - Only Android, filter by product type (inapp or subs). If not specified, returns both types.\n * @param options.appAccountToken - Optional filter to restrict results to purchases that used the provided account token.\n * Must be the same identifier used during purchase (UUID format for iOS, any obfuscated string for Android).\n * iOS: UUID format required. Android: Maps to ObfuscatedAccountId.\n * @returns {Promise<{ purchases: Transaction[] }>} Promise that resolves with array of user's purchases\n * @throws An error if the purchase query fails\n * @since 7.2.0\n */\n getPurchases(options?: {\n productType?: PURCHASE_TYPE;\n appAccountToken?: string;\n }): Promise<{ purchases: Transaction[] }>;\n\n /**\n * Opens the platform's native subscription management page.\n * This allows users to view, modify, or cancel their subscriptions.\n *\n * - iOS: Opens the App Store subscription management page for the current app\n * - Android: Opens the Google Play subscription management page\n *\n * @returns {Promise<void>} Promise that resolves when the management page is opened\n * @throws An error if the subscription management page cannot be opened\n * @since 7.10.0\n */\n manageSubscriptions(): Promise<void>;\n\n /**\n * Listen for StoreKit transaction updates delivered by Apple's Transaction.updates.\n * Fires on app launch if there are unfinished transactions, and for any updates afterward.\n * iOS only.\n */\n addListener(\n eventName: 'transactionUpdated',\n listenerFunc: (transaction: Transaction) => void,\n ): Promise<PluginListenerHandle>;\n\n /** Remove all registered listeners */\n removeAllListeners(): Promise<void>;\n}\n"]}
@@ -21,7 +21,7 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
21
21
  CAPPluginMethod(name: "manageSubscriptions", returnType: CAPPluginReturnPromise)
22
22
  ]
23
23
 
24
- private let pluginVersion: String = "7.12.7"
24
+ private let pluginVersion: String = "7.13.0"
25
25
  private var transactionUpdatesTask: Task<Void, Never>?
26
26
 
27
27
  @objc func getPluginVersion(_ call: CAPPluginCall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-purchases",
3
- "version": "7.12.7",
3
+ "version": "7.13.0",
4
4
  "description": "In-app Subscriptions Made Easy",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",