@capgo/native-purchases 8.9.6 → 8.9.7

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
@@ -1738,9 +1738,13 @@ Set `autoFinishTransactions: false` in `capacitor.config` under `plugins.NativeP
1738
1738
  2. Validate on your backend.
1739
1739
  3. Call `finishTransaction({ transactionId })` or `acknowledgePurchase({ purchaseToken: transactionId })`. Repeated calls on an already finished transaction succeed.
1740
1740
 
1741
+ **Unverified transactions**
1742
+
1743
+ StoreKit re-delivers an unverified transaction on every launch until it is finished. Call `getUnfinishedTransactions({ includeUnverified: true })` to list them (each has `verificationError` set), or use the ID from `transactionVerificationFailed`, then call `finishTransaction({ transactionId, allowUnverified: true })` to clear it. Do not grant entitlements from an unverified transaction. Android accepts the same calls, but Play Billing has no client-side unverified state, so both options have no effect there.
1744
+
1741
1745
  **Android**
1742
1746
 
1743
- After validation when automatic acknowledgment is off (for example `configure({ autoFinishTransactions: false })` or `purchaseProduct({ autoAcknowledgePurchases: false })`), call `consumePurchase({ purchaseToken })` for consumable in-app products (acknowledges and consumes), or `acknowledgePurchase({ purchaseToken })` for non-consumables and subscriptions. `finishTransaction()` is iOS-only and rejects on Android. With `autoFinishTransactions: false`, `restorePurchases()` does not auto-acknowledge; use `getUnfinishedTransactions()` to list unacknowledged purchases in the `PURCHASED` state (`isAcknowledged === false`).
1747
+ After validation when automatic acknowledgment is off (for example `configure({ autoFinishTransactions: false })` or `purchaseProduct({ autoAcknowledgePurchases: false })`), call `consumePurchase({ purchaseToken })` for consumable in-app products (acknowledges and consumes), or `acknowledgePurchase({ purchaseToken })` for non-consumables and subscriptions. `finishTransaction({ transactionId })` also acknowledges on Android, where `transactionId` is the purchase token. With `autoFinishTransactions: false`, `restorePurchases()` does not auto-acknowledge; use `getUnfinishedTransactions()` to list unacknowledged purchases in the `PURCHASED` state (`isAcknowledged === false`).
1744
1748
 
1745
1749
  ## API
1746
1750
 
@@ -1760,7 +1764,7 @@ After validation when automatic acknowledgment is off (for example `configure({
1760
1764
  * [`presentOfferCodeRedeemSheet()`](#presentoffercoderedeemsheet)
1761
1765
  * [`acknowledgePurchase(...)`](#acknowledgepurchase)
1762
1766
  * [`finishTransaction(...)`](#finishtransaction)
1763
- * [`getUnfinishedTransactions()`](#getunfinishedtransactions)
1767
+ * [`getUnfinishedTransactions(...)`](#getunfinishedtransactions)
1764
1768
  * [`consumePurchase(...)`](#consumepurchase)
1765
1769
  * [`getStorefront()`](#getstorefront)
1766
1770
  * [`addListener('transactionUpdated', ...)`](#addlistenertransactionupdated-)
@@ -2065,7 +2069,7 @@ await NativePurchases.acknowledgePurchase({
2065
2069
  ### finishTransaction(...)
2066
2070
 
2067
2071
  ```typescript
2068
- finishTransaction(options: { transactionId: string; }) => Promise<void>
2072
+ finishTransaction(options: { transactionId: string; allowUnverified?: boolean; }) => Promise<void>
2069
2073
  ```
2070
2074
 
2071
2075
  Finish a StoreKit 2 transaction on iOS after you validate delivery on your backend.
@@ -2073,22 +2077,26 @@ Finish a StoreKit 2 transaction on iOS after you validate delivery on your backe
2073
2077
  Equivalent to `acknowledgePurchase({ purchaseToken: transactionId })` on iOS. Safe to call more
2074
2078
  than once; finishing an already finished transaction resolves successfully.
2075
2079
 
2076
- **Android**: Google Play uses purchase acknowledgment, not StoreKit finishing. Call
2077
- `acknowledgePurchase({ purchaseToken })` instead. This method rejects on Android.
2080
+ A transaction StoreKit could not verify is rejected unless `allowUnverified` is `true`. Finishing
2081
+ one only removes it from the queue so StoreKit stops re-delivering it; never grant entitlements from it.
2082
+
2083
+ **Android**: Acknowledges the purchase, using `transactionId` as the purchase token. Use
2084
+ `consumePurchase({ purchaseToken })` instead for consumables that must be purchasable again.
2085
+ `allowUnverified` has no effect because Play Billing has no client-side unverified state.
2078
2086
 
2079
- | Param | Type |
2080
- | ------------- | --------------------------------------- |
2081
- | **`options`** | <code>{ transactionId: string; }</code> |
2087
+ | Param | Type |
2088
+ | ------------- | ------------------------------------------------------------------ |
2089
+ | **`options`** | <code>{ transactionId: string; allowUnverified?: boolean; }</code> |
2082
2090
 
2083
2091
  **Since:** 8.9.0
2084
2092
 
2085
2093
  --------------------
2086
2094
 
2087
2095
 
2088
- ### getUnfinishedTransactions()
2096
+ ### getUnfinishedTransactions(...)
2089
2097
 
2090
2098
  ```typescript
2091
- getUnfinishedTransactions() => Promise<{ transactions: Transaction[]; }>
2099
+ getUnfinishedTransactions(options?: { includeUnverified?: boolean | undefined; } | undefined) => Promise<{ transactions: Transaction[]; }>
2092
2100
  ```
2093
2101
 
2094
2102
  Returns transactions that still need finishing on iOS, or unacknowledged purchases on Android.
@@ -2100,6 +2108,15 @@ in-app products (acknowledges and consumes). Call `acknowledgePurchase({ purchas
2100
2108
  non-consumables and subscriptions. Includes only purchases in the `PURCHASED` state that are not
2101
2109
  yet acknowledged. Pending purchases are excluded until Google Play marks them purchased.
2102
2110
 
2111
+ **Unverified transactions:** With `includeUnverified: true`, iOS also returns transactions StoreKit
2112
+ could not verify, each with `verificationError` set. Do not grant entitlements from those; pass them
2113
+ to `finishTransaction({ transactionId, allowUnverified: true })` to clear them. Android has no
2114
+ client-side unverified state, so the option does not change its results.
2115
+
2116
+ | Param | Type |
2117
+ | ------------- | --------------------------------------------- |
2118
+ | **`options`** | <code>{ includeUnverified?: boolean; }</code> |
2119
+
2103
2120
  **Returns:** <code>Promise&lt;{ transactions: Transaction[]; }&gt;</code>
2104
2121
 
2105
2122
  **Since:** 8.9.0
@@ -2285,6 +2302,7 @@ which is useful for determining if users are entitled to features from earlier b
2285
2302
  | **`isInIntroPricePeriod`** | <code>boolean</code> | Whether the transaction is in an introductory price period. Introductory pricing is a discounted rate, different from a free trial. - `true`: Currently using introductory pricing - `false`: Not in intro period | | 1.0.0 |
2286
2303
  | **`isInGracePeriod`** | <code>boolean</code> | Whether the transaction is in a grace period. Grace period allows users to fix payment issues while maintaining access. You typically want to continue providing access during this time. - `true`: Subscription payment failed but user still has access - `false`: Not in grace period | | 1.0.0 |
2287
2304
  | **`needsFinish`** | <code>boolean</code> | Whether the StoreKit transaction still needs to be finished with `finishTransaction()`. Present when the transaction is returned from `getUnfinishedTransactions()` or from `transactionUpdated` while `autoFinishTransactions` is `false`. | | 8.9.0 |
2305
+ | **`verificationError`** | <code>string</code> | Why StoreKit could not verify this transaction. Treat the transaction as untrusted and do not grant entitlements from it. Present only on unverified entries returned by `getUnfinishedTransactions({ includeUnverified: true })`. | | 8.10.0 |
2288
2306
 
2289
2307
 
2290
2308
  #### TransactionCommitmentInfo
@@ -43,7 +43,7 @@ import org.json.JSONArray;
43
43
  @CapacitorPlugin(name = "NativePurchases")
44
44
  public class NativePurchasesPlugin extends Plugin {
45
45
 
46
- private final String pluginVersion = "8.9.6";
46
+ private final String pluginVersion = "8.9.7";
47
47
  public static final String TAG = "NativePurchases";
48
48
  private static final int BILLING_CONNECTION_MAX_ATTEMPTS = 2;
49
49
  private static final long BILLING_SETUP_TIMEOUT_SECONDS = 5;
@@ -67,11 +67,19 @@ public class NativePurchasesPlugin extends Plugin {
67
67
  call.resolve();
68
68
  }
69
69
 
70
+ /**
71
+ * Acknowledges the purchase whose token is passed as {@code transactionId}, matching finishTransaction on iOS.
72
+ */
70
73
  @PluginMethod
71
74
  public void finishTransaction(PluginCall call) {
72
- call.reject(
73
- "finishTransaction is for StoreKit 2 on iOS. On Android, call acknowledgePurchase({ purchaseToken }) to acknowledge Google Play purchases."
74
- );
75
+ String transactionId = call.getString("transactionId");
76
+ if (transactionId == null || transactionId.isEmpty()) {
77
+ call.reject("transactionId is required");
78
+ return;
79
+ }
80
+ // Android transaction IDs are purchase tokens, and Play Billing has no client-side unverified state.
81
+ call.getData().put("purchaseToken", transactionId);
82
+ acknowledgePurchase(call);
75
83
  }
76
84
 
77
85
  @PluginMethod
package/dist/docs.json CHANGED
@@ -440,19 +440,23 @@
440
440
  },
441
441
  {
442
442
  "name": "finishTransaction",
443
- "signature": "(options: { transactionId: string; }) => Promise<void>",
443
+ "signature": "(options: { transactionId: string; allowUnverified?: boolean; }) => Promise<void>",
444
444
  "parameters": [
445
445
  {
446
446
  "name": "options",
447
447
  "docs": "",
448
- "type": "{ transactionId: string; }"
448
+ "type": "{ transactionId: string; allowUnverified?: boolean | undefined; }"
449
449
  }
450
450
  ],
451
451
  "returns": "Promise<void>",
452
452
  "tags": [
453
453
  {
454
454
  "name": "param",
455
- "text": "options.transactionId StoreKit transaction ID from the `Transaction` object (numeric string)."
455
+ "text": "options.transactionId Transaction ID from the `Transaction` object (numeric string on iOS, purchase token on Android)."
456
+ },
457
+ {
458
+ "name": "param",
459
+ "text": "options.allowUnverified Finish the transaction even if StoreKit could not verify it. Defaults to `false`."
456
460
  },
457
461
  {
458
462
  "name": "since",
@@ -464,25 +468,35 @@
464
468
  },
465
469
  {
466
470
  "name": "platform",
467
- "text": "android Rejects; use `acknowledgePurchase()`"
471
+ "text": "android Acknowledges the purchase with Google Play"
468
472
  }
469
473
  ],
470
- "docs": "Finish a StoreKit 2 transaction on iOS after you validate delivery on your backend.\n\nEquivalent to `acknowledgePurchase({ purchaseToken: transactionId })` on iOS. Safe to call more\nthan once; finishing an already finished transaction resolves successfully.\n\n**Android**: Google Play uses purchase acknowledgment, not StoreKit finishing. Call\n`acknowledgePurchase({ purchaseToken })` instead. This method rejects on Android.",
474
+ "docs": "Finish a StoreKit 2 transaction on iOS after you validate delivery on your backend.\n\nEquivalent to `acknowledgePurchase({ purchaseToken: transactionId })` on iOS. Safe to call more\nthan once; finishing an already finished transaction resolves successfully.\n\nA transaction StoreKit could not verify is rejected unless `allowUnverified` is `true`. Finishing\none only removes it from the queue so StoreKit stops re-delivering it; never grant entitlements from it.\n\n**Android**: Acknowledges the purchase, using `transactionId` as the purchase token. Use\n`consumePurchase({ purchaseToken })` instead for consumables that must be purchasable again.\n`allowUnverified` has no effect because Play Billing has no client-side unverified state.",
471
475
  "complexTypes": [],
472
476
  "slug": "finishtransaction"
473
477
  },
474
478
  {
475
479
  "name": "getUnfinishedTransactions",
476
- "signature": "() => Promise<{ transactions: Transaction[]; }>",
477
- "parameters": [],
480
+ "signature": "(options?: { includeUnverified?: boolean | undefined; } | undefined) => Promise<{ transactions: Transaction[]; }>",
481
+ "parameters": [
482
+ {
483
+ "name": "options",
484
+ "docs": "",
485
+ "type": "{ includeUnverified?: boolean | undefined; } | undefined"
486
+ }
487
+ ],
478
488
  "returns": "Promise<{ transactions: Transaction[]; }>",
479
489
  "tags": [
490
+ {
491
+ "name": "param",
492
+ "text": "options.includeUnverified Also return unfinished transactions StoreKit could not verify. Defaults to `false`."
493
+ },
480
494
  {
481
495
  "name": "since",
482
496
  "text": "8.9.0"
483
497
  }
484
498
  ],
485
- "docs": "Returns transactions that still need finishing on iOS, or unacknowledged purchases on Android.\n\nUse on app launch when `autoFinishTransactions` is `false` to recover work after a restart.\n\n**Android recovery:** After validation, call `consumePurchase({ purchaseToken })` for consumable\nin-app products (acknowledges and consumes). Call `acknowledgePurchase({ purchaseToken })` for\nnon-consumables and subscriptions. Includes only purchases in the `PURCHASED` state that are not\nyet acknowledged. Pending purchases are excluded until Google Play marks them purchased.",
499
+ "docs": "Returns transactions that still need finishing on iOS, or unacknowledged purchases on Android.\n\nUse on app launch when `autoFinishTransactions` is `false` to recover work after a restart.\n\n**Android recovery:** After validation, call `consumePurchase({ purchaseToken })` for consumable\nin-app products (acknowledges and consumes). Call `acknowledgePurchase({ purchaseToken })` for\nnon-consumables and subscriptions. Includes only purchases in the `PURCHASED` state that are not\nyet acknowledged. Pending purchases are excluded until Google Play marks them purchased.\n\n**Unverified transactions:** With `includeUnverified: true`, iOS also returns transactions StoreKit\ncould not verify, each with `verificationError` set. Do not grant entitlements from those; pass them\nto `finishTransaction({ transactionId, allowUnverified: true })` to clear them. Android has no\nclient-side unverified state, so the option does not change its results.",
486
500
  "complexTypes": [
487
501
  "Transaction"
488
502
  ],
@@ -1419,6 +1433,26 @@
1419
1433
  "docs": "Whether the StoreKit transaction still needs to be finished with `finishTransaction()`.\n\nPresent when the transaction is returned from `getUnfinishedTransactions()` or from\n`transactionUpdated` while `autoFinishTransactions` is `false`.",
1420
1434
  "complexTypes": [],
1421
1435
  "type": "boolean | undefined"
1436
+ },
1437
+ {
1438
+ "name": "verificationError",
1439
+ "tags": [
1440
+ {
1441
+ "text": "8.10.0",
1442
+ "name": "since"
1443
+ },
1444
+ {
1445
+ "text": "ios Present when StoreKit reports the transaction as unverified",
1446
+ "name": "platform"
1447
+ },
1448
+ {
1449
+ "text": "android Not available (Play Billing has no client-side unverified state)",
1450
+ "name": "platform"
1451
+ }
1452
+ ],
1453
+ "docs": "Why StoreKit could not verify this transaction. Treat the transaction as untrusted and do not\ngrant entitlements from it.\n\nPresent only on unverified entries returned by `getUnfinishedTransactions({ includeUnverified: true })`.",
1454
+ "complexTypes": [],
1455
+ "type": "string | undefined"
1422
1456
  }
1423
1457
  ]
1424
1458
  },
@@ -562,6 +562,17 @@ export interface Transaction {
562
562
  * @platform android Not available (use `isAcknowledged === false` instead)
563
563
  */
564
564
  readonly needsFinish?: boolean;
565
+ /**
566
+ * Why StoreKit could not verify this transaction. Treat the transaction as untrusted and do not
567
+ * grant entitlements from it.
568
+ *
569
+ * Present only on unverified entries returned by `getUnfinishedTransactions({ includeUnverified: true })`.
570
+ *
571
+ * @since 8.10.0
572
+ * @platform ios Present when StoreKit reports the transaction as unverified
573
+ * @platform android Not available (Play Billing has no client-side unverified state)
574
+ */
575
+ readonly verificationError?: string;
565
576
  }
566
577
  export interface TransactionVerificationFailedEvent {
567
578
  /**
@@ -1333,16 +1344,22 @@ export interface NativePurchasesPlugin {
1333
1344
  * Equivalent to `acknowledgePurchase({ purchaseToken: transactionId })` on iOS. Safe to call more
1334
1345
  * than once; finishing an already finished transaction resolves successfully.
1335
1346
  *
1336
- * **Android**: Google Play uses purchase acknowledgment, not StoreKit finishing. Call
1337
- * `acknowledgePurchase({ purchaseToken })` instead. This method rejects on Android.
1347
+ * A transaction StoreKit could not verify is rejected unless `allowUnverified` is `true`. Finishing
1348
+ * one only removes it from the queue so StoreKit stops re-delivering it; never grant entitlements from it.
1338
1349
  *
1339
- * @param options.transactionId StoreKit transaction ID from the `Transaction` object (numeric string).
1350
+ * **Android**: Acknowledges the purchase, using `transactionId` as the purchase token. Use
1351
+ * `consumePurchase({ purchaseToken })` instead for consumables that must be purchasable again.
1352
+ * `allowUnverified` has no effect because Play Billing has no client-side unverified state.
1353
+ *
1354
+ * @param options.transactionId Transaction ID from the `Transaction` object (numeric string on iOS, purchase token on Android).
1355
+ * @param options.allowUnverified Finish the transaction even if StoreKit could not verify it. Defaults to `false`.
1340
1356
  * @since 8.9.0
1341
1357
  * @platform ios Finishes the transaction with StoreKit 2
1342
- * @platform android Rejects; use `acknowledgePurchase()`
1358
+ * @platform android Acknowledges the purchase with Google Play
1343
1359
  */
1344
1360
  finishTransaction(options: {
1345
1361
  transactionId: string;
1362
+ allowUnverified?: boolean;
1346
1363
  }): Promise<void>;
1347
1364
  /**
1348
1365
  * Returns transactions that still need finishing on iOS, or unacknowledged purchases on Android.
@@ -1354,9 +1371,17 @@ export interface NativePurchasesPlugin {
1354
1371
  * non-consumables and subscriptions. Includes only purchases in the `PURCHASED` state that are not
1355
1372
  * yet acknowledged. Pending purchases are excluded until Google Play marks them purchased.
1356
1373
  *
1374
+ * **Unverified transactions:** With `includeUnverified: true`, iOS also returns transactions StoreKit
1375
+ * could not verify, each with `verificationError` set. Do not grant entitlements from those; pass them
1376
+ * to `finishTransaction({ transactionId, allowUnverified: true })` to clear them. Android has no
1377
+ * client-side unverified state, so the option does not change its results.
1378
+ *
1379
+ * @param options.includeUnverified Also return unfinished transactions StoreKit could not verify. Defaults to `false`.
1357
1380
  * @since 8.9.0
1358
1381
  */
1359
- getUnfinishedTransactions(): Promise<{
1382
+ getUnfinishedTransactions(options?: {
1383
+ includeUnverified?: boolean;
1384
+ }): Promise<{
1360
1385
  transactions: Transaction[];
1361
1386
  }>;
1362
1387
  /**
@@ -1 +1 @@
1
- {"version":3,"file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vB;;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,qIAAuC,CAAA;IACvC;;OAEG;IACH,iIAAqC,CAAA;AACvC,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 = 1,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE = 2,\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 * **This is the full verified receipt payload from Apple StoreKit.**\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 * **For backend validation:**\n * - Use Apple's receipt verification API: https://buy.itunes.apple.com/verifyReceipt (production)\n * - Or sandbox: https://sandbox.itunes.apple.com/verifyReceipt\n * - This contains all transaction data needed for validation\n *\n * **Note:** Apple recommends migrating to App Store Server API v2 with `jwsRepresentation` for new implementations.\n * The legacy receipt verification API continues to work but may be deprecated in the future.\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Not available (use purchaseToken instead)\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({ ... });\n * if (transaction.receipt) {\n * // Send to your backend for validation\n * await fetch('/api/validate-receipt', {\n * method: 'POST',\n * body: JSON.stringify({ receipt: transaction.receipt })\n * });\n * }\n * ```\n */\n readonly receipt?: string;\n /**\n * StoreKit 2 JSON Web Signature (JWS) payload describing the verified transaction.\n *\n * **This is the full verified receipt in JWS format (StoreKit 2).**\n * Send this to your backend when using Apple's App Store Server API v2 instead of raw receipts.\n * Only available when the transaction originated from StoreKit 2 APIs (e.g. Transaction.updates).\n *\n * **For backend validation:**\n * - Use Apple's App Store Server API v2 to decode and verify the JWS\n * - This is the modern alternative to the legacy receipt format\n * - Contains signed transaction information from Apple\n *\n * @since 7.13.2\n * @platform ios Present for StoreKit 2 transactions (iOS 15+)\n * @platform android Not available\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({ ... });\n * if (transaction.jwsRepresentation) {\n * // Send to your backend for validation with App Store Server API v2\n * await fetch('/api/validate-jws', {\n * method: 'POST',\n * body: JSON.stringify({ jws: transaction.jwsRepresentation })\n * });\n * }\n * ```\n */\n readonly jwsRepresentation?: 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 * Indicates whether this transaction is the result of a subscription upgrade.\n *\n * Useful for understanding when StoreKit generated the transaction because\n * the customer moved from a lower tier to a higher tier plan.\n *\n * @since 7.13.2\n * @platform ios Present for auto-renewable subscriptions (iOS 15+)\n * @platform android Not available\n */\n readonly isUpgraded?: boolean;\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 * Date the transaction was revoked/refunded, in ISO 8601 format.\n *\n * Present when Apple revokes access due to an issue (e.g., refund or developer issue).\n *\n * @since 7.13.2\n * @platform ios Present for revoked transactions (iOS 15+)\n * @platform android Not available\n */\n readonly revocationDate?: string;\n /**\n * Reason why Apple revoked the transaction.\n *\n * Possible values:\n * - `\"developerIssue\"`: Developer-initiated refund or issue\n * - `\"other\"`: Apple-initiated (customer refund, billing problem, etc.)\n * - `\"unknown\"`: StoreKit didn't report a specific reason\n *\n * @since 7.13.2\n * @platform ios Present for revoked transactions (iOS 15+)\n * @platform android Not available\n */\n readonly revocationReason?: 'developerIssue' | 'other' | 'unknown';\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 * Current subscription state reported by StoreKit.\n *\n * Possible values:\n * - `\"subscribed\"`: Auto-renewing and in good standing\n * - `\"expired\"`: Lapsed with no access\n * - `\"revoked\"`: Access removed due to refund or issue\n * - `\"inGracePeriod\"`: Payment issue but still in grace access window\n * - `\"inBillingRetryPeriod\"`: StoreKit retrying failed billing\n * - `\"unknown\"`: StoreKit did not report a state\n *\n * @since 7.13.2\n * @platform ios Present for auto-renewable subscriptions (iOS 15+)\n * @platform android Not available\n */\n readonly subscriptionState?:\n | 'subscribed'\n | 'expired'\n | 'revoked'\n | 'inGracePeriod'\n | 'inBillingRetryPeriod'\n | 'unknown';\n /**\n * StoreKit billing plan type for auto-renewable subscriptions.\n *\n * - `\"upFront\"`: Standard subscription billing for the full billing period.\n * - `\"monthly\"`: Monthly billing with a 12-month commitment.\n * - `\"unknown\"`: StoreKit returned a future or unsupported value.\n *\n * @since 8.3.8\n * @platform ios Present for StoreKit transactions that include billing plan metadata.\n * @platform android Not available\n */\n readonly billingPlanType?: SubscriptionBillingPlanType;\n /**\n * Commitment metadata for monthly subscriptions with a 12-month commitment.\n *\n * Use `expirationDate` here only to display commitment progress. Continue using\n * the top-level `expirationDate` to decide whether the current billing period\n * grants entitlement access.\n *\n * @since 8.3.8\n * @platform ios Present for monthly commitment subscription transactions.\n * @platform android Not available\n */\n readonly commitmentInfo?: TransactionCommitmentInfo;\n /**\n * StoreKit renewal metadata for auto-renewable subscriptions.\n *\n * `willAutoRenew` here describes the next billing period. For monthly\n * commitment subscriptions, `commitmentInfo.willAutoRenew` describes whether\n * the next 12-month commitment renews after the current commitment ends.\n *\n * @since 8.3.8\n * @platform ios Present for verified subscription renewal info.\n * @platform android Not available\n */\n readonly renewalInfo?: SubscriptionRenewalInfo;\n /**\n * Currency code associated with StoreKit transaction pricing metadata.\n *\n * @since 8.3.8\n * @platform ios Present when StoreKit includes currency in the transaction payload.\n * @platform android Not available\n */\n readonly currencyCode?: string;\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 * **This is the full verified purchase token from Google Play.**\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 * **For backend validation:**\n * - Use Google Play Developer API v3 to verify the purchase\n * - API endpoint: androidpublisher.purchases.products.get() or purchases.subscriptions.get()\n * - This token contains all data needed for validation with Google servers\n * - Can also be used for subscription status checks and cancellation detection\n *\n * @since 1.0.0\n * @platform ios Not available (use receipt instead)\n * @platform android Always present\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({ ... });\n * if (transaction.purchaseToken) {\n * // Send to your backend for validation\n * await fetch('/api/validate-purchase', {\n * method: 'POST',\n * body: JSON.stringify({\n * purchaseToken: transaction.purchaseToken,\n * productId: transaction.productIdentifier\n * })\n * });\n * }\n * ```\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 * By default, this plugin automatically acknowledges purchases unless you set\n * `autoAcknowledgePurchases: false` in purchaseProduct().\n *\n * @since 1.0.0\n * @platform ios Not available\n * @platform android Always present (should be true after successful purchase or manual acknowledgment)\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 * Indicates how the user obtained access to the product.\n *\n * - `\"purchased\"`: The user purchased the product directly\n * - `\"familyShared\"`: The user has access through Family Sharing (another family member purchased it)\n *\n * This property is useful for:\n * - Detecting family sharing usage for analytics\n * - Implementing different features/limits for family-shared vs. directly purchased products\n * - Understanding your user acquisition channels\n *\n * @since 7.12.8\n * @platform ios Always present (iOS 15.0+, StoreKit 2)\n * @platform android Not available\n */\n readonly ownershipType?: 'purchased' | 'familyShared';\n /**\n * Indicates the server environment where the transaction was processed.\n *\n * - `\"Sandbox\"`: Transaction belongs to testing in the sandbox environment\n * - `\"Production\"`: Transaction belongs to a customer in the production environment\n * - `\"Xcode\"`: Transaction from StoreKit Testing in Xcode\n *\n * This property is useful for:\n * - Debugging and identifying test vs. production purchases\n * - Analytics and reporting (filtering out sandbox transactions)\n * - Server-side validation (knowing which Apple endpoint to use)\n * - Preventing test purchases from affecting production metrics\n *\n * @since 7.12.8\n * @platform ios Present on iOS 16.0+ only (not available on iOS 15)\n * @platform android Not available\n */\n readonly environment?: 'Sandbox' | 'Production' | 'Xcode';\n /**\n * Reason StoreKit generated the transaction.\n *\n * - `\"purchase\"`: Initial purchase that user made manually\n * - `\"renewal\"`: Automatically generated renewal for an auto-renewable subscription\n * - `\"unknown\"`: StoreKit did not return a reason\n *\n * @since 7.13.2\n * @platform ios Present on iOS 17.0+ (StoreKit 2 transactions)\n * @platform android Not available\n */\n readonly transactionReason?: 'purchase' | 'renewal' | 'unknown';\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 * Whether the StoreKit transaction still needs to be finished with `finishTransaction()`.\n *\n * Present when the transaction is returned from `getUnfinishedTransactions()` or from\n * `transactionUpdated` while `autoFinishTransactions` is `false`.\n *\n * @since 8.9.0\n * @platform ios Present when the transaction is unfinished in StoreKit 2\n * @platform android Not available (use `isAcknowledged === false` instead)\n */\n readonly needsFinish?: boolean;\n}\n\nexport interface TransactionVerificationFailedEvent {\n /**\n * Identifier of the transaction that failed verification.\n *\n * @since 7.13.2\n * @platform ios Present when StoreKit reports an unverified transaction\n * @platform android Not available\n */\n readonly transactionId: string;\n /**\n * Localized error message describing why verification failed.\n *\n * @since 7.13.2\n * @platform ios Always present\n * @platform android Not available\n */\n readonly error: string;\n}\n\n/**\n * Represents the App Transaction information from StoreKit 2.\n * This provides details about when the user originally downloaded or purchased the app,\n * which is useful for determining if users are entitled to features from earlier business models.\n *\n * @see https://developer.apple.com/documentation/storekit/supporting-business-model-changes-by-using-the-app-transaction\n * @since 7.16.0\n */\nexport interface AppTransaction {\n /**\n * The app version that the user originally purchased or downloaded.\n *\n * Use this to determine if users who originally downloaded an earlier version\n * should be entitled to features that were previously free or included.\n *\n * For iOS: This is the `CFBundleShortVersionString` (e.g., \"1.0.0\")\n * For Android: This is the `versionName` from Google Play (e.g., \"1.0.0\")\n *\n * @example \"1.0.0\"\n * @since 7.16.0\n * @platform ios Always present (iOS 16+)\n * @platform android Always present\n */\n readonly originalAppVersion: string;\n\n /**\n * The date when the user originally purchased or downloaded the app.\n * ISO 8601 format.\n *\n * @example \"2023-06-15T10:30:00Z\"\n * @since 7.16.0\n * @platform ios Always present (iOS 16+)\n * @platform android Always present\n */\n readonly originalPurchaseDate: string;\n\n /**\n * The bundle identifier of the app.\n *\n * @example \"com.example.myapp\"\n * @since 7.16.0\n * @platform ios Always present (iOS 16+)\n * @platform android Always present (package name)\n */\n readonly bundleId: string;\n\n /**\n * The current app version installed on the device.\n *\n * @example \"2.0.0\"\n * @since 7.16.0\n * @platform ios Always present\n * @platform android Always present\n */\n readonly appVersion: string;\n\n /**\n * The server environment where the app was originally purchased.\n *\n * @since 7.16.0\n * @platform ios Present (iOS 16+)\n * @platform android Not available (always null)\n */\n readonly environment?: 'Sandbox' | 'Production' | 'Xcode' | null;\n\n /**\n * The JWS (JSON Web Signature) representation of the app transaction.\n * Can be sent to your backend for server-side verification.\n *\n * @since 7.16.0\n * @platform ios Present (iOS 16+)\n * @platform android Not available\n */\n readonly jwsRepresentation?: string;\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 /**\n * Human-readable subscription period unit.\n *\n * @since 8.3.8\n */\n readonly unitString?: 'day' | 'week' | 'month' | 'year' | 'unknown';\n}\n\nexport type SubscriptionBillingPlanType = 'upFront' | 'monthly' | 'unknown';\n\nexport interface ProductCommitmentInfo {\n /**\n * Total commitment price in the local currency.\n */\n readonly price?: number;\n /**\n * Formatted total commitment price.\n */\n readonly priceString?: string;\n /**\n * Full commitment period.\n */\n readonly period?: SubscriptionPeriod;\n}\n\nexport interface SubscriptionPricingTerms {\n /**\n * Billing plan represented by this pricing entry.\n */\n readonly billingPlanType?: SubscriptionBillingPlanType;\n /**\n * Total commitment details for this billing plan.\n */\n readonly commitmentInfo?: ProductCommitmentInfo;\n /**\n * Formatted price for each billing period.\n */\n readonly billingDisplayPrice?: string;\n /**\n * Numeric price for each billing period.\n */\n readonly billingPrice?: number;\n /**\n * Duration of each billing period.\n */\n readonly billingPeriod?: SubscriptionPeriod;\n /**\n * StoreKit subscription offers that apply to this billing plan.\n */\n readonly subscriptionOffers?: StoreKitSubscriptionOffer[];\n}\n\nexport interface StoreKitSubscriptionOffer {\n /**\n * StoreKit offer identifier.\n */\n readonly identifier?: string;\n /**\n * StoreKit offer type.\n */\n readonly type?: string;\n /**\n * Offer price in the local currency.\n */\n readonly price?: number;\n /**\n * Formatted offer price.\n */\n readonly priceString?: string;\n /**\n * Offer billing period.\n */\n readonly period?: SubscriptionPeriod;\n /**\n * Number of periods the offer applies to.\n */\n readonly periodCount?: number;\n /**\n * StoreKit offer payment mode.\n */\n readonly paymentMode?: string;\n}\n\nexport interface TransactionCommitmentInfo {\n /**\n * Current billing period number within the commitment.\n */\n readonly billingPeriodNumber?: number;\n /**\n * Total number of billing periods in the commitment.\n */\n readonly totalBillingPeriods?: number;\n /**\n * End of the full commitment, in ISO 8601 format.\n */\n readonly expirationDate?: string;\n /**\n * Total commitment price in the local currency.\n */\n readonly price?: number;\n}\n\nexport interface RenewalCommitmentInfo {\n /**\n * Product StoreKit will renew into after the commitment ends.\n */\n readonly autoRenewProductId?: string;\n /**\n * Whether the subscription renews into another commitment after the current commitment ends.\n */\n readonly willAutoRenew?: boolean;\n /**\n * Billing plan StoreKit will use for the next commitment or renewal.\n */\n readonly renewalBillingPlanType?: SubscriptionBillingPlanType;\n /**\n * Renewal date for the next commitment or renewal, in ISO 8601 format.\n */\n readonly renewalDate?: string;\n /**\n * Renewal price in the local currency.\n */\n readonly renewalPrice?: number;\n}\n\nexport interface SubscriptionRenewalInfo {\n /**\n * Whether the next billing period will renew.\n */\n readonly willAutoRenew?: boolean;\n /**\n * Product StoreKit will renew into for the next billing period.\n */\n readonly autoRenewProductId?: string;\n /**\n * Billing plan StoreKit will use for the next billing period.\n */\n readonly renewalBillingPlanType?: SubscriptionBillingPlanType;\n /**\n * Next billing period renewal date, in ISO 8601 format.\n */\n readonly renewalDate?: string;\n /**\n * Next billing period renewal price in the local currency.\n */\n readonly renewalPrice?: number;\n /**\n * Currency code for renewal pricing metadata.\n */\n readonly currencyCode?: string;\n /**\n * Commitment renewal metadata for monthly subscriptions with a 12-month commitment.\n */\n readonly commitmentInfo?: RenewalCommitmentInfo;\n}\n\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n *\n * iOS values: 0 = introductory, 1 = promotional, 2 = win-back.\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}\n\n/**\n * Android one-time product discount display metadata.\n *\n * @platform android Populated for discounted one-time purchase offers when available.\n * @platform ios Not available\n */\nexport interface OneTimePurchaseOfferDiscount {\n /**\n * Percentage discount off the full price.\n */\n readonly percentageDiscount?: number;\n /**\n * Absolute discount amount in micro-units (1,000,000 micro-units = 1 currency unit).\n */\n readonly discountAmountMicros?: number;\n}\n\nexport interface Product {\n /**\n * Product Id.\n *\n * Android subscriptions note:\n * - `identifier` is the base plan ID (`offerDetails.getBasePlanId()`).\n * - `planIdentifier` is the subscription product ID (`productDetails.getProductId()`).\n *\n * Android one-time products note:\n * - `identifier` is the Google Play product ID (`productDetails.getProductId()`).\n * - When multiple offers exist, `getProducts()` returns one entry per eligible offer.\n *\n * If you group/filter Android subscription results by `identifier`, you are grouping by base plan.\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 * Android subscriptions only: Google Play product identifier tied to the offer/base plan set.\n */\n readonly planIdentifier?: string;\n /**\n * Android: offer token required when purchasing a specific subscription or one-time offer.\n */\n readonly offerToken?: string;\n /**\n * Android: offer identifier (null/undefined for base offers).\n */\n readonly offerId?: string | null;\n /**\n * Android one-time products only: purchase option identifier (for example `buy-option`).\n *\n * @platform android Present on one-time purchase offers when available.\n * @platform ios Not available\n */\n readonly purchaseOptionId?: string;\n /**\n * Android one-time products only: full price before discount, in the local currency.\n *\n * @platform android Present on discounted one-time purchase offers when available.\n * @platform ios Not available\n */\n readonly fullPrice?: number;\n /**\n * Android one-time products only: discount metadata for discounted offers.\n *\n * @platform android Present on discounted one-time purchase offers when available.\n * @platform ios Not available\n */\n readonly discountDisplayInfo?: OneTimePurchaseOfferDiscount;\n /**\n * iOS subscriptions only: StoreKit pricing terms by billing plan.\n *\n * For subscriptions with a monthly billing plan and 12-month commitment, this\n * includes both the standard up-front plan and the monthly commitment plan.\n * Display both `billingDisplayPrice` and `commitmentInfo.priceString` before\n * starting a monthly commitment purchase.\n *\n * @since 8.3.8\n * @platform ios Present on supported StoreKit subscription products.\n * @platform android Not available\n */\n readonly pricingTerms?: SubscriptionPricingTerms[];\n /**\n * The Product subscription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n *\n * @platform ios Populated from StoreKit introductory offers when available.\n * @platform android Populated from the first pricing phase on base subscription offers when multiple phases are present.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * Whether the current store account is eligible for an introductory offer on this subscription.\n *\n * @platform ios Set from StoreKit `isEligibleForIntroOffer` when the product has an introductory offer.\n * @platform android Always `INTRO_ELIGIBILITY_STATUS_UNKNOWN` (Google Play filters ineligible offers in billing).\n * @since 8.8.3\n */\n readonly introEligibility?: INTRO_ELIGIBILITY_STATUS;\n /**\n * The Product discounts list.\n *\n * @platform ios Populated from StoreKit promotional offers when available.\n * @platform android Populated from promotional subscription offers that share the same base plan.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Configure plugin-wide purchase finishing behavior.\n *\n * Call this as early as possible (ideally before other NativePurchases APIs). You can also set\n * `autoFinishTransactions` in `capacitor.config` under `plugins.NativePurchases` so iOS applies\n * the value before the native `transactionUpdated` listener starts.\n *\n * **`autoFinishTransactions` (default `true`)**\n *\n * - **iOS (StoreKit 2)**: When `true`, the plugin finishes transactions automatically for\n * `transactionUpdated`, `restorePurchases`, and `purchaseProduct` (when\n * `autoAcknowledgePurchases` is also true). When `false`, transactions stay unfinished until you call\n * `finishTransaction()` (or `acknowledgePurchase()` with the transaction ID).\n * - **Android**: When `true`, `restorePurchases()` may auto-acknowledge unacknowledged purchases\n * (recovery flow). When `false`, recovery does not acknowledge; use `acknowledgePurchase()`.\n * `purchaseProduct()` auto-acknowledges only when both `autoFinishTransactions` and\n * `autoAcknowledgePurchases` are true.\n *\n * **`autoAcknowledgePurchases`** applies only to the `purchaseProduct()` call and does not change\n * how the iOS `transactionUpdated` listener finishes transactions. Use this method (or config) for that.\n *\n * @param options.autoFinishTransactions When false, manual finishing/acknowledgment is required for the flows above.\n * @since 8.9.0\n *\n * @example\n * ```typescript\n * // capacitor.config.ts\n * export default {\n * plugins: {\n * NativePurchases: {\n * autoFinishTransactions: false,\n * },\n * },\n * };\n *\n * // Optional runtime override (affects subsequent native operations)\n * await NativePurchases.configure({ autoFinishTransactions: false });\n * ```\n */\n configure(options?: { autoFinishTransactions?: boolean }): Promise<void>;\n\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 * Gets the App Transaction information, which provides details about when the user\n * originally downloaded or purchased the app.\n *\n * This is useful for implementing business model changes where you want to\n * grandfather users who originally downloaded an earlier version of the app.\n *\n * **Use Case Example:**\n * If your app was originally free but you're adding a subscription, you can use\n * `originalAppVersion` to check if users downloaded before the subscription was added\n * and give them free access.\n *\n * **Platform Notes:**\n * - **iOS**: Requires iOS 16.0+. Uses StoreKit 2's `AppTransaction.shared`.\n * - **Android**: Uses Google Play's install referrer data when available.\n *\n * @returns {Promise<{ appTransaction: AppTransaction }>} The app transaction info\n * @throws An error if the app transaction cannot be retrieved (iOS 15 or earlier)\n * @since 7.16.0\n *\n * @example\n * ```typescript\n * const { appTransaction } = await NativePurchases.getAppTransaction();\n *\n * // Check if user downloaded before version 2.0.0 (when subscription was added)\n * if (compareVersions(appTransaction.originalAppVersion, '2.0.0') < 0) {\n * // User gets free access - they downloaded before subscriptions\n * grantFreeAccess();\n * }\n * ```\n *\n * @see https://developer.apple.com/documentation/storekit/supporting-business-model-changes-by-using-the-app-transaction\n */\n getAppTransaction(): Promise<{ appTransaction: AppTransaction }>;\n\n /**\n * Compares the original app version from the App Transaction against a target version\n * to determine if the user is entitled to features from an earlier business model.\n *\n * This is a utility method that performs the version comparison natively, which can be\n * more reliable than JavaScript-based comparison for semantic versioning.\n *\n * **Use Case:**\n * Check if the user's original download version is older than a specific version\n * to determine if they should be grandfathered into free features.\n *\n * **Platform Differences:**\n * - iOS: Uses build number (CFBundleVersion) from AppTransaction. Requires iOS 16+.\n * - Android: Uses version name from PackageInfo (current installed version, not original).\n *\n * @param options - The comparison options\n * @param options.targetVersion - The Android version name to compare against (e.g., \"2.0.0\"). Used on Android only.\n * @param options.targetBuildNumber - The iOS build number to compare against (e.g., \"42\"). Used on iOS only.\n * @returns {Promise<{ isOlderVersion: boolean; originalAppVersion: string }>}\n * - `isOlderVersion`: true if the user's original version is older than target\n * - `originalAppVersion`: The user's original app version/build number for reference\n * @throws An error if the app transaction cannot be retrieved\n * @since 7.16.0\n *\n * @example\n * ```typescript\n * // Check if user downloaded before version 2.0.0/build 42 (when subscription was added)\n * const result = await NativePurchases.isEntitledToOldBusinessModel({\n * targetVersion: '2.0.0',\n * targetBuildNumber: '42'\n * });\n *\n * if (result.isOlderVersion) {\n * console.log(`User downloaded v${result.originalAppVersion}, granting free access`);\n * grantFreeAccess();\n * }\n * ```\n */\n isEntitledToOldBusinessModel(options: {\n targetVersion?: string;\n targetBuildNumber?: string;\n }): Promise<{ isOlderVersion: boolean; originalAppVersion: string }>;\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.offerToken - Only Android, the offer token for the selected subscription or one-time product offer. Use the `offerToken` returned by `getProducts()` / `getProduct()`.\n * @param options.quantity - Only iOS, the number of items you wish to purchase. Will use 1 by default.\n * @param options.billingPlanType - Only iOS, the StoreKit subscription billing plan to purchase. Use `\"monthly\"` for a monthly subscription with a 12-month commitment. Requires iOS 26.4+ and Xcode 26.5 SDK support.\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 * @param options.autoAcknowledgePurchases - When false, this purchase is not auto-finished/acknowledged when\n * `autoFinishTransactions` is also true. Does not disable auto-finishing on\n * the iOS `transactionUpdated` listener; use `configure({ autoFinishTransactions: false })`\n * for manual finishing across purchase and recovery flows. Defaults to true.\n * - **Android**: Must acknowledge within 3 days or Google Play will refund\n * - **iOS**: Unfinished transactions remain in the queue and may block future purchases\n */\n purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n offerToken?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n billingPlanType?: 'monthly' | 'upFront';\n appAccountToken?: string;\n isConsumable?: boolean;\n autoAcknowledgePurchases?: 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 * **⚠️ Warning:** Do not call `getProduct` concurrently using `Promise.all`.\n * The underlying native billing client does not support concurrent product\n * queries, and doing so causes a race condition that may result in errors\n * or missing data. To fetch multiple products at once, use `getProducts`\n * instead — it accepts an array of identifiers and is race-condition-free.\n *\n * @example\n * // ❌ Avoid: causes race condition\n * const [a, b] = await Promise.all([\n * NativePurchases.getProduct({ productIdentifier: 'id1' }),\n * NativePurchases.getProduct({ productIdentifier: 'id2' }),\n * ]);\n *\n * // ✅ Correct: use getProducts for multiple identifiers\n * const { products } = await NativePurchases.getProducts({ productIdentifiers: ['id1', 'id2'] });\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 * @param options.onlyCurrentEntitlements - iOS only. When `false` (default), uses `Transaction.all` which returns every\n * transaction ever recorded on the device. When `true`, uses\n * `Transaction.currentEntitlements` which is scoped to the signed-in Apple ID\n * and only includes currently active entitlements. Set to `true` to prevent\n * cross-account purchase leakage on shared or refurbished devices.\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 onlyCurrentEntitlements?: boolean;\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 * Presents the App Store offer code redemption sheet so users can redeem a subscription offer code in your app.\n *\n * iOS: Uses StoreKit's `AppStore.presentOfferCodeRedeemSheet(in:)` to display the system redemption UI (iOS 16.0+).\n *\n * @returns {Promise<void>} Promise that resolves when the redemption sheet is presented\n * @throws An error if the offer code redemption sheet cannot be presented\n * @since 8.6.0\n * @platform ios\n *\n * @see https://developer.apple.com/documentation/storekit/appstore/presentoffercoderedeemsheet(in:)\n */\n presentOfferCodeRedeemSheet(): Promise<void>;\n\n /**\n * Manually acknowledge/finish a purchase transaction.\n *\n * Call this when automatic finishing or acknowledgment is disabled, for example\n * `purchaseProduct({ autoAcknowledgePurchases: false })`, `configure({ autoFinishTransactions: false })`\n * (Android recovery or iOS updates), or when a returned transaction has `needsFinish: true`.\n *\n * **Platform Behavior:**\n * - **Android**: Acknowledges the purchase with Google Play. Must be called within 3 days or the purchase will be refunded.\n * - **iOS**: Finishes the transaction with StoreKit 2. Unfinished transactions remain in the queue and may block future purchases.\n *\n * **Acknowledgment Options:**\n *\n * **1. Client-side (this method)**: Call from your app after validation\n * ```typescript\n * await NativePurchases.acknowledgePurchase({\n * purchaseToken: transaction.purchaseToken // Android: purchaseToken, iOS: transactionId\n * });\n * ```\n *\n * **2. Server-side (Android only, recommended for security)**: Use Google Play Developer API v3\n * - Endpoint: `POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}:acknowledge`\n * - Requires OAuth 2.0 authentication with appropriate scopes\n * - See: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/acknowledge\n * - For subscriptions: Use `/purchases/subscriptions/{subscriptionId}/tokens/{token}:acknowledge` instead\n * - Note: iOS has no server-side finish API\n *\n * **When to use manual acknowledgment:**\n * - Server-side validation: Verify the purchase with your backend before acknowledging\n * - Entitlement delivery: Ensure user receives content/features before acknowledging\n * - Multi-step workflows: Complete all steps before final acknowledgment\n * - Security: Prevent client-side manipulation by handling acknowledgment server-side (Android only)\n *\n * @param options - The purchase to acknowledge\n * @param options.purchaseToken - The purchase token (Android) or transaction ID as string (iOS) from the Transaction object\n * @returns {Promise<void>} Promise that resolves when the purchase is acknowledged/finished\n * @throws An error if acknowledgment/finishing fails or transaction not found\n * @platform android Acknowledges the purchase with Google Play\n * @platform ios Finishes the transaction with StoreKit 2\n * @since 7.14.0\n *\n * @example\n * ```typescript\n * // Client-side acknowledgment\n * const transaction = await NativePurchases.purchaseProduct({\n * productIdentifier: 'premium_feature',\n * autoAcknowledgePurchases: false\n * });\n *\n * // Validate with your backend\n * const isValid = await fetch('/api/validate-purchase', {\n * method: 'POST',\n * body: JSON.stringify({ purchaseToken: transaction.purchaseToken })\n * });\n *\n * if (isValid) {\n * // Option 1: Acknowledge from client\n * await NativePurchases.acknowledgePurchase({\n * purchaseToken: transaction.purchaseToken\n * });\n *\n * // Option 2: Or let your backend acknowledge via Google Play API\n * // Your backend calls Google Play Developer API\n * }\n * ```\n */\n acknowledgePurchase(options: { purchaseToken: string }): Promise<void>;\n\n /**\n * Finish a StoreKit 2 transaction on iOS after you validate delivery on your backend.\n *\n * Equivalent to `acknowledgePurchase({ purchaseToken: transactionId })` on iOS. Safe to call more\n * than once; finishing an already finished transaction resolves successfully.\n *\n * **Android**: Google Play uses purchase acknowledgment, not StoreKit finishing. Call\n * `acknowledgePurchase({ purchaseToken })` instead. This method rejects on Android.\n *\n * @param options.transactionId StoreKit transaction ID from the `Transaction` object (numeric string).\n * @since 8.9.0\n * @platform ios Finishes the transaction with StoreKit 2\n * @platform android Rejects; use `acknowledgePurchase()`\n */\n finishTransaction(options: { transactionId: string }): Promise<void>;\n\n /**\n * Returns transactions that still need finishing on iOS, or unacknowledged purchases on Android.\n *\n * Use on app launch when `autoFinishTransactions` is `false` to recover work after a restart.\n *\n * **Android recovery:** After validation, call `consumePurchase({ purchaseToken })` for consumable\n * in-app products (acknowledges and consumes). Call `acknowledgePurchase({ purchaseToken })` for\n * non-consumables and subscriptions. Includes only purchases in the `PURCHASED` state that are not\n * yet acknowledged. Pending purchases are excluded until Google Play marks them purchased.\n *\n * @since 8.9.0\n */\n getUnfinishedTransactions(): Promise<{ transactions: Transaction[] }>;\n\n /**\n * Consume an in-app purchase on Android.\n *\n * Consuming a purchase does two things:\n * 1. Acknowledges the purchase (so you don't need to call acknowledgePurchase separately)\n * 2. Removes ownership, allowing the user to buy the same product again\n *\n * Use this for consumable products like virtual currency, extra lives, or credits.\n *\n * **Important:** In Google Play Billing Library 8.x, consumed purchases can no longer\n * be queried via getPurchases(). Once consumed, the purchase is gone.\n *\n * Android only — iOS does not have a separate consume concept.\n * On iOS and web, this method rejects with an error.\n *\n * @param options - The purchase to consume\n * @param options.purchaseToken - The purchase token from the Transaction object\n * @returns {Promise<void>} Promise that resolves when the purchase is consumed\n * @throws Error if consumption fails, token is invalid, or called on iOS/web\n * @platform android\n * @since 8.2.0\n *\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({\n * productIdentifier: 'coins_100',\n * isConsumable: false,\n * autoAcknowledgePurchases: false\n * });\n *\n * // Validate with your backend first\n * const isValid = await validateWithServer(transaction.purchaseToken);\n *\n * if (isValid) {\n * // Grant the coins, then consume to allow re-purchase\n * await NativePurchases.consumePurchase({\n * purchaseToken: transaction.purchaseToken!\n * });\n * }\n * ```\n */\n consumePurchase(options: { purchaseToken: string }): Promise<void>;\n\n /**\n * Get the user's current App Store / Google Play storefront — the country\n * their store account is registered to.\n *\n * iOS: reads StoreKit 2 `Storefront.current`. `countryCode` is ISO 3166-1\n * **alpha-3** (e.g. `\"USA\"`) and `storefrontId` is the Apple-defined\n * storefront identifier.\n * Android: reads Google Play Billing `getBillingConfigAsync()`. `countryCode`\n * is ISO 3166-1 **alpha-2** (e.g. `\"US\"`); `storefrontId` is omitted (Google\n * Play has no storefront-id concept).\n *\n * Contract note (future-major default candidate): `countryCode` is returned in\n * each store's native format and is intentionally NOT normalized across\n * platforms today (iOS alpha-3 vs Android alpha-2), to stay faithful to the\n * platform APIs. Normalizing both to a single scheme (e.g. ISO 3166-1 alpha-2)\n * is a candidate default change for the next Capacitor major, deferred so it\n * can be adopted deliberately rather than as a mid-major breaking change.\n *\n * Resolves a `countryCode` of `\"\"` (it does not reject) when the storefront\n * can't be determined on either platform — e.g. apps distributed via iOS\n * alternative distribution, or Google Play billing being unavailable.\n *\n * Useful for region-dependent logic such as localized offers/pricing and\n * gating external-purchase entitlements, whose eligibility the platforms key\n * to the storefront country. Read it live rather than caching, since the user\n * can change their store region.\n *\n * @returns {Promise<{ countryCode: string; storefrontId?: string }>} the current storefront\n * @since 8.5.0\n *\n * @example\n * ```typescript\n * const { countryCode } = await NativePurchases.getStorefront();\n * if (countryCode === 'USA' || countryCode === 'US') {\n * // show US-specific payment options\n * }\n * ```\n */\n getStorefront(): Promise<{ countryCode: string; storefrontId?: string }>;\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 *\n * When `autoFinishTransactions` is `true` (default), the plugin finishes each verified transaction\n * before emitting the event. When `false`, the event includes `needsFinish: true` and you must call\n * `finishTransaction()` after backend validation.\n *\n * iOS only.\n */\n addListener(\n eventName: 'transactionUpdated',\n listenerFunc: (transaction: Transaction) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Listen for StoreKit transaction verification failures delivered by Apple's Transaction.updates.\n * Fires when the verification result is unverified.\n * iOS only.\n */\n addListener(\n eventName: 'transactionVerificationFailed',\n listenerFunc: (payload: TransactionVerificationFailedEvent) => 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,qIAAuC,CAAA;IACvC;;OAEG;IACH,iIAAqC,CAAA;AACvC,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 = 1,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE = 2,\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 * **This is the full verified receipt payload from Apple StoreKit.**\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 * **For backend validation:**\n * - Use Apple's receipt verification API: https://buy.itunes.apple.com/verifyReceipt (production)\n * - Or sandbox: https://sandbox.itunes.apple.com/verifyReceipt\n * - This contains all transaction data needed for validation\n *\n * **Note:** Apple recommends migrating to App Store Server API v2 with `jwsRepresentation` for new implementations.\n * The legacy receipt verification API continues to work but may be deprecated in the future.\n *\n * @since 1.0.0\n * @platform ios Always present\n * @platform android Not available (use purchaseToken instead)\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({ ... });\n * if (transaction.receipt) {\n * // Send to your backend for validation\n * await fetch('/api/validate-receipt', {\n * method: 'POST',\n * body: JSON.stringify({ receipt: transaction.receipt })\n * });\n * }\n * ```\n */\n readonly receipt?: string;\n /**\n * StoreKit 2 JSON Web Signature (JWS) payload describing the verified transaction.\n *\n * **This is the full verified receipt in JWS format (StoreKit 2).**\n * Send this to your backend when using Apple's App Store Server API v2 instead of raw receipts.\n * Only available when the transaction originated from StoreKit 2 APIs (e.g. Transaction.updates).\n *\n * **For backend validation:**\n * - Use Apple's App Store Server API v2 to decode and verify the JWS\n * - This is the modern alternative to the legacy receipt format\n * - Contains signed transaction information from Apple\n *\n * @since 7.13.2\n * @platform ios Present for StoreKit 2 transactions (iOS 15+)\n * @platform android Not available\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({ ... });\n * if (transaction.jwsRepresentation) {\n * // Send to your backend for validation with App Store Server API v2\n * await fetch('/api/validate-jws', {\n * method: 'POST',\n * body: JSON.stringify({ jws: transaction.jwsRepresentation })\n * });\n * }\n * ```\n */\n readonly jwsRepresentation?: 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 * Indicates whether this transaction is the result of a subscription upgrade.\n *\n * Useful for understanding when StoreKit generated the transaction because\n * the customer moved from a lower tier to a higher tier plan.\n *\n * @since 7.13.2\n * @platform ios Present for auto-renewable subscriptions (iOS 15+)\n * @platform android Not available\n */\n readonly isUpgraded?: boolean;\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 * Date the transaction was revoked/refunded, in ISO 8601 format.\n *\n * Present when Apple revokes access due to an issue (e.g., refund or developer issue).\n *\n * @since 7.13.2\n * @platform ios Present for revoked transactions (iOS 15+)\n * @platform android Not available\n */\n readonly revocationDate?: string;\n /**\n * Reason why Apple revoked the transaction.\n *\n * Possible values:\n * - `\"developerIssue\"`: Developer-initiated refund or issue\n * - `\"other\"`: Apple-initiated (customer refund, billing problem, etc.)\n * - `\"unknown\"`: StoreKit didn't report a specific reason\n *\n * @since 7.13.2\n * @platform ios Present for revoked transactions (iOS 15+)\n * @platform android Not available\n */\n readonly revocationReason?: 'developerIssue' | 'other' | 'unknown';\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 * Current subscription state reported by StoreKit.\n *\n * Possible values:\n * - `\"subscribed\"`: Auto-renewing and in good standing\n * - `\"expired\"`: Lapsed with no access\n * - `\"revoked\"`: Access removed due to refund or issue\n * - `\"inGracePeriod\"`: Payment issue but still in grace access window\n * - `\"inBillingRetryPeriod\"`: StoreKit retrying failed billing\n * - `\"unknown\"`: StoreKit did not report a state\n *\n * @since 7.13.2\n * @platform ios Present for auto-renewable subscriptions (iOS 15+)\n * @platform android Not available\n */\n readonly subscriptionState?:\n | 'subscribed'\n | 'expired'\n | 'revoked'\n | 'inGracePeriod'\n | 'inBillingRetryPeriod'\n | 'unknown';\n /**\n * StoreKit billing plan type for auto-renewable subscriptions.\n *\n * - `\"upFront\"`: Standard subscription billing for the full billing period.\n * - `\"monthly\"`: Monthly billing with a 12-month commitment.\n * - `\"unknown\"`: StoreKit returned a future or unsupported value.\n *\n * @since 8.3.8\n * @platform ios Present for StoreKit transactions that include billing plan metadata.\n * @platform android Not available\n */\n readonly billingPlanType?: SubscriptionBillingPlanType;\n /**\n * Commitment metadata for monthly subscriptions with a 12-month commitment.\n *\n * Use `expirationDate` here only to display commitment progress. Continue using\n * the top-level `expirationDate` to decide whether the current billing period\n * grants entitlement access.\n *\n * @since 8.3.8\n * @platform ios Present for monthly commitment subscription transactions.\n * @platform android Not available\n */\n readonly commitmentInfo?: TransactionCommitmentInfo;\n /**\n * StoreKit renewal metadata for auto-renewable subscriptions.\n *\n * `willAutoRenew` here describes the next billing period. For monthly\n * commitment subscriptions, `commitmentInfo.willAutoRenew` describes whether\n * the next 12-month commitment renews after the current commitment ends.\n *\n * @since 8.3.8\n * @platform ios Present for verified subscription renewal info.\n * @platform android Not available\n */\n readonly renewalInfo?: SubscriptionRenewalInfo;\n /**\n * Currency code associated with StoreKit transaction pricing metadata.\n *\n * @since 8.3.8\n * @platform ios Present when StoreKit includes currency in the transaction payload.\n * @platform android Not available\n */\n readonly currencyCode?: string;\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 * **This is the full verified purchase token from Google Play.**\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 * **For backend validation:**\n * - Use Google Play Developer API v3 to verify the purchase\n * - API endpoint: androidpublisher.purchases.products.get() or purchases.subscriptions.get()\n * - This token contains all data needed for validation with Google servers\n * - Can also be used for subscription status checks and cancellation detection\n *\n * @since 1.0.0\n * @platform ios Not available (use receipt instead)\n * @platform android Always present\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({ ... });\n * if (transaction.purchaseToken) {\n * // Send to your backend for validation\n * await fetch('/api/validate-purchase', {\n * method: 'POST',\n * body: JSON.stringify({\n * purchaseToken: transaction.purchaseToken,\n * productId: transaction.productIdentifier\n * })\n * });\n * }\n * ```\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 * By default, this plugin automatically acknowledges purchases unless you set\n * `autoAcknowledgePurchases: false` in purchaseProduct().\n *\n * @since 1.0.0\n * @platform ios Not available\n * @platform android Always present (should be true after successful purchase or manual acknowledgment)\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 * Indicates how the user obtained access to the product.\n *\n * - `\"purchased\"`: The user purchased the product directly\n * - `\"familyShared\"`: The user has access through Family Sharing (another family member purchased it)\n *\n * This property is useful for:\n * - Detecting family sharing usage for analytics\n * - Implementing different features/limits for family-shared vs. directly purchased products\n * - Understanding your user acquisition channels\n *\n * @since 7.12.8\n * @platform ios Always present (iOS 15.0+, StoreKit 2)\n * @platform android Not available\n */\n readonly ownershipType?: 'purchased' | 'familyShared';\n /**\n * Indicates the server environment where the transaction was processed.\n *\n * - `\"Sandbox\"`: Transaction belongs to testing in the sandbox environment\n * - `\"Production\"`: Transaction belongs to a customer in the production environment\n * - `\"Xcode\"`: Transaction from StoreKit Testing in Xcode\n *\n * This property is useful for:\n * - Debugging and identifying test vs. production purchases\n * - Analytics and reporting (filtering out sandbox transactions)\n * - Server-side validation (knowing which Apple endpoint to use)\n * - Preventing test purchases from affecting production metrics\n *\n * @since 7.12.8\n * @platform ios Present on iOS 16.0+ only (not available on iOS 15)\n * @platform android Not available\n */\n readonly environment?: 'Sandbox' | 'Production' | 'Xcode';\n /**\n * Reason StoreKit generated the transaction.\n *\n * - `\"purchase\"`: Initial purchase that user made manually\n * - `\"renewal\"`: Automatically generated renewal for an auto-renewable subscription\n * - `\"unknown\"`: StoreKit did not return a reason\n *\n * @since 7.13.2\n * @platform ios Present on iOS 17.0+ (StoreKit 2 transactions)\n * @platform android Not available\n */\n readonly transactionReason?: 'purchase' | 'renewal' | 'unknown';\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 * Whether the StoreKit transaction still needs to be finished with `finishTransaction()`.\n *\n * Present when the transaction is returned from `getUnfinishedTransactions()` or from\n * `transactionUpdated` while `autoFinishTransactions` is `false`.\n *\n * @since 8.9.0\n * @platform ios Present when the transaction is unfinished in StoreKit 2\n * @platform android Not available (use `isAcknowledged === false` instead)\n */\n readonly needsFinish?: boolean;\n /**\n * Why StoreKit could not verify this transaction. Treat the transaction as untrusted and do not\n * grant entitlements from it.\n *\n * Present only on unverified entries returned by `getUnfinishedTransactions({ includeUnverified: true })`.\n *\n * @since 8.10.0\n * @platform ios Present when StoreKit reports the transaction as unverified\n * @platform android Not available (Play Billing has no client-side unverified state)\n */\n readonly verificationError?: string;\n}\n\nexport interface TransactionVerificationFailedEvent {\n /**\n * Identifier of the transaction that failed verification.\n *\n * @since 7.13.2\n * @platform ios Present when StoreKit reports an unverified transaction\n * @platform android Not available\n */\n readonly transactionId: string;\n /**\n * Localized error message describing why verification failed.\n *\n * @since 7.13.2\n * @platform ios Always present\n * @platform android Not available\n */\n readonly error: string;\n}\n\n/**\n * Represents the App Transaction information from StoreKit 2.\n * This provides details about when the user originally downloaded or purchased the app,\n * which is useful for determining if users are entitled to features from earlier business models.\n *\n * @see https://developer.apple.com/documentation/storekit/supporting-business-model-changes-by-using-the-app-transaction\n * @since 7.16.0\n */\nexport interface AppTransaction {\n /**\n * The app version that the user originally purchased or downloaded.\n *\n * Use this to determine if users who originally downloaded an earlier version\n * should be entitled to features that were previously free or included.\n *\n * For iOS: This is the `CFBundleShortVersionString` (e.g., \"1.0.0\")\n * For Android: This is the `versionName` from Google Play (e.g., \"1.0.0\")\n *\n * @example \"1.0.0\"\n * @since 7.16.0\n * @platform ios Always present (iOS 16+)\n * @platform android Always present\n */\n readonly originalAppVersion: string;\n\n /**\n * The date when the user originally purchased or downloaded the app.\n * ISO 8601 format.\n *\n * @example \"2023-06-15T10:30:00Z\"\n * @since 7.16.0\n * @platform ios Always present (iOS 16+)\n * @platform android Always present\n */\n readonly originalPurchaseDate: string;\n\n /**\n * The bundle identifier of the app.\n *\n * @example \"com.example.myapp\"\n * @since 7.16.0\n * @platform ios Always present (iOS 16+)\n * @platform android Always present (package name)\n */\n readonly bundleId: string;\n\n /**\n * The current app version installed on the device.\n *\n * @example \"2.0.0\"\n * @since 7.16.0\n * @platform ios Always present\n * @platform android Always present\n */\n readonly appVersion: string;\n\n /**\n * The server environment where the app was originally purchased.\n *\n * @since 7.16.0\n * @platform ios Present (iOS 16+)\n * @platform android Not available (always null)\n */\n readonly environment?: 'Sandbox' | 'Production' | 'Xcode' | null;\n\n /**\n * The JWS (JSON Web Signature) representation of the app transaction.\n * Can be sent to your backend for server-side verification.\n *\n * @since 7.16.0\n * @platform ios Present (iOS 16+)\n * @platform android Not available\n */\n readonly jwsRepresentation?: string;\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 /**\n * Human-readable subscription period unit.\n *\n * @since 8.3.8\n */\n readonly unitString?: 'day' | 'week' | 'month' | 'year' | 'unknown';\n}\n\nexport type SubscriptionBillingPlanType = 'upFront' | 'monthly' | 'unknown';\n\nexport interface ProductCommitmentInfo {\n /**\n * Total commitment price in the local currency.\n */\n readonly price?: number;\n /**\n * Formatted total commitment price.\n */\n readonly priceString?: string;\n /**\n * Full commitment period.\n */\n readonly period?: SubscriptionPeriod;\n}\n\nexport interface SubscriptionPricingTerms {\n /**\n * Billing plan represented by this pricing entry.\n */\n readonly billingPlanType?: SubscriptionBillingPlanType;\n /**\n * Total commitment details for this billing plan.\n */\n readonly commitmentInfo?: ProductCommitmentInfo;\n /**\n * Formatted price for each billing period.\n */\n readonly billingDisplayPrice?: string;\n /**\n * Numeric price for each billing period.\n */\n readonly billingPrice?: number;\n /**\n * Duration of each billing period.\n */\n readonly billingPeriod?: SubscriptionPeriod;\n /**\n * StoreKit subscription offers that apply to this billing plan.\n */\n readonly subscriptionOffers?: StoreKitSubscriptionOffer[];\n}\n\nexport interface StoreKitSubscriptionOffer {\n /**\n * StoreKit offer identifier.\n */\n readonly identifier?: string;\n /**\n * StoreKit offer type.\n */\n readonly type?: string;\n /**\n * Offer price in the local currency.\n */\n readonly price?: number;\n /**\n * Formatted offer price.\n */\n readonly priceString?: string;\n /**\n * Offer billing period.\n */\n readonly period?: SubscriptionPeriod;\n /**\n * Number of periods the offer applies to.\n */\n readonly periodCount?: number;\n /**\n * StoreKit offer payment mode.\n */\n readonly paymentMode?: string;\n}\n\nexport interface TransactionCommitmentInfo {\n /**\n * Current billing period number within the commitment.\n */\n readonly billingPeriodNumber?: number;\n /**\n * Total number of billing periods in the commitment.\n */\n readonly totalBillingPeriods?: number;\n /**\n * End of the full commitment, in ISO 8601 format.\n */\n readonly expirationDate?: string;\n /**\n * Total commitment price in the local currency.\n */\n readonly price?: number;\n}\n\nexport interface RenewalCommitmentInfo {\n /**\n * Product StoreKit will renew into after the commitment ends.\n */\n readonly autoRenewProductId?: string;\n /**\n * Whether the subscription renews into another commitment after the current commitment ends.\n */\n readonly willAutoRenew?: boolean;\n /**\n * Billing plan StoreKit will use for the next commitment or renewal.\n */\n readonly renewalBillingPlanType?: SubscriptionBillingPlanType;\n /**\n * Renewal date for the next commitment or renewal, in ISO 8601 format.\n */\n readonly renewalDate?: string;\n /**\n * Renewal price in the local currency.\n */\n readonly renewalPrice?: number;\n}\n\nexport interface SubscriptionRenewalInfo {\n /**\n * Whether the next billing period will renew.\n */\n readonly willAutoRenew?: boolean;\n /**\n * Product StoreKit will renew into for the next billing period.\n */\n readonly autoRenewProductId?: string;\n /**\n * Billing plan StoreKit will use for the next billing period.\n */\n readonly renewalBillingPlanType?: SubscriptionBillingPlanType;\n /**\n * Next billing period renewal date, in ISO 8601 format.\n */\n readonly renewalDate?: string;\n /**\n * Next billing period renewal price in the local currency.\n */\n readonly renewalPrice?: number;\n /**\n * Currency code for renewal pricing metadata.\n */\n readonly currencyCode?: string;\n /**\n * Commitment renewal metadata for monthly subscriptions with a 12-month commitment.\n */\n readonly commitmentInfo?: RenewalCommitmentInfo;\n}\n\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n *\n * iOS values: 0 = introductory, 1 = promotional, 2 = win-back.\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}\n\n/**\n * Android one-time product discount display metadata.\n *\n * @platform android Populated for discounted one-time purchase offers when available.\n * @platform ios Not available\n */\nexport interface OneTimePurchaseOfferDiscount {\n /**\n * Percentage discount off the full price.\n */\n readonly percentageDiscount?: number;\n /**\n * Absolute discount amount in micro-units (1,000,000 micro-units = 1 currency unit).\n */\n readonly discountAmountMicros?: number;\n}\n\nexport interface Product {\n /**\n * Product Id.\n *\n * Android subscriptions note:\n * - `identifier` is the base plan ID (`offerDetails.getBasePlanId()`).\n * - `planIdentifier` is the subscription product ID (`productDetails.getProductId()`).\n *\n * Android one-time products note:\n * - `identifier` is the Google Play product ID (`productDetails.getProductId()`).\n * - When multiple offers exist, `getProducts()` returns one entry per eligible offer.\n *\n * If you group/filter Android subscription results by `identifier`, you are grouping by base plan.\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 * Android subscriptions only: Google Play product identifier tied to the offer/base plan set.\n */\n readonly planIdentifier?: string;\n /**\n * Android: offer token required when purchasing a specific subscription or one-time offer.\n */\n readonly offerToken?: string;\n /**\n * Android: offer identifier (null/undefined for base offers).\n */\n readonly offerId?: string | null;\n /**\n * Android one-time products only: purchase option identifier (for example `buy-option`).\n *\n * @platform android Present on one-time purchase offers when available.\n * @platform ios Not available\n */\n readonly purchaseOptionId?: string;\n /**\n * Android one-time products only: full price before discount, in the local currency.\n *\n * @platform android Present on discounted one-time purchase offers when available.\n * @platform ios Not available\n */\n readonly fullPrice?: number;\n /**\n * Android one-time products only: discount metadata for discounted offers.\n *\n * @platform android Present on discounted one-time purchase offers when available.\n * @platform ios Not available\n */\n readonly discountDisplayInfo?: OneTimePurchaseOfferDiscount;\n /**\n * iOS subscriptions only: StoreKit pricing terms by billing plan.\n *\n * For subscriptions with a monthly billing plan and 12-month commitment, this\n * includes both the standard up-front plan and the monthly commitment plan.\n * Display both `billingDisplayPrice` and `commitmentInfo.priceString` before\n * starting a monthly commitment purchase.\n *\n * @since 8.3.8\n * @platform ios Present on supported StoreKit subscription products.\n * @platform android Not available\n */\n readonly pricingTerms?: SubscriptionPricingTerms[];\n /**\n * The Product subscription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n *\n * @platform ios Populated from StoreKit introductory offers when available.\n * @platform android Populated from the first pricing phase on base subscription offers when multiple phases are present.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * Whether the current store account is eligible for an introductory offer on this subscription.\n *\n * @platform ios Set from StoreKit `isEligibleForIntroOffer` when the product has an introductory offer.\n * @platform android Always `INTRO_ELIGIBILITY_STATUS_UNKNOWN` (Google Play filters ineligible offers in billing).\n * @since 8.8.3\n */\n readonly introEligibility?: INTRO_ELIGIBILITY_STATUS;\n /**\n * The Product discounts list.\n *\n * @platform ios Populated from StoreKit promotional offers when available.\n * @platform android Populated from promotional subscription offers that share the same base plan.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Configure plugin-wide purchase finishing behavior.\n *\n * Call this as early as possible (ideally before other NativePurchases APIs). You can also set\n * `autoFinishTransactions` in `capacitor.config` under `plugins.NativePurchases` so iOS applies\n * the value before the native `transactionUpdated` listener starts.\n *\n * **`autoFinishTransactions` (default `true`)**\n *\n * - **iOS (StoreKit 2)**: When `true`, the plugin finishes transactions automatically for\n * `transactionUpdated`, `restorePurchases`, and `purchaseProduct` (when\n * `autoAcknowledgePurchases` is also true). When `false`, transactions stay unfinished until you call\n * `finishTransaction()` (or `acknowledgePurchase()` with the transaction ID).\n * - **Android**: When `true`, `restorePurchases()` may auto-acknowledge unacknowledged purchases\n * (recovery flow). When `false`, recovery does not acknowledge; use `acknowledgePurchase()`.\n * `purchaseProduct()` auto-acknowledges only when both `autoFinishTransactions` and\n * `autoAcknowledgePurchases` are true.\n *\n * **`autoAcknowledgePurchases`** applies only to the `purchaseProduct()` call and does not change\n * how the iOS `transactionUpdated` listener finishes transactions. Use this method (or config) for that.\n *\n * @param options.autoFinishTransactions When false, manual finishing/acknowledgment is required for the flows above.\n * @since 8.9.0\n *\n * @example\n * ```typescript\n * // capacitor.config.ts\n * export default {\n * plugins: {\n * NativePurchases: {\n * autoFinishTransactions: false,\n * },\n * },\n * };\n *\n * // Optional runtime override (affects subsequent native operations)\n * await NativePurchases.configure({ autoFinishTransactions: false });\n * ```\n */\n configure(options?: { autoFinishTransactions?: boolean }): Promise<void>;\n\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 * Gets the App Transaction information, which provides details about when the user\n * originally downloaded or purchased the app.\n *\n * This is useful for implementing business model changes where you want to\n * grandfather users who originally downloaded an earlier version of the app.\n *\n * **Use Case Example:**\n * If your app was originally free but you're adding a subscription, you can use\n * `originalAppVersion` to check if users downloaded before the subscription was added\n * and give them free access.\n *\n * **Platform Notes:**\n * - **iOS**: Requires iOS 16.0+. Uses StoreKit 2's `AppTransaction.shared`.\n * - **Android**: Uses Google Play's install referrer data when available.\n *\n * @returns {Promise<{ appTransaction: AppTransaction }>} The app transaction info\n * @throws An error if the app transaction cannot be retrieved (iOS 15 or earlier)\n * @since 7.16.0\n *\n * @example\n * ```typescript\n * const { appTransaction } = await NativePurchases.getAppTransaction();\n *\n * // Check if user downloaded before version 2.0.0 (when subscription was added)\n * if (compareVersions(appTransaction.originalAppVersion, '2.0.0') < 0) {\n * // User gets free access - they downloaded before subscriptions\n * grantFreeAccess();\n * }\n * ```\n *\n * @see https://developer.apple.com/documentation/storekit/supporting-business-model-changes-by-using-the-app-transaction\n */\n getAppTransaction(): Promise<{ appTransaction: AppTransaction }>;\n\n /**\n * Compares the original app version from the App Transaction against a target version\n * to determine if the user is entitled to features from an earlier business model.\n *\n * This is a utility method that performs the version comparison natively, which can be\n * more reliable than JavaScript-based comparison for semantic versioning.\n *\n * **Use Case:**\n * Check if the user's original download version is older than a specific version\n * to determine if they should be grandfathered into free features.\n *\n * **Platform Differences:**\n * - iOS: Uses build number (CFBundleVersion) from AppTransaction. Requires iOS 16+.\n * - Android: Uses version name from PackageInfo (current installed version, not original).\n *\n * @param options - The comparison options\n * @param options.targetVersion - The Android version name to compare against (e.g., \"2.0.0\"). Used on Android only.\n * @param options.targetBuildNumber - The iOS build number to compare against (e.g., \"42\"). Used on iOS only.\n * @returns {Promise<{ isOlderVersion: boolean; originalAppVersion: string }>}\n * - `isOlderVersion`: true if the user's original version is older than target\n * - `originalAppVersion`: The user's original app version/build number for reference\n * @throws An error if the app transaction cannot be retrieved\n * @since 7.16.0\n *\n * @example\n * ```typescript\n * // Check if user downloaded before version 2.0.0/build 42 (when subscription was added)\n * const result = await NativePurchases.isEntitledToOldBusinessModel({\n * targetVersion: '2.0.0',\n * targetBuildNumber: '42'\n * });\n *\n * if (result.isOlderVersion) {\n * console.log(`User downloaded v${result.originalAppVersion}, granting free access`);\n * grantFreeAccess();\n * }\n * ```\n */\n isEntitledToOldBusinessModel(options: {\n targetVersion?: string;\n targetBuildNumber?: string;\n }): Promise<{ isOlderVersion: boolean; originalAppVersion: string }>;\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.offerToken - Only Android, the offer token for the selected subscription or one-time product offer. Use the `offerToken` returned by `getProducts()` / `getProduct()`.\n * @param options.quantity - Only iOS, the number of items you wish to purchase. Will use 1 by default.\n * @param options.billingPlanType - Only iOS, the StoreKit subscription billing plan to purchase. Use `\"monthly\"` for a monthly subscription with a 12-month commitment. Requires iOS 26.4+ and Xcode 26.5 SDK support.\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 * @param options.autoAcknowledgePurchases - When false, this purchase is not auto-finished/acknowledged when\n * `autoFinishTransactions` is also true. Does not disable auto-finishing on\n * the iOS `transactionUpdated` listener; use `configure({ autoFinishTransactions: false })`\n * for manual finishing across purchase and recovery flows. Defaults to true.\n * - **Android**: Must acknowledge within 3 days or Google Play will refund\n * - **iOS**: Unfinished transactions remain in the queue and may block future purchases\n */\n purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n offerToken?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n billingPlanType?: 'monthly' | 'upFront';\n appAccountToken?: string;\n isConsumable?: boolean;\n autoAcknowledgePurchases?: 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 * **⚠️ Warning:** Do not call `getProduct` concurrently using `Promise.all`.\n * The underlying native billing client does not support concurrent product\n * queries, and doing so causes a race condition that may result in errors\n * or missing data. To fetch multiple products at once, use `getProducts`\n * instead — it accepts an array of identifiers and is race-condition-free.\n *\n * @example\n * // ❌ Avoid: causes race condition\n * const [a, b] = await Promise.all([\n * NativePurchases.getProduct({ productIdentifier: 'id1' }),\n * NativePurchases.getProduct({ productIdentifier: 'id2' }),\n * ]);\n *\n * // ✅ Correct: use getProducts for multiple identifiers\n * const { products } = await NativePurchases.getProducts({ productIdentifiers: ['id1', 'id2'] });\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 * @param options.onlyCurrentEntitlements - iOS only. When `false` (default), uses `Transaction.all` which returns every\n * transaction ever recorded on the device. When `true`, uses\n * `Transaction.currentEntitlements` which is scoped to the signed-in Apple ID\n * and only includes currently active entitlements. Set to `true` to prevent\n * cross-account purchase leakage on shared or refurbished devices.\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 onlyCurrentEntitlements?: boolean;\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 * Presents the App Store offer code redemption sheet so users can redeem a subscription offer code in your app.\n *\n * iOS: Uses StoreKit's `AppStore.presentOfferCodeRedeemSheet(in:)` to display the system redemption UI (iOS 16.0+).\n *\n * @returns {Promise<void>} Promise that resolves when the redemption sheet is presented\n * @throws An error if the offer code redemption sheet cannot be presented\n * @since 8.6.0\n * @platform ios\n *\n * @see https://developer.apple.com/documentation/storekit/appstore/presentoffercoderedeemsheet(in:)\n */\n presentOfferCodeRedeemSheet(): Promise<void>;\n\n /**\n * Manually acknowledge/finish a purchase transaction.\n *\n * Call this when automatic finishing or acknowledgment is disabled, for example\n * `purchaseProduct({ autoAcknowledgePurchases: false })`, `configure({ autoFinishTransactions: false })`\n * (Android recovery or iOS updates), or when a returned transaction has `needsFinish: true`.\n *\n * **Platform Behavior:**\n * - **Android**: Acknowledges the purchase with Google Play. Must be called within 3 days or the purchase will be refunded.\n * - **iOS**: Finishes the transaction with StoreKit 2. Unfinished transactions remain in the queue and may block future purchases.\n *\n * **Acknowledgment Options:**\n *\n * **1. Client-side (this method)**: Call from your app after validation\n * ```typescript\n * await NativePurchases.acknowledgePurchase({\n * purchaseToken: transaction.purchaseToken // Android: purchaseToken, iOS: transactionId\n * });\n * ```\n *\n * **2. Server-side (Android only, recommended for security)**: Use Google Play Developer API v3\n * - Endpoint: `POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}:acknowledge`\n * - Requires OAuth 2.0 authentication with appropriate scopes\n * - See: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/acknowledge\n * - For subscriptions: Use `/purchases/subscriptions/{subscriptionId}/tokens/{token}:acknowledge` instead\n * - Note: iOS has no server-side finish API\n *\n * **When to use manual acknowledgment:**\n * - Server-side validation: Verify the purchase with your backend before acknowledging\n * - Entitlement delivery: Ensure user receives content/features before acknowledging\n * - Multi-step workflows: Complete all steps before final acknowledgment\n * - Security: Prevent client-side manipulation by handling acknowledgment server-side (Android only)\n *\n * @param options - The purchase to acknowledge\n * @param options.purchaseToken - The purchase token (Android) or transaction ID as string (iOS) from the Transaction object\n * @returns {Promise<void>} Promise that resolves when the purchase is acknowledged/finished\n * @throws An error if acknowledgment/finishing fails or transaction not found\n * @platform android Acknowledges the purchase with Google Play\n * @platform ios Finishes the transaction with StoreKit 2\n * @since 7.14.0\n *\n * @example\n * ```typescript\n * // Client-side acknowledgment\n * const transaction = await NativePurchases.purchaseProduct({\n * productIdentifier: 'premium_feature',\n * autoAcknowledgePurchases: false\n * });\n *\n * // Validate with your backend\n * const isValid = await fetch('/api/validate-purchase', {\n * method: 'POST',\n * body: JSON.stringify({ purchaseToken: transaction.purchaseToken })\n * });\n *\n * if (isValid) {\n * // Option 1: Acknowledge from client\n * await NativePurchases.acknowledgePurchase({\n * purchaseToken: transaction.purchaseToken\n * });\n *\n * // Option 2: Or let your backend acknowledge via Google Play API\n * // Your backend calls Google Play Developer API\n * }\n * ```\n */\n acknowledgePurchase(options: { purchaseToken: string }): Promise<void>;\n\n /**\n * Finish a StoreKit 2 transaction on iOS after you validate delivery on your backend.\n *\n * Equivalent to `acknowledgePurchase({ purchaseToken: transactionId })` on iOS. Safe to call more\n * than once; finishing an already finished transaction resolves successfully.\n *\n * A transaction StoreKit could not verify is rejected unless `allowUnverified` is `true`. Finishing\n * one only removes it from the queue so StoreKit stops re-delivering it; never grant entitlements from it.\n *\n * **Android**: Acknowledges the purchase, using `transactionId` as the purchase token. Use\n * `consumePurchase({ purchaseToken })` instead for consumables that must be purchasable again.\n * `allowUnverified` has no effect because Play Billing has no client-side unverified state.\n *\n * @param options.transactionId Transaction ID from the `Transaction` object (numeric string on iOS, purchase token on Android).\n * @param options.allowUnverified Finish the transaction even if StoreKit could not verify it. Defaults to `false`.\n * @since 8.9.0\n * @platform ios Finishes the transaction with StoreKit 2\n * @platform android Acknowledges the purchase with Google Play\n */\n finishTransaction(options: { transactionId: string; allowUnverified?: boolean }): Promise<void>;\n\n /**\n * Returns transactions that still need finishing on iOS, or unacknowledged purchases on Android.\n *\n * Use on app launch when `autoFinishTransactions` is `false` to recover work after a restart.\n *\n * **Android recovery:** After validation, call `consumePurchase({ purchaseToken })` for consumable\n * in-app products (acknowledges and consumes). Call `acknowledgePurchase({ purchaseToken })` for\n * non-consumables and subscriptions. Includes only purchases in the `PURCHASED` state that are not\n * yet acknowledged. Pending purchases are excluded until Google Play marks them purchased.\n *\n * **Unverified transactions:** With `includeUnverified: true`, iOS also returns transactions StoreKit\n * could not verify, each with `verificationError` set. Do not grant entitlements from those; pass them\n * to `finishTransaction({ transactionId, allowUnverified: true })` to clear them. Android has no\n * client-side unverified state, so the option does not change its results.\n *\n * @param options.includeUnverified Also return unfinished transactions StoreKit could not verify. Defaults to `false`.\n * @since 8.9.0\n */\n getUnfinishedTransactions(options?: { includeUnverified?: boolean }): Promise<{ transactions: Transaction[] }>;\n\n /**\n * Consume an in-app purchase on Android.\n *\n * Consuming a purchase does two things:\n * 1. Acknowledges the purchase (so you don't need to call acknowledgePurchase separately)\n * 2. Removes ownership, allowing the user to buy the same product again\n *\n * Use this for consumable products like virtual currency, extra lives, or credits.\n *\n * **Important:** In Google Play Billing Library 8.x, consumed purchases can no longer\n * be queried via getPurchases(). Once consumed, the purchase is gone.\n *\n * Android only — iOS does not have a separate consume concept.\n * On iOS and web, this method rejects with an error.\n *\n * @param options - The purchase to consume\n * @param options.purchaseToken - The purchase token from the Transaction object\n * @returns {Promise<void>} Promise that resolves when the purchase is consumed\n * @throws Error if consumption fails, token is invalid, or called on iOS/web\n * @platform android\n * @since 8.2.0\n *\n * @example\n * ```typescript\n * const transaction = await NativePurchases.purchaseProduct({\n * productIdentifier: 'coins_100',\n * isConsumable: false,\n * autoAcknowledgePurchases: false\n * });\n *\n * // Validate with your backend first\n * const isValid = await validateWithServer(transaction.purchaseToken);\n *\n * if (isValid) {\n * // Grant the coins, then consume to allow re-purchase\n * await NativePurchases.consumePurchase({\n * purchaseToken: transaction.purchaseToken!\n * });\n * }\n * ```\n */\n consumePurchase(options: { purchaseToken: string }): Promise<void>;\n\n /**\n * Get the user's current App Store / Google Play storefront — the country\n * their store account is registered to.\n *\n * iOS: reads StoreKit 2 `Storefront.current`. `countryCode` is ISO 3166-1\n * **alpha-3** (e.g. `\"USA\"`) and `storefrontId` is the Apple-defined\n * storefront identifier.\n * Android: reads Google Play Billing `getBillingConfigAsync()`. `countryCode`\n * is ISO 3166-1 **alpha-2** (e.g. `\"US\"`); `storefrontId` is omitted (Google\n * Play has no storefront-id concept).\n *\n * Contract note (future-major default candidate): `countryCode` is returned in\n * each store's native format and is intentionally NOT normalized across\n * platforms today (iOS alpha-3 vs Android alpha-2), to stay faithful to the\n * platform APIs. Normalizing both to a single scheme (e.g. ISO 3166-1 alpha-2)\n * is a candidate default change for the next Capacitor major, deferred so it\n * can be adopted deliberately rather than as a mid-major breaking change.\n *\n * Resolves a `countryCode` of `\"\"` (it does not reject) when the storefront\n * can't be determined on either platform — e.g. apps distributed via iOS\n * alternative distribution, or Google Play billing being unavailable.\n *\n * Useful for region-dependent logic such as localized offers/pricing and\n * gating external-purchase entitlements, whose eligibility the platforms key\n * to the storefront country. Read it live rather than caching, since the user\n * can change their store region.\n *\n * @returns {Promise<{ countryCode: string; storefrontId?: string }>} the current storefront\n * @since 8.5.0\n *\n * @example\n * ```typescript\n * const { countryCode } = await NativePurchases.getStorefront();\n * if (countryCode === 'USA' || countryCode === 'US') {\n * // show US-specific payment options\n * }\n * ```\n */\n getStorefront(): Promise<{ countryCode: string; storefrontId?: string }>;\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 *\n * When `autoFinishTransactions` is `true` (default), the plugin finishes each verified transaction\n * before emitting the event. When `false`, the event includes `needsFinish: true` and you must call\n * `finishTransaction()` after backend validation.\n *\n * iOS only.\n */\n addListener(\n eventName: 'transactionUpdated',\n listenerFunc: (transaction: Transaction) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Listen for StoreKit transaction verification failures delivered by Apple's Transaction.updates.\n * Fires when the verification result is unverified.\n * iOS only.\n */\n addListener(\n eventName: 'transactionVerificationFailed',\n listenerFunc: (payload: TransactionVerificationFailedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /** Remove all registered listeners */\n removeAllListeners(): Promise<void>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -4,11 +4,14 @@ export declare class NativePurchasesWeb extends WebPlugin implements NativePurch
4
4
  configure(options?: {
5
5
  autoFinishTransactions?: boolean;
6
6
  }): Promise<void>;
7
- getUnfinishedTransactions(): Promise<{
7
+ getUnfinishedTransactions(options?: {
8
+ includeUnverified?: boolean;
9
+ }): Promise<{
8
10
  transactions: Transaction[];
9
11
  }>;
10
12
  finishTransaction(options: {
11
13
  transactionId: string;
14
+ allowUnverified?: boolean;
12
15
  }): Promise<void>;
13
16
  restorePurchases(): Promise<void>;
14
17
  getProducts(options: {
package/dist/esm/web.js CHANGED
@@ -3,7 +3,8 @@ export class NativePurchasesWeb extends WebPlugin {
3
3
  async configure(options) {
4
4
  void options;
5
5
  }
6
- async getUnfinishedTransactions() {
6
+ async getUnfinishedTransactions(options) {
7
+ void options;
7
8
  console.error('getUnfinishedTransactions only mocked in web');
8
9
  return { transactions: [] };
9
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,KAAK,CAAC,SAAS,CAAC,OAA8C;QAC5D,KAAK,OAAO,CAAC;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,SAAS,EAAE,EAAE,EAAE,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,mBAAmB;QACvB,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,2BAA2B;QAC/B,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,OAAkC;QAC1D,KAAK,OAAO,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAkC;QACtD,KAAK,OAAO,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAClD,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACtD,OAAO;YACL,cAAc,EAAE;gBACd,kBAAkB,EAAE,OAAO;gBAC3B,oBAAoB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBAC9C,QAAQ,EAAE,iBAAiB;gBAC3B,UAAU,EAAE,OAAO;gBACnB,WAAW,EAAE,IAAI;aAClB;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,OAGlC;QACC,KAAK,OAAO,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACjE,OAAO;YACL,cAAc,EAAE,KAAK;YACrB,kBAAkB,EAAE,OAAO;SAC5B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AppTransaction, NativePurchasesPlugin, Product, PURCHASE_TYPE, Transaction } from './definitions';\n\nexport class NativePurchasesWeb extends WebPlugin implements NativePurchasesPlugin {\n async configure(options?: { autoFinishTransactions?: boolean }): Promise<void> {\n void options;\n }\n\n async getUnfinishedTransactions(): Promise<{ transactions: Transaction[] }> {\n console.error('getUnfinishedTransactions only mocked in web');\n return { transactions: [] };\n }\n\n async finishTransaction(options: { transactionId: string }): Promise<void> {\n void options;\n console.error('finishTransaction only mocked in web');\n }\n\n async restorePurchases(): Promise<void> {\n console.error('restorePurchases only mocked in web');\n }\n\n async getProducts(options: {\n productIdentifiers: string[];\n productType?: PURCHASE_TYPE;\n }): Promise<{ products: Product[] }> {\n console.error('getProducts only mocked in web ' + options);\n return { products: [] };\n }\n\n async getProduct(options: { productIdentifier: string; productType?: PURCHASE_TYPE }): Promise<{ product: Product }> {\n console.error('getProduct only mocked in web ' + options);\n return { product: {} as any };\n }\n\n async purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n offerToken?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n billingPlanType?: 'monthly' | 'upFront';\n appAccountToken?: string;\n isConsumable?: boolean;\n autoAcknowledgePurchases?: boolean;\n }): Promise<Transaction> {\n console.error('purchaseProduct only mocked in web' + options);\n return { transactionId: 'transactionId' } as any;\n }\n\n async isBillingSupported(): Promise<{ isBillingSupported: boolean }> {\n console.error('isBillingSupported only mocked in web');\n return { isBillingSupported: false };\n }\n async getPluginVersion(): Promise<{ version: string }> {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async getPurchases(options?: {\n productType?: PURCHASE_TYPE;\n appAccountToken?: string;\n onlyCurrentEntitlements?: boolean;\n }): Promise<{ purchases: Transaction[] }> {\n console.error('getPurchases only mocked in web ' + options);\n return { purchases: [] };\n }\n async manageSubscriptions(): Promise<void> {\n console.error('manageSubscriptions only mocked in web');\n }\n\n async presentOfferCodeRedeemSheet(): Promise<void> {\n console.error('presentOfferCodeRedeemSheet only mocked in web');\n }\n\n async acknowledgePurchase(options: { purchaseToken: string }): Promise<void> {\n void options;\n console.error('acknowledgePurchase only mocked in web');\n }\n\n async consumePurchase(options: { purchaseToken: string }): Promise<void> {\n void options;\n throw new Error('consumePurchase is only available on Android');\n }\n\n async getStorefront(): Promise<{ countryCode: string; storefrontId?: string }> {\n console.error('getStorefront only mocked in web');\n return { countryCode: '' };\n }\n\n async getAppTransaction(): Promise<{ appTransaction: AppTransaction }> {\n console.error('getAppTransaction only mocked in web');\n return {\n appTransaction: {\n originalAppVersion: '1.0.0',\n originalPurchaseDate: new Date().toISOString(),\n bundleId: 'com.example.app',\n appVersion: '1.0.0',\n environment: null,\n },\n };\n }\n\n async isEntitledToOldBusinessModel(options: {\n targetVersion?: string;\n targetBuildNumber?: string;\n }): Promise<{ isOlderVersion: boolean; originalAppVersion: string }> {\n void options;\n console.error('isEntitledToOldBusinessModel only mocked in web');\n return {\n isOlderVersion: false,\n originalAppVersion: '1.0.0',\n };\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,KAAK,CAAC,SAAS,CAAC,OAA8C;QAC5D,KAAK,OAAO,CAAC;IACf,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,OAAyC;QACvE,KAAK,OAAO,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC9D,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAA6D;QACnF,KAAK,OAAO,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAGjB;QACC,OAAO,CAAC,KAAK,CAAC,iC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K,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAClD,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACtD,OAAO;YACL,cAAc,EAAE;gBACd,kBAAkB,EAAE,OAAO;gBAC3B,oBAAoB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBAC9C,QAAQ,EAAE,iBAAiB;gBAC3B,UAAU,EAAE,OAAO;gBACnB,WAAW,EAAE,IAAI;aAClB;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,OAGlC;QACC,KAAK,OAAO,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACjE,OAAO;YACL,cAAc,EAAE,KAAK;YACrB,kBAAkB,EAAE,OAAO;SAC5B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { AppTransaction, NativePurchasesPlugin, Product, PURCHASE_TYPE, Transaction } from './definitions';\n\nexport class NativePurchasesWeb extends WebPlugin implements NativePurchasesPlugin {\n async configure(options?: { autoFinishTransactions?: boolean }): Promise<void> {\n void options;\n }\n\n async getUnfinishedTransactions(options?: { includeUnverified?: boolean }): Promise<{ transactions: Transaction[] }> {\n void options;\n console.error('getUnfinishedTransactions only mocked in web');\n return { transactions: [] };\n }\n\n async finishTransaction(options: { transactionId: string; allowUnverified?: boolean }): Promise<void> {\n void options;\n console.error('finishTransaction only mocked in web');\n }\n\n async restorePurchases(): Promise<void> {\n console.error('restorePurchases only mocked in web');\n }\n\n async getProducts(options: {\n productIdentifiers: string[];\n productType?: PURCHASE_TYPE;\n }): Promise<{ products: Product[] }> {\n console.error('getProducts only mocked in web ' + options);\n return { products: [] };\n }\n\n async getProduct(options: { productIdentifier: string; productType?: PURCHASE_TYPE }): Promise<{ product: Product }> {\n console.error('getProduct only mocked in web ' + options);\n return { product: {} as any };\n }\n\n async purchaseProduct(options: {\n productIdentifier: string;\n planIdentifier?: string;\n offerToken?: string;\n productType?: PURCHASE_TYPE;\n quantity?: number;\n billingPlanType?: 'monthly' | 'upFront';\n appAccountToken?: string;\n isConsumable?: boolean;\n autoAcknowledgePurchases?: boolean;\n }): Promise<Transaction> {\n console.error('purchaseProduct only mocked in web' + options);\n return { transactionId: 'transactionId' } as any;\n }\n\n async isBillingSupported(): Promise<{ isBillingSupported: boolean }> {\n console.error('isBillingSupported only mocked in web');\n return { isBillingSupported: false };\n }\n async getPluginVersion(): Promise<{ version: string }> {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async getPurchases(options?: {\n productType?: PURCHASE_TYPE;\n appAccountToken?: string;\n onlyCurrentEntitlements?: boolean;\n }): Promise<{ purchases: Transaction[] }> {\n console.error('getPurchases only mocked in web ' + options);\n return { purchases: [] };\n }\n async manageSubscriptions(): Promise<void> {\n console.error('manageSubscriptions only mocked in web');\n }\n\n async presentOfferCodeRedeemSheet(): Promise<void> {\n console.error('presentOfferCodeRedeemSheet only mocked in web');\n }\n\n async acknowledgePurchase(options: { purchaseToken: string }): Promise<void> {\n void options;\n console.error('acknowledgePurchase only mocked in web');\n }\n\n async consumePurchase(options: { purchaseToken: string }): Promise<void> {\n void options;\n throw new Error('consumePurchase is only available on Android');\n }\n\n async getStorefront(): Promise<{ countryCode: string; storefrontId?: string }> {\n console.error('getStorefront only mocked in web');\n return { countryCode: '' };\n }\n\n async getAppTransaction(): Promise<{ appTransaction: AppTransaction }> {\n console.error('getAppTransaction only mocked in web');\n return {\n appTransaction: {\n originalAppVersion: '1.0.0',\n originalPurchaseDate: new Date().toISOString(),\n bundleId: 'com.example.app',\n appVersion: '1.0.0',\n environment: null,\n },\n };\n }\n\n async isEntitledToOldBusinessModel(options: {\n targetVersion?: string;\n targetBuildNumber?: string;\n }): Promise<{ isOlderVersion: boolean; originalAppVersion: string }> {\n void options;\n console.error('isEntitledToOldBusinessModel only mocked in web');\n return {\n isOlderVersion: false,\n originalAppVersion: '1.0.0',\n };\n }\n}\n"]}
@@ -137,7 +137,7 @@ const NativePurchases = core.registerPlugin('NativePurchases', {
137
137
  class NativePurchasesWeb extends core.WebPlugin {
138
138
  async configure(options) {
139
139
  }
140
- async getUnfinishedTransactions() {
140
+ async getUnfinishedTransactions(options) {
141
141
  console.error('getUnfinishedTransactions only mocked in web');
142
142
  return { transactions: [] };
143
143
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\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 var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"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[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativePurchases = registerPlugin('NativePurchases', {\n web: () => import('./web').then((m) => new m.NativePurchasesWeb()),\n});\nexport * from './definitions';\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NativePurchasesWeb extends WebPlugin {\n async configure(options) {\n void options;\n }\n async getUnfinishedTransactions() {\n console.error('getUnfinishedTransactions only mocked in web');\n return { transactions: [] };\n }\n async finishTransaction(options) {\n void options;\n console.error('finishTransaction only mocked in web');\n }\n async restorePurchases() {\n console.error('restorePurchases only mocked in web');\n }\n async getProducts(options) {\n console.error('getProducts only mocked in web ' + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error('getProduct only mocked in web ' + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error('purchaseProduct only mocked in web' + options);\n return { transactionId: 'transactionId' };\n }\n async isBillingSupported() {\n console.error('isBillingSupported only mocked in web');\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async getPurchases(options) {\n console.error('getPurchases only mocked in web ' + options);\n return { purchases: [] };\n }\n async manageSubscriptions() {\n console.error('manageSubscriptions only mocked in web');\n }\n async presentOfferCodeRedeemSheet() {\n console.error('presentOfferCodeRedeemSheet only mocked in web');\n }\n async acknowledgePurchase(options) {\n void options;\n console.error('acknowledgePurchase only mocked in web');\n }\n async consumePurchase(options) {\n void options;\n throw new Error('consumePurchase is only available on Android');\n }\n async getStorefront() {\n console.error('getStorefront only mocked in web');\n return { countryCode: '' };\n }\n async getAppTransaction() {\n console.error('getAppTransaction only mocked in web');\n return {\n appTransaction: {\n originalAppVersion: '1.0.0',\n originalPurchaseDate: new Date().toISOString(),\n bundleId: 'com.example.app',\n appVersion: '1.0.0',\n environment: null,\n },\n };\n }\n async isEntitledToOldBusinessModel(options) {\n void options;\n console.error('isEntitledToOldBusinessModel only mocked in web');\n return {\n isOlderVersion: false,\n originalAppVersion: '1.0.0',\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,mBAAmB,EAAE;AAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB;AACzF,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;AACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW;AAC3E,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;AACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;AACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;AACzE,CAAC,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AAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAC9D,gBAAgB,QAAQ,EAAE,iBAAiB;AAC3C,gBAAgB,UAAU,EAAE,OAAO;AACnC,gBAAgB,WAAW,EAAE,IAAI;AACjC,aAAa;AACb,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,4BAA4B,CAAC,OAAO,EAAE;AAEhD,QAAQ,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC;AACxE,QAAQ,OAAO;AACf,YAAY,cAAc,EAAE,KAAK;AACjC,YAAY,kBAAkB,EAAE,OAAO;AACvC,SAAS;AACT,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\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 var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"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[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativePurchases = registerPlugin('NativePurchases', {\n web: () => import('./web').then((m) => new m.NativePurchasesWeb()),\n});\nexport * from './definitions';\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NativePurchasesWeb extends WebPlugin {\n async configure(options) {\n void options;\n }\n async getUnfinishedTransactions(options) {\n void options;\n console.error('getUnfinishedTransactions only mocked in web');\n return { transactions: [] };\n }\n async finishTransaction(options) {\n void options;\n console.error('finishTransaction only mocked in web');\n }\n async restorePurchases() {\n console.error('restorePurchases only mocked in web');\n }\n async getProducts(options) {\n console.error('getProducts only mocked in web ' + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error('getProduct only mocked in web ' + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error('purchaseProduct only mocked in web' + options);\n return { transactionId: 'transactionId' };\n }\n async isBillingSupported() {\n console.error('isBillingSupported only mocked in web');\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async getPurchases(options) {\n console.error('getPurchases only mocked in web ' + options);\n return { purchases: [] };\n }\n async manageSubscriptions() {\n console.error('manageSubscriptions only mocked in web');\n }\n async presentOfferCodeRedeemSheet() {\n console.error('presentOfferCodeRedeemSheet only mocked in web');\n }\n async acknowledgePurchase(options) {\n void options;\n console.error('acknowledgePurchase only mocked in web');\n }\n async consumePurchase(options) {\n void options;\n throw new Error('consumePurchase is only available on Android');\n }\n async getStorefront() {\n console.error('getStorefront only mocked in web');\n return { countryCode: '' };\n }\n async getAppTransaction() {\n console.error('getAppTransaction only mocked in web');\n return {\n appTransaction: {\n originalAppVersion: '1.0.0',\n originalPurchaseDate: new Date().toISOString(),\n bundleId: 'com.example.app',\n appVersion: '1.0.0',\n environment: null,\n },\n };\n }\n async isEntitledToOldBusinessModel(options) {\n void options;\n console.error('isEntitledToOldBusinessModel only mocked in web');\n return {\n isOlderVersion: false,\n originalAppVersion: '1.0.0',\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;;AAAWA;AACX,CAAC,UAAU,mBAAmB,EAAE;AAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB;AACzF,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;AACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW;AAC3E,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;AACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;AACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,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OAAO;AAC3C,gBAAgB,oBAAoB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AAC9D,gBAAgB,QAAQ,EAAE,iBAAiB;AAC3C,gBAAgB,UAAU,EAAE,OAAO;AACnC,gBAAgB,WAAW,EAAE,IAAI;AACjC,aAAa;AACb,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,4BAA4B,CAAC,OAAO,EAAE;AAEhD,QAAQ,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC;AACxE,QAAQ,OAAO;AACf,YAAY,cAAc,EAAE,KAAK;AACjC,YAAY,kBAAkB,EAAE,OAAO;AACvC,SAAS;AACT,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -136,7 +136,7 @@ var capacitorNativePurchases = (function (exports, core) {
136
136
  class NativePurchasesWeb extends core.WebPlugin {
137
137
  async configure(options) {
138
138
  }
139
- async getUnfinishedTransactions() {
139
+ async getUnfinishedTransactions(options) {
140
140
  console.error('getUnfinishedTransactions only mocked in web');
141
141
  return { transactions: [] };
142
142
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\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 var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"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[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativePurchases = registerPlugin('NativePurchases', {\n web: () => import('./web').then((m) => new m.NativePurchasesWeb()),\n});\nexport * from './definitions';\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NativePurchasesWeb extends WebPlugin {\n async configure(options) {\n void options;\n }\n async getUnfinishedTransactions() {\n console.error('getUnfinishedTransactions only mocked in web');\n return { transactions: [] };\n }\n async finishTransaction(options) {\n void options;\n console.error('finishTransaction only mocked in web');\n }\n async restorePurchases() {\n console.error('restorePurchases only mocked in web');\n }\n async getProducts(options) {\n console.error('getProducts only mocked in web ' + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error('getProduct only mocked in web ' + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error('purchaseProduct only mocked in web' + options);\n return { transactionId: 'transactionId' };\n }\n async isBillingSupported() {\n console.error('isBillingSupported only mocked in web');\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async getPurchases(options) {\n console.error('getPurchases only mocked in web ' + options);\n return { purchases: [] };\n }\n async manageSubscriptions() {\n console.error('manageSubscriptions only mocked in web');\n }\n async presentOfferCodeRedeemSheet() {\n console.error('presentOfferCodeRedeemSheet only mocked in web');\n }\n async acknowledgePurchase(options) {\n void options;\n console.error('acknowledgePurchase only mocked in web');\n }\n async consumePurchase(options) {\n void options;\n throw new Error('consumePurchase is only available on Android');\n }\n async getStorefront() {\n console.error('getStorefront only mocked in web');\n return { countryCode: '' };\n }\n async getAppTransaction() {\n console.error('getAppTransaction only mocked in web');\n return {\n appTransaction: {\n originalAppVersion: '1.0.0',\n originalPurchaseDate: new Date().toISOString(),\n bundleId: 'com.example.app',\n appVersion: '1.0.0',\n environment: null,\n },\n };\n }\n async isEntitledToOldBusinessModel(options) {\n void options;\n console.error('isEntitledToOldBusinessModel only mocked in web');\n return {\n isOlderVersion: false,\n originalAppVersion: '1.0.0',\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,mBAAmB,EAAE;IAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB;IACzF,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;IACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,G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KAAK,CAAC,kCAAkC,CAAC;IACzD,QAAQ,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;IAClC,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC;IAC7D,QAAQ,OAAO;IACf,YAAY,cAAc,EAAE;IAC5B,gBAAgB,kBAAkB,EAAE,OAAO;IAC3C,gBAAgB,oBAAoB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IAC9D,gBAAgB,QAAQ,EAAE,iBAAiB;IAC3C,gBAAgB,UAAU,EAAE,OAAO;IACnC,gBAAgB,WAAW,EAAE,IAAI;IACjC,aAAa;IACb,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,4BAA4B,CAAC,OAAO,EAAE;IAEhD,QAAQ,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC;IACxE,QAAQ,OAAO;IACf,YAAY,cAAc,EAAE,KAAK;IACjC,YAAY,kBAAkB,EAAE,OAAO;IACvC,SAAS;IACT,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\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 var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\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 PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"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[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativePurchases = registerPlugin('NativePurchases', {\n web: () => import('./web').then((m) => new m.NativePurchasesWeb()),\n});\nexport * from './definitions';\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NativePurchasesWeb extends WebPlugin {\n async configure(options) {\n void options;\n }\n async getUnfinishedTransactions(options) {\n void options;\n console.error('getUnfinishedTransactions only mocked in web');\n return { transactions: [] };\n }\n async finishTransaction(options) {\n void options;\n console.error('finishTransaction only mocked in web');\n }\n async restorePurchases() {\n console.error('restorePurchases only mocked in web');\n }\n async getProducts(options) {\n console.error('getProducts only mocked in web ' + options);\n return { products: [] };\n }\n async getProduct(options) {\n console.error('getProduct only mocked in web ' + options);\n return { product: {} };\n }\n async purchaseProduct(options) {\n console.error('purchaseProduct only mocked in web' + options);\n return { transactionId: 'transactionId' };\n }\n async isBillingSupported() {\n console.error('isBillingSupported only mocked in web');\n return { isBillingSupported: false };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async getPurchases(options) {\n console.error('getPurchases only mocked in web ' + options);\n return { purchases: [] };\n }\n async manageSubscriptions() {\n console.error('manageSubscriptions only mocked in web');\n }\n async presentOfferCodeRedeemSheet() {\n console.error('presentOfferCodeRedeemSheet only mocked in web');\n }\n async acknowledgePurchase(options) {\n void options;\n console.error('acknowledgePurchase only mocked in web');\n }\n async consumePurchase(options) {\n void options;\n throw new Error('consumePurchase is only available on Android');\n }\n async getStorefront() {\n console.error('getStorefront only mocked in web');\n return { countryCode: '' };\n }\n async getAppTransaction() {\n console.error('getAppTransaction only mocked in web');\n return {\n appTransaction: {\n originalAppVersion: '1.0.0',\n originalPurchaseDate: new Date().toISOString(),\n bundleId: 'com.example.app',\n appVersion: '1.0.0',\n environment: null,\n },\n };\n }\n async isEntitledToOldBusinessModel(options) {\n void options;\n console.error('isEntitledToOldBusinessModel only mocked in web');\n return {\n isOlderVersion: false,\n originalAppVersion: '1.0.0',\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,mBAAmB,EAAE;IAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB;IACzF,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ;IACrE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,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GAAG;IAC1B,QAAQ,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC;IACzD,QAAQ,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;IAClC,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC;IAC7D,QAAQ,OAAO;IACf,YAAY,cAAc,EAAE;IAC5B,gBAAgB,kBAAkB,EAAE,OAAO;IAC3C,gBAAgB,oBAAoB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IAC9D,gBAAgB,QAAQ,EAAE,iBAAiB;IAC3C,gBAAgB,UAAU,EAAE,OAAO;IACnC,gBAAgB,WAAW,EAAE,IAAI;IACjC,aAAa;IACb,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,4BAA4B,CAAC,OAAO,EAAE;IAEhD,QAAQ,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC;IACxE,QAAQ,OAAO;IACf,YAAY,cAAc,EAAE,KAAK;IACjC,YAAY,kBAAkB,EAAE,OAAO;IACvC,SAAS;IACT,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -14,10 +14,14 @@ extension NativePurchasesPlugin {
14
14
  call.resolve()
15
15
  }
16
16
 
17
+ /// Resolves with the unfinished transactions, including unverified ones when `includeUnverified` is true.
17
18
  @objc func getUnfinishedTransactions(_ call: CAPPluginCall) {
19
+ let includeUnverified = call.getBool("includeUnverified") ?? false
18
20
  Task {
19
21
  do {
20
- let transactions = try await TransactionHelpers.collectUnfinishedTransactions()
22
+ let transactions = try await TransactionHelpers.collectUnfinishedTransactions(
23
+ includeUnverified: includeUnverified
24
+ )
21
25
  await MainActor.run {
22
26
  call.resolve(["transactions": transactions])
23
27
  }
@@ -29,6 +33,7 @@ extension NativePurchasesPlugin {
29
33
  }
30
34
  }
31
35
 
36
+ /// Finishes the transaction named by `transactionId`, rejecting unverified ones unless `allowUnverified` is true.
32
37
  @objc func finishTransaction(_ call: CAPPluginCall) {
33
38
  guard let transactionIdString = call.getString("transactionId"), !transactionIdString.isEmpty else {
34
39
  call.reject("transactionId is required")
@@ -40,11 +45,14 @@ extension NativePurchasesPlugin {
40
45
  return
41
46
  }
42
47
 
48
+ let allowUnverified = call.getBool("allowUnverified") ?? false
49
+
43
50
  Task {
44
51
  do {
45
52
  try await finishStoreKitTransaction(
46
53
  transactionId: transactionId,
47
- transactionIdString: transactionIdString
54
+ transactionIdString: transactionIdString,
55
+ allowUnverified: allowUnverified
48
56
  )
49
57
  await MainActor.run { call.resolve() }
50
58
  } catch let error as FinishTransactionError {
@@ -55,7 +63,13 @@ extension NativePurchasesPlugin {
55
63
  }
56
64
  }
57
65
 
58
- func finishStoreKitTransaction(transactionId: UInt64, transactionIdString: String) async throws {
66
+ /// Finishes a StoreKit 2 or legacy transaction, and returns without error if it was already finished.
67
+ /// Throws `FinishTransactionError` if the transaction is unverified and not allowed, or cannot be found.
68
+ func finishStoreKitTransaction(
69
+ transactionId: UInt64,
70
+ transactionIdString: String,
71
+ allowUnverified: Bool = false
72
+ ) async throws {
59
73
  for await result in Transaction.unfinished {
60
74
  switch result {
61
75
  case .verified(let transaction) where transaction.id == transactionId:
@@ -63,16 +77,27 @@ extension NativePurchasesPlugin {
63
77
  await transaction.finish()
64
78
  return
65
79
  case .unverified(let transaction, let error) where transaction.id == transactionId:
66
- throw FinishTransactionError.verificationFailed(error.localizedDescription)
80
+ guard allowUnverified else {
81
+ throw FinishTransactionError.verificationFailed(error.localizedDescription)
82
+ }
83
+ print("Finishing unverified transaction: \(transaction.id)")
84
+ await transaction.finish()
85
+ return
67
86
  default:
68
87
  continue
69
88
  }
70
89
  }
71
90
 
72
91
  for await verificationResult in Transaction.all {
73
- if case .verified(let transaction) = verificationResult, transaction.id == transactionId {
92
+ switch verificationResult {
93
+ case .verified(let transaction) where transaction.id == transactionId:
94
+ print("Transaction \(transactionId) already finished")
95
+ return
96
+ case .unverified(let transaction, _) where allowUnverified && transaction.id == transactionId:
74
97
  print("Transaction \(transactionId) already finished")
75
98
  return
99
+ default:
100
+ continue
76
101
  }
77
102
  }
78
103
 
@@ -26,7 +26,7 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
26
26
  CAPPluginMethod(name: "finishTransaction", returnType: CAPPluginReturnPromise)
27
27
  ]
28
28
 
29
- private let pluginVersion: String = "8.9.6"
29
+ private let pluginVersion: String = "8.9.7"
30
30
  var autoFinishTransactions: Bool = true
31
31
  private var transactionUpdatesTask: Task<Void, Never>?
32
32
 
@@ -146,16 +146,30 @@ internal class TransactionHelpers {
146
146
  return dictionary
147
147
  }
148
148
 
149
- static func collectUnfinishedTransactions() async throws -> [[String: Any]] {
149
+ /// Builds payloads for `Transaction.unfinished`. Unverified entries are skipped unless
150
+ /// `includeUnverified` is true, and then carry `verificationError` so callers can avoid trusting them.
151
+ static func collectUnfinishedTransactions(includeUnverified: Bool = false) async throws -> [[String: Any]] {
150
152
  var unfinished: [[String: Any]] = []
151
153
  for await result in Transaction.unfinished {
152
- guard case .verified(let transaction) = result else { continue }
154
+ let transaction: Transaction
155
+ var verificationError: String?
156
+ switch result {
157
+ case .verified(let verified):
158
+ transaction = verified
159
+ case .unverified(let unverified, let error):
160
+ guard includeUnverified else { continue }
161
+ transaction = unverified
162
+ verificationError = error.localizedDescription
163
+ }
153
164
  var payload = await buildTransactionResponse(
154
165
  from: transaction,
155
166
  jwsRepresentation: result.jwsRepresentation,
156
167
  alwaysIncludeWillCancel: true
157
168
  )
158
169
  payload["needsFinish"] = true
170
+ if let verificationError = verificationError {
171
+ payload["verificationError"] = verificationError
172
+ }
159
173
  unfinished.append(payload)
160
174
  }
161
175
  return unfinished
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-purchases",
3
- "version": "8.9.6",
3
+ "version": "8.9.7",
4
4
  "description": "In-app Subscriptions Made Easy",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",