@revenuecat/purchases-capacitor 10.0.2 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -54,6 +54,8 @@ This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package
54
54
  <docgen-index>
55
55
 
56
56
  * [`configure(...)`](#configure)
57
+ * [`parseAsWebPurchaseRedemption(...)`](#parseaswebpurchaseredemption)
58
+ * [`redeemWebPurchase(...)`](#redeemwebpurchase)
57
59
  * [`setMockWebResults(...)`](#setmockwebresults)
58
60
  * [`setSimulatesAskToBuyInSandbox(...)`](#setsimulatesasktobuyinsandbox)
59
61
  * [`addCustomerInfoUpdateListener(...)`](#addcustomerinfoupdatelistener)
@@ -141,6 +143,40 @@ Sets up Purchases with your API key and an app user id.
141
143
  --------------------
142
144
 
143
145
 
146
+ ### parseAsWebPurchaseRedemption(...)
147
+
148
+ ```typescript
149
+ parseAsWebPurchaseRedemption(options: { urlString: string; }) => Promise<{ webPurchaseRedemption: WebPurchaseRedemption | null; }>
150
+ ```
151
+
152
+ Parses the given URL string into a [WebPurchaseRedemption] object that can be used to redeem web purchases.
153
+
154
+ | Param | Type | Description |
155
+ | ------------- | ----------------------------------- | --------------------------------------- |
156
+ | **`options`** | <code>{ urlString: string; }</code> | Set the urlString used to open the App. |
157
+
158
+ **Returns:** <code>Promise&lt;{ webPurchaseRedemption: <a href="#webpurchaseredemption">WebPurchaseRedemption</a> | null; }&gt;</code>
159
+
160
+ --------------------
161
+
162
+
163
+ ### redeemWebPurchase(...)
164
+
165
+ ```typescript
166
+ redeemWebPurchase(options: { webPurchaseRedemption: WebPurchaseRedemption; }) => Promise<WebPurchaseRedemptionResult>
167
+ ```
168
+
169
+ Redeems the web purchase associated with the Redemption Link obtained with [parseAsWebPurchaseRedemption].
170
+
171
+ | Param | Type | Description |
172
+ | ------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
173
+ | **`options`** | <code>{ webPurchaseRedemption: <a href="#webpurchaseredemption">WebPurchaseRedemption</a>; }</code> | The <a href="#webpurchaseredemption">WebPurchaseRedemption</a> object obtained from {@link parseAsWebPurchaseRedemption}. |
174
+
175
+ **Returns:** <code>Promise&lt;<a href="#webpurchaseredemptionresult">WebPurchaseRedemptionResult</a>&gt;</code>
176
+
177
+ --------------------
178
+
179
+
144
180
  ### setMockWebResults(...)
145
181
 
146
182
  ```typescript
@@ -1132,7 +1168,7 @@ If called in an unsupported platform (Android or iOS &lt; 15), an `UnsupportedPl
1132
1168
  showInAppMessages(options?: { messageTypes?: IN_APP_MESSAGE_TYPE[] | undefined; } | undefined) => Promise<void>
1133
1169
  ```
1134
1170
 
1135
- Shows in-app messages available from the App Store or Google Play. You need to disable messages from showing
1171
+ Shows in-app messages available from the App <a href="#store">Store</a> or Google Play. You need to disable messages from showing
1136
1172
  automatically using [PurchasesConfiguration.shouldShowInAppMessagesAutomatically].
1137
1173
 
1138
1174
  Note: In iOS, this requires version 16+. In older versions the promise will be resolved successfully
@@ -1173,7 +1209,7 @@ Holds parameters to initialize the SDK.
1173
1209
  | **`userDefaultsSuiteName`** | <code>string</code> | An optional string. iOS-only, will be ignored for Android. Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults suite, otherwise it will use standardUserDefaults. Default is null, which will make the SDK use standardUserDefaults. |
1174
1210
  | **`storeKitVersion`** | <code><a href="#storekit_version">STOREKIT_VERSION</a></code> | iOS-only, will be ignored for Android. By selecting the DEFAULT value, RevenueCat will automatically select the most appropriate StoreKit version for the app's runtime environment. - Warning: Make sure you have an In-App Purchase Key configured in your app. Please see https://rev.cat/in-app-purchase-key-configuration for more info. - Note: StoreKit 2 is only available on iOS 16+. StoreKit 1 will be used for previous iOS versions regardless of this setting. |
1175
1211
  | **`useAmazon`** | <code>boolean</code> | An optional boolean. Android only. Required to configure the plugin to be used in the Amazon Appstore. |
1176
- | **`shouldShowInAppMessagesAutomatically`** | <code>boolean</code> | Whether we should show store in-app messages automatically. Both Google Play and the App Store provide in-app messages for some situations like billing issues. By default, those messages will be shown automatically. This allows to disable that behavior, so you can display those messages at your convenience. For more information, check: https://rev.cat/storekit-message and https://rev.cat/googleplayinappmessaging |
1212
+ | **`shouldShowInAppMessagesAutomatically`** | <code>boolean</code> | Whether we should show store in-app messages automatically. Both Google Play and the App <a href="#store">Store</a> provide in-app messages for some situations like billing issues. By default, those messages will be shown automatically. This allows to disable that behavior, so you can display those messages at your convenience. For more information, check: https://rev.cat/storekit-message and https://rev.cat/googleplayinappmessaging |
1177
1213
  | **`entitlementVerificationMode`** | <code><a href="#entitlement_verification_mode">ENTITLEMENT_VERIFICATION_MODE</a></code> | Verification strictness levels for [EntitlementInfo]. See https://rev.cat/trusted-entitlements for more info. |
1178
1214
  | **`pendingTransactionsForPrepaidPlansEnabled`** | <code>boolean</code> | Enable this setting if you want to allow pending purchases for prepaid subscriptions (only supported in Google Play). Note that entitlements are not granted until payment is done. Disabled by default. |
1179
1215
  | **`diagnosticsEnabled`** | <code>boolean</code> | Enabling diagnostics will send some performance and debugging information from the SDK to RevenueCat's servers. Examples of this information include response times, cache hits or error codes. No personal identifiable information will be collected. The default value is false. |
@@ -1183,21 +1219,22 @@ Holds parameters to initialize the SDK.
1183
1219
 
1184
1220
  Type containing all information regarding the customer
1185
1221
 
1186
- | Prop | Type | Description |
1187
- | ------------------------------------ | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1188
- | **`entitlements`** | <code><a href="#purchasesentitlementinfos">PurchasesEntitlementInfos</a></code> | Entitlements attached to this customer info |
1189
- | **`activeSubscriptions`** | <code>string[]</code> | Set of active subscription skus |
1190
- | **`allPurchasedProductIdentifiers`** | <code>string[]</code> | Set of purchased skus, active and inactive |
1191
- | **`latestExpirationDate`** | <code>string \| null</code> | The latest expiration date of all purchased skus |
1192
- | **`firstSeen`** | <code>string</code> | The date this user was first seen in RevenueCat. |
1193
- | **`originalAppUserId`** | <code>string</code> | The original App User Id recorded for this user. |
1194
- | **`requestDate`** | <code>string</code> | Date when this info was requested |
1195
- | **`allExpirationDates`** | <code>{ [key: string]: string \| null; }</code> | Map of skus to expiration dates |
1196
- | **`allPurchaseDates`** | <code>{ [key: string]: string \| null; }</code> | Map of skus to purchase dates |
1197
- | **`originalApplicationVersion`** | <code>string \| null</code> | Returns the version number for the version of the application when the user bought the app. Use this for grandfathering users when migrating to subscriptions. This corresponds to the value of CFBundleVersion (in iOS) in the Info.plist file when the purchase was originally made. This is always null in Android |
1198
- | **`originalPurchaseDate`** | <code>string \| null</code> | Returns the purchase date for the version of the application when the user bought the app. Use this for grandfathering users when migrating to subscriptions. |
1199
- | **`managementURL`** | <code>string \| null</code> | URL to manage the active subscription of the user. If this user has an active iOS subscription, this will point to the App Store, if the user has an active Play Store subscription it will point there. If there are no active subscriptions it will be null. If there are multiple for different platforms, it will point to the device store. |
1200
- | **`nonSubscriptionTransactions`** | <code>PurchasesStoreTransaction[]</code> | List of all non subscription transactions. Use this to fetch the history of non-subscription purchases |
1222
+ | Prop | Type | Description |
1223
+ | -------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1224
+ | **`entitlements`** | <code><a href="#purchasesentitlementinfos">PurchasesEntitlementInfos</a></code> | Entitlements attached to this customer info |
1225
+ | **`activeSubscriptions`** | <code>string[]</code> | Set of active subscription skus |
1226
+ | **`allPurchasedProductIdentifiers`** | <code>string[]</code> | Set of purchased skus, active and inactive |
1227
+ | **`latestExpirationDate`** | <code>string \| null</code> | The latest expiration date of all purchased skus |
1228
+ | **`firstSeen`** | <code>string</code> | The date this user was first seen in RevenueCat. |
1229
+ | **`originalAppUserId`** | <code>string</code> | The original App User Id recorded for this user. |
1230
+ | **`requestDate`** | <code>string</code> | Date when this info was requested |
1231
+ | **`allExpirationDates`** | <code>{ [key: string]: string \| null; }</code> | Map of skus to expiration dates |
1232
+ | **`allPurchaseDates`** | <code>{ [key: string]: string \| null; }</code> | Map of skus to purchase dates |
1233
+ | **`originalApplicationVersion`** | <code>string \| null</code> | Returns the version number for the version of the application when the user bought the app. Use this for grandfathering users when migrating to subscriptions. This corresponds to the value of CFBundleVersion (in iOS) in the Info.plist file when the purchase was originally made. This is always null in Android |
1234
+ | **`originalPurchaseDate`** | <code>string \| null</code> | Returns the purchase date for the version of the application when the user bought the app. Use this for grandfathering users when migrating to subscriptions. |
1235
+ | **`managementURL`** | <code>string \| null</code> | URL to manage the active subscription of the user. If this user has an active iOS subscription, this will point to the App <a href="#store">Store</a>, if the user has an active Play <a href="#store">Store</a> subscription it will point there. If there are no active subscriptions it will be null. If there are multiple for different platforms, it will point to the device store. |
1236
+ | **`nonSubscriptionTransactions`** | <code>PurchasesStoreTransaction[]</code> | List of all non subscription transactions. Use this to fetch the history of non-subscription purchases |
1237
+ | **`subscriptionsByProductIdentifier`** | <code>{ [key: string]: <a href="#purchasessubscriptioninfo">PurchasesSubscriptionInfo</a>; }</code> | Information about the customer's subscriptions for each product identifier. |
1201
1238
 
1202
1239
 
1203
1240
  #### PurchasesEntitlementInfos
@@ -1215,33 +1252,33 @@ Contains all the entitlements associated to the user.
1215
1252
 
1216
1253
  The EntitlementInfo object gives you access to all of the information about the status of a user entitlement.
1217
1254
 
1218
- | Prop | Type | Description |
1219
- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1220
- | **`identifier`** | <code>string</code> | The entitlement identifier configured in the RevenueCat dashboard |
1221
- | **`isActive`** | <code>boolean</code> | True if the user has access to this entitlement |
1222
- | **`willRenew`** | <code>boolean</code> | True if the underlying subscription is set to renew at the end of the billing period (expirationDate). |
1223
- | **`periodType`** | <code>string</code> | The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL. |
1224
- | **`latestPurchaseDate`** | <code>string</code> | The latest purchase or renewal date for the entitlement in ISO8601 format. |
1225
- | **`latestPurchaseDateMillis`** | <code>number</code> | The latest purchase or renewal date for the entitlement in milliseconds. |
1226
- | **`originalPurchaseDate`** | <code>string</code> | The first date this entitlement was purchased in ISO8601 format. |
1227
- | **`originalPurchaseDateMillis`** | <code>number</code> | The first date this entitlement was purchased in milliseconds. |
1228
- | **`expirationDate`** | <code>string \| null</code> | The expiration date for the entitlement in ISO8601, can be `null` for lifetime access. If the `periodType` is `trial`, this is the trial expiration date. |
1229
- | **`expirationDateMillis`** | <code>number \| null</code> | The expiration date for the entitlement in milliseconds, can be `null` for lifetime access. If the `periodType` is `trial`, this is the trial expiration date. |
1230
- | **`store`** | <code>'PLAY_STORE' \| 'APP_STORE' \| 'STRIPE' \| 'MAC_APP_STORE' \| 'PROMOTIONAL' \| 'AMAZON' \| 'RC_BILLING' \| 'EXTERNAL' \| 'UNKNOWN_STORE'</code> | The store where this entitlement was unlocked from. |
1231
- | **`productIdentifier`** | <code>string</code> | The product identifier that unlocked this entitlement |
1232
- | **`productPlanIdentifier`** | <code>string \| null</code> | The product plan identifier that unlocked this entitlement. Android subscriptions only, null on consumables and iOS. |
1233
- | **`isSandbox`** | <code>boolean</code> | False if this entitlement is unlocked via a production purchase |
1234
- | **`unsubscribeDetectedAt`** | <code>string \| null</code> | The date an unsubscribe was detected in ISO8601 format. Can be `null`. Entitlement may still be active even if user has unsubscribed. Check the `isActive` property. |
1235
- | **`unsubscribeDetectedAtMillis`** | <code>number \| null</code> | The date an unsubscribe was detected in milliseconds. Can be `null`. Entitlement may still be active even if user has unsubscribed. Check the `isActive` property. |
1236
- | **`billingIssueDetectedAt`** | <code>string \| null</code> | The date a billing issue was detected in ISO8601 format. Can be `null` if there is no billing issue or an issue has been resolved Entitlement may still be active even if there is a billing issue. Check the `isActive` property. |
1237
- | **`billingIssueDetectedAtMillis`** | <code>number \| null</code> | The date a billing issue was detected in milliseconds. Can be `null` if there is no billing issue or an issue has been resolved Entitlement may still be active even if there is a billing issue. Check the `isActive` property. |
1238
- | **`ownershipType`** | <code>'FAMILY_SHARED' \| 'PURCHASED' \| 'UNKNOWN'</code> | Supported ownership types for an entitlement. PURCHASED if the purchase was made directly by this user. FAMILY_SHARED if the purchase has been shared to this user by a family member. UNKNOWN if the purchase has no or an unknown ownership type. |
1239
- | **`verification`** | <code><a href="#verification_result">VERIFICATION_RESULT</a></code> | If entitlement verification was enabled, the result of that verification. If not, VerificationResult.NOT_REQUESTED |
1255
+ | Prop | Type | Description |
1256
+ | ---------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1257
+ | **`identifier`** | <code>string</code> | The entitlement identifier configured in the RevenueCat dashboard |
1258
+ | **`isActive`** | <code>boolean</code> | True if the user has access to this entitlement |
1259
+ | **`willRenew`** | <code>boolean</code> | True if the underlying subscription is set to renew at the end of the billing period (expirationDate). |
1260
+ | **`periodType`** | <code>string</code> | The last period type this entitlement was in. Either: NORMAL, INTRO, TRIAL, PREPAID. |
1261
+ | **`latestPurchaseDate`** | <code>string</code> | The latest purchase or renewal date for the entitlement in ISO8601 format. |
1262
+ | **`latestPurchaseDateMillis`** | <code>number</code> | The latest purchase or renewal date for the entitlement in milliseconds. |
1263
+ | **`originalPurchaseDate`** | <code>string</code> | The first date this entitlement was purchased in ISO8601 format. |
1264
+ | **`originalPurchaseDateMillis`** | <code>number</code> | The first date this entitlement was purchased in milliseconds. |
1265
+ | **`expirationDate`** | <code>string \| null</code> | The expiration date for the entitlement in ISO8601, can be `null` for lifetime access. If the `periodType` is `trial`, this is the trial expiration date. |
1266
+ | **`expirationDateMillis`** | <code>number \| null</code> | The expiration date for the entitlement in milliseconds, can be `null` for lifetime access. If the `periodType` is `trial`, this is the trial expiration date. |
1267
+ | **`store`** | <code><a href="#store">Store</a></code> | The store where this entitlement was unlocked from. |
1268
+ | **`productIdentifier`** | <code>string</code> | The product identifier that unlocked this entitlement |
1269
+ | **`productPlanIdentifier`** | <code>string \| null</code> | The product plan identifier that unlocked this entitlement. Android subscriptions only, null on consumables and iOS. |
1270
+ | **`isSandbox`** | <code>boolean</code> | False if this entitlement is unlocked via a production purchase |
1271
+ | **`unsubscribeDetectedAt`** | <code>string \| null</code> | The date an unsubscribe was detected in ISO8601 format. Can be `null`. Entitlement may still be active even if user has unsubscribed. Check the `isActive` property. |
1272
+ | **`unsubscribeDetectedAtMillis`** | <code>number \| null</code> | The date an unsubscribe was detected in milliseconds. Can be `null`. Entitlement may still be active even if user has unsubscribed. Check the `isActive` property. |
1273
+ | **`billingIssueDetectedAt`** | <code>string \| null</code> | The date a billing issue was detected in ISO8601 format. Can be `null` if there is no billing issue or an issue has been resolved Entitlement may still be active even if there is a billing issue. Check the `isActive` property. |
1274
+ | **`billingIssueDetectedAtMillis`** | <code>number \| null</code> | The date a billing issue was detected in milliseconds. Can be `null` if there is no billing issue or an issue has been resolved Entitlement may still be active even if there is a billing issue. Check the `isActive` property. |
1275
+ | **`ownershipType`** | <code><a href="#ownershiptype">OwnershipType</a></code> | Supported ownership types for an entitlement. PURCHASED if the purchase was made directly by this user. FAMILY_SHARED if the purchase has been shared to this user by a family member. UNKNOWN if the purchase has no or an unknown ownership type. |
1276
+ | **`verification`** | <code><a href="#verification_result">VERIFICATION_RESULT</a></code> | If entitlement verification was enabled, the result of that verification. If not, VerificationResult.NOT_REQUESTED |
1240
1277
 
1241
1278
 
1242
1279
  #### PurchasesStoreTransaction
1243
1280
 
1244
- Represents a non-subscription transaction in the Store.
1281
+ Represents a non-subscription transaction in the <a href="#store">Store</a>.
1245
1282
 
1246
1283
  | Prop | Type | Description |
1247
1284
  | --------------------------- | ------------------- | ---------------------------------------------------- |
@@ -1250,6 +1287,52 @@ Represents a non-subscription transaction in the Store.
1250
1287
  | **`purchaseDate`** | <code>string</code> | Purchase date of the transaction in ISO 8601 format. |
1251
1288
 
1252
1289
 
1290
+ #### PurchasesSubscriptionInfo
1291
+
1292
+ Subscription purchases of the Customer.
1293
+
1294
+ | Prop | Type | Description |
1295
+ | ----------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1296
+ | **`productIdentifier`** | <code>string</code> | The product identifier. |
1297
+ | **`purchaseDate`** | <code>string</code> | Date when the last subscription period started. |
1298
+ | **`originalPurchaseDate`** | <code>string \| null</code> | Date when this subscription first started. This property does not update with renewals. This property also does not update for product changes within a subscription group or re-subscriptions by lapsed subscribers. |
1299
+ | **`expiresDate`** | <code>string \| null</code> | Date when the subscription expires/expired |
1300
+ | **`store`** | <code><a href="#store">Store</a></code> | <a href="#store">Store</a> where the subscription was purchased. |
1301
+ | **`unsubscribeDetectedAt`** | <code>string \| null</code> | Date when RevenueCat detected that auto-renewal was turned off for this subscription. Note the subscription may still be active, check the `expiresDate` attribute. |
1302
+ | **`isSandbox`** | <code>boolean</code> | Whether or not the purchase was made in sandbox mode. |
1303
+ | **`billingIssuesDetectedAt`** | <code>string \| null</code> | Date when RevenueCat detected any billing issues with this subscription. If and when the billing issue gets resolved, this field is set to nil. |
1304
+ | **`gracePeriodExpiresDate`** | <code>string \| null</code> | Date when any grace period for this subscription expires/expired. nil if the customer has never been in a grace period. |
1305
+ | **`ownershipType`** | <code><a href="#ownershiptype">OwnershipType</a></code> | How the Customer received access to this subscription: - [OwnershipType.PURCHASED]: The customer bought the subscription. - [OwnershipType.FAMILY_SHARED]: The Customer has access to the product via their family. |
1306
+ | **`periodType`** | <code><a href="#periodtype">PeriodType</a></code> | Type of the current subscription period: - [PeriodType.NORMAL]: The product is in a normal period (default) - [PeriodType.TRIAL]: The product is in a free trial period - [PeriodType.INTRO]: The product is in an introductory pricing period - [PeriodType.PREPAID]: The product is in a prepaid pricing period |
1307
+ | **`refundedAt`** | <code>string \| null</code> | Date when RevenueCat detected a refund of this subscription. |
1308
+ | **`storeTransactionId`** | <code>string \| null</code> | The transaction id in the store of the subscription. |
1309
+ | **`isActive`** | <code>boolean</code> | Whether the subscription is currently active. |
1310
+ | **`willRenew`** | <code>boolean</code> | Whether the subscription will renew at the next billing period. |
1311
+
1312
+
1313
+ #### PurchasesError
1314
+
1315
+ Type encapsulating an error in an SDK operation.
1316
+
1317
+ | Prop | Type |
1318
+ | ---------------------------- | --------------------------------------------------------------------- |
1319
+ | **`code`** | <code><a href="#purchases_error_code">PURCHASES_ERROR_CODE</a></code> |
1320
+ | **`message`** | <code>string</code> |
1321
+ | **`readableErrorCode`** | <code>string</code> |
1322
+ | **`userInfo`** | <code><a href="#errorinfo">ErrorInfo</a></code> |
1323
+ | **`underlyingErrorMessage`** | <code>string</code> |
1324
+ | **`userCancelled`** | <code>boolean \| null</code> |
1325
+
1326
+
1327
+ #### ErrorInfo
1328
+
1329
+ Type encapsulating extra info on an error in an SDK operation.
1330
+
1331
+ | Prop | Type |
1332
+ | ----------------------- | ------------------- |
1333
+ | **`readableErrorCode`** | <code>string</code> |
1334
+
1335
+
1253
1336
  #### PurchasesOfferings
1254
1337
 
1255
1338
  Contains all the offerings configured in RevenueCat dashboard.
@@ -1297,7 +1380,7 @@ For more info see https://docs.revenuecat.com/docs/entitlements
1297
1380
 
1298
1381
  #### PurchasesStoreProduct
1299
1382
 
1300
- Type representing a product from the Store.
1383
+ Type representing a product from the <a href="#store">Store</a>.
1301
1384
 
1302
1385
  | Prop | Type | Description |
1303
1386
  | --------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -1479,7 +1562,7 @@ Holds the information used when upgrading from another sku. For Android use only
1479
1562
 
1480
1563
  #### PurchasesPromotionalOffer
1481
1564
 
1482
- Holds the information about a PromotionalOffer in Apple's App Store.
1565
+ Holds the information about a PromotionalOffer in Apple's App <a href="#store">Store</a>.
1483
1566
 
1484
1567
  | Prop | Type |
1485
1568
  | ------------------- | ------------------- |
@@ -1557,7 +1640,7 @@ Holds the introductory price status
1557
1640
 
1558
1641
  #### PurchasesWinBackOffer
1559
1642
 
1560
- Holds the information about a Win-Back Offer in Apple's App Store.
1643
+ Holds the information about a Win-Back Offer in Apple's App <a href="#store">Store</a>.
1561
1644
 
1562
1645
 
1563
1646
  #### GetEligibleWinBackOffersForProductOptions
@@ -1627,6 +1710,41 @@ Configuration option that specifies that your app will complete purchases.
1627
1710
  <code>{ type: <a href="#purchases_are_completed_by_type">PURCHASES_ARE_COMPLETED_BY_TYPE.MY_APP</a>; /** * The version of StoreKit that your app is using to make purchases. This value is ignored * on Android, so if your app is Android-only, you may provide any value. */ storeKitVersion: <a href="#storekit_version">STOREKIT_VERSION</a>; }</code>
1628
1711
 
1629
1712
 
1713
+ #### WebPurchaseRedemption
1714
+
1715
+ An object containing the redemption link to be redeemed.
1716
+
1717
+ <code>{ /** * The redemption link to be redeemed. */ redemptionLink: string; }</code>
1718
+
1719
+
1720
+ #### WebPurchaseRedemptionResult
1721
+
1722
+ The result of a redemption attempt.
1723
+
1724
+ <code>{ result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.SUCCESS</a>; customerInfo: <a href="#customerinfo">CustomerInfo</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.ERROR</a>; error: <a href="#purchaseserror">PurchasesError</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.PURCHASE_BELONGS_TO_OTHER_USER</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.INVALID_TOKEN</a>; } | { result: <a href="#webpurchaseredemptionresulttype">WebPurchaseRedemptionResultType.EXPIRED</a>; obfuscatedEmail: string; }</code>
1725
+
1726
+
1727
+ #### Store
1728
+
1729
+ The supported stores for purchases.
1730
+
1731
+ <code>"PLAY_STORE" | "APP_STORE" | "STRIPE" | "MAC_APP_STORE" | "PROMOTIONAL" | "AMAZON" | "RC_BILLING" | "EXTERNAL" | "UNKNOWN_STORE"</code>
1732
+
1733
+
1734
+ #### OwnershipType
1735
+
1736
+ The supported ownership types for an entitlement.
1737
+
1738
+ <code>"PURCHASED" | "FAMILY_SHARED" | "UNKNOWN"</code>
1739
+
1740
+
1741
+ #### PeriodType
1742
+
1743
+ The supported period types for an entitlement.
1744
+
1745
+ <code>"NORMAL" | "INTRO" | "TRIAL" | "PREPAID"</code>
1746
+
1747
+
1630
1748
  #### CustomerInfoUpdateListener
1631
1749
 
1632
1750
  Listener used on updated customer info
@@ -1686,6 +1804,17 @@ Listener used to receive log messages from the SDK.
1686
1804
  | **`INFORMATIONAL`** | <code>"INFORMATIONAL"</code> | Enable entitlement verification. If verification fails, this will be indicated with [VerificationResult.FAILED] in the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail (i.e. Entitlements will still be granted). This can be useful if you want to handle verification failures to display an error/warning to the user or to track this situation but still grant access. |
1687
1805
 
1688
1806
 
1807
+ #### WebPurchaseRedemptionResultType
1808
+
1809
+ | Members | Value | Description |
1810
+ | ------------------------------------ | --------------------------------------------- | -------------------------------------------------------------------------------------------- |
1811
+ | **`SUCCESS`** | <code>"SUCCESS"</code> | The redemption was successful. |
1812
+ | **`ERROR`** | <code>"ERROR"</code> | The redemption failed. |
1813
+ | **`PURCHASE_BELONGS_TO_OTHER_USER`** | <code>"PURCHASE_BELONGS_TO_OTHER_USER"</code> | The purchase associated to the link belongs to another user. |
1814
+ | **`INVALID_TOKEN`** | <code>"INVALID_TOKEN"</code> | The token is invalid. |
1815
+ | **`EXPIRED`** | <code>"EXPIRED"</code> | The token has expired. A new Redemption Link will be sent to the email used during purchase. |
1816
+
1817
+
1689
1818
  #### VERIFICATION_RESULT
1690
1819
 
1691
1820
  | Members | Value | Description |
@@ -1696,6 +1825,47 @@ Listener used to receive log messages from the SDK.
1696
1825
  | **`VERIFIED_ON_DEVICE`** | <code>"VERIFIED_ON_DEVICE"</code> | Verification was performed on device. |
1697
1826
 
1698
1827
 
1828
+ #### PURCHASES_ERROR_CODE
1829
+
1830
+ | Members | Value |
1831
+ | ------------------------------------------------------------------ | ----------------- |
1832
+ | **`UNKNOWN_ERROR`** | <code>"0"</code> |
1833
+ | **`PURCHASE_CANCELLED_ERROR`** | <code>"1"</code> |
1834
+ | **`STORE_PROBLEM_ERROR`** | <code>"2"</code> |
1835
+ | **`PURCHASE_NOT_ALLOWED_ERROR`** | <code>"3"</code> |
1836
+ | **`PURCHASE_INVALID_ERROR`** | <code>"4"</code> |
1837
+ | **`PRODUCT_NOT_AVAILABLE_FOR_PURCHASE_ERROR`** | <code>"5"</code> |
1838
+ | **`PRODUCT_ALREADY_PURCHASED_ERROR`** | <code>"6"</code> |
1839
+ | **`RECEIPT_ALREADY_IN_USE_ERROR`** | <code>"7"</code> |
1840
+ | **`INVALID_RECEIPT_ERROR`** | <code>"8"</code> |
1841
+ | **`MISSING_RECEIPT_FILE_ERROR`** | <code>"9"</code> |
1842
+ | **`NETWORK_ERROR`** | <code>"10"</code> |
1843
+ | **`INVALID_CREDENTIALS_ERROR`** | <code>"11"</code> |
1844
+ | **`UNEXPECTED_BACKEND_RESPONSE_ERROR`** | <code>"12"</code> |
1845
+ | **`RECEIPT_IN_USE_BY_OTHER_SUBSCRIBER_ERROR`** | <code>"13"</code> |
1846
+ | **`INVALID_APP_USER_ID_ERROR`** | <code>"14"</code> |
1847
+ | **`OPERATION_ALREADY_IN_PROGRESS_ERROR`** | <code>"15"</code> |
1848
+ | **`UNKNOWN_BACKEND_ERROR`** | <code>"16"</code> |
1849
+ | **`INVALID_APPLE_SUBSCRIPTION_KEY_ERROR`** | <code>"17"</code> |
1850
+ | **`INELIGIBLE_ERROR`** | <code>"18"</code> |
1851
+ | **`INSUFFICIENT_PERMISSIONS_ERROR`** | <code>"19"</code> |
1852
+ | **`PAYMENT_PENDING_ERROR`** | <code>"20"</code> |
1853
+ | **`INVALID_SUBSCRIBER_ATTRIBUTES_ERROR`** | <code>"21"</code> |
1854
+ | **`LOG_OUT_ANONYMOUS_USER_ERROR`** | <code>"22"</code> |
1855
+ | **`CONFIGURATION_ERROR`** | <code>"23"</code> |
1856
+ | **`UNSUPPORTED_ERROR`** | <code>"24"</code> |
1857
+ | **`EMPTY_SUBSCRIBER_ATTRIBUTES_ERROR`** | <code>"25"</code> |
1858
+ | **`PRODUCT_DISCOUNT_MISSING_IDENTIFIER_ERROR`** | <code>"26"</code> |
1859
+ | **`PRODUCT_DISCOUNT_MISSING_SUBSCRIPTION_GROUP_IDENTIFIER_ERROR`** | <code>"28"</code> |
1860
+ | **`CUSTOMER_INFO_ERROR`** | <code>"29"</code> |
1861
+ | **`SYSTEM_INFO_ERROR`** | <code>"30"</code> |
1862
+ | **`BEGIN_REFUND_REQUEST_ERROR`** | <code>"31"</code> |
1863
+ | **`PRODUCT_REQUEST_TIMED_OUT_ERROR`** | <code>"32"</code> |
1864
+ | **`API_ENDPOINT_BLOCKED`** | <code>"33"</code> |
1865
+ | **`INVALID_PROMOTIONAL_OFFER_ERROR`** | <code>"34"</code> |
1866
+ | **`OFFLINE_CONNECTION_ERROR`** | <code>"35"</code> |
1867
+
1868
+
1699
1869
  #### PACKAGE_TYPE
1700
1870
 
1701
1871
  | Members | Value | Description |
@@ -1722,14 +1892,14 @@ Listener used to receive log messages from the SDK.
1722
1892
 
1723
1893
  #### PRODUCT_TYPE
1724
1894
 
1725
- | Members | Value | Description |
1726
- | --------------------------------- | ------------------------------------------ | ----------------------------------------------------------------------- |
1727
- | **`CONSUMABLE`** | <code>"CONSUMABLE"</code> | A consumable in-app purchase. |
1728
- | **`NON_CONSUMABLE`** | <code>"NON_CONSUMABLE"</code> | A non-consumable in-app purchase. Only applies to Apple Store products. |
1729
- | **`NON_RENEWABLE_SUBSCRIPTION`** | <code>"NON_RENEWABLE_SUBSCRIPTION"</code> | A non-renewing subscription. Only applies to Apple Store products. |
1730
- | **`AUTO_RENEWABLE_SUBSCRIPTION`** | <code>"AUTO_RENEWABLE_SUBSCRIPTION"</code> | An auto-renewable subscription. |
1731
- | **`PREPAID_SUBSCRIPTION`** | <code>"PREPAID_SUBSCRIPTION"</code> | A subscription that is pre-paid. Only applies to Google Play products. |
1732
- | **`UNKNOWN`** | <code>"UNKNOWN"</code> | Unable to determine product type. |
1895
+ | Members | Value | Description |
1896
+ | --------------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------- |
1897
+ | **`CONSUMABLE`** | <code>"CONSUMABLE"</code> | A consumable in-app purchase. |
1898
+ | **`NON_CONSUMABLE`** | <code>"NON_CONSUMABLE"</code> | A non-consumable in-app purchase. Only applies to Apple <a href="#store">Store</a> products. |
1899
+ | **`NON_RENEWABLE_SUBSCRIPTION`** | <code>"NON_RENEWABLE_SUBSCRIPTION"</code> | A non-renewing subscription. Only applies to Apple <a href="#store">Store</a> products. |
1900
+ | **`AUTO_RENEWABLE_SUBSCRIPTION`** | <code>"AUTO_RENEWABLE_SUBSCRIPTION"</code> | An auto-renewable subscription. |
1901
+ | **`PREPAID_SUBSCRIPTION`** | <code>"PREPAID_SUBSCRIPTION"</code> | A subscription that is pre-paid. Only applies to Google Play products. |
1902
+ | **`UNKNOWN`** | <code>"UNKNOWN"</code> | Unable to determine product type. |
1733
1903
 
1734
1904
 
1735
1905
  #### PERIOD_UNIT
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '14.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'PurchasesHybridCommon', '13.17.1'
16
+ s.dependency 'PurchasesHybridCommon', '13.24.0'
17
17
  s.swift_version = '5.1'
18
18
  end
@@ -56,7 +56,7 @@ dependencies {
56
56
  implementation fileTree(dir: 'libs', include: ['*.jar'])
57
57
  implementation project(':capacitor-android')
58
58
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
59
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.17.1'
59
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.24.0'
60
60
  testImplementation "junit:junit:$junitVersion"
61
61
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
62
62
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -20,6 +20,7 @@ import com.revenuecat.purchases.hybridcommon.OnResultAny
20
20
  import com.revenuecat.purchases.hybridcommon.OnResultList
21
21
  import com.revenuecat.purchases.hybridcommon.configure
22
22
  import com.revenuecat.purchases.hybridcommon.getProductInfo
23
+ import com.revenuecat.purchases.hybridcommon.isWebPurchaseRedemptionURL
23
24
  import com.revenuecat.purchases.hybridcommon.mappers.convertToMap
24
25
  import com.revenuecat.purchases.hybridcommon.mappers.map
25
26
  import com.revenuecat.purchases.hybridcommon.purchaseProduct
@@ -40,6 +41,7 @@ import com.revenuecat.purchases.hybridcommon.logIn as logInCommon
40
41
  import com.revenuecat.purchases.hybridcommon.logOut as logOutCommon
41
42
  import com.revenuecat.purchases.hybridcommon.purchasePackage as purchasePackageCommon
42
43
  import com.revenuecat.purchases.hybridcommon.purchaseSubscriptionOption as purchaseSubscriptionOptionCommon
44
+ import com.revenuecat.purchases.hybridcommon.redeemWebPurchase as redeemWebPurchaseCommon
43
45
  import com.revenuecat.purchases.hybridcommon.restorePurchases as restorePurchasesCommon
44
46
  import com.revenuecat.purchases.hybridcommon.setAd as setAdCommon
45
47
  import com.revenuecat.purchases.hybridcommon.setAdGroup as setAdGroupCommon
@@ -77,7 +79,7 @@ class PurchasesPlugin : Plugin() {
77
79
 
78
80
  companion object {
79
81
  private const val PLATFORM_NAME = "capacitor"
80
- private const val PLUGIN_VERSION = "10.0.2"
82
+ private const val PLUGIN_VERSION = "10.2.0"
81
83
 
82
84
  private const val CUSTOMER_INFO_KEY = "customerInfo"
83
85
  }
@@ -120,6 +122,24 @@ class PurchasesPlugin : Plugin() {
120
122
  call.resolve()
121
123
  }
122
124
 
125
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
126
+ fun parseAsWebPurchaseRedemption(call: PluginCall) {
127
+ val urlString = call.getStringOrReject("urlString") ?: return
128
+ if (isWebPurchaseRedemptionURL(urlString)) {
129
+ call.resolveWithMap(mapOf("webPurchaseRedemption" to mapOf("redemptionLink" to urlString)))
130
+ } else {
131
+ call.resolveWithMap(mapOf("webPurchaseRedemption" to null))
132
+ }
133
+ }
134
+
135
+ @PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
136
+ fun redeemWebPurchase(call: PluginCall) {
137
+ if (rejectIfNotConfigured(call)) return
138
+ val webPurchaseRedemption = call.getObjectOrReject("webPurchaseRedemption") ?: return
139
+ val redemptionLink = webPurchaseRedemption.getStringOrReject(call, "redemptionLink") ?: return
140
+ redeemWebPurchaseCommon(redemptionLink, getOnResult(call))
141
+ }
142
+
123
143
  @PluginMethod(returnType = PluginMethod.RETURN_NONE)
124
144
  fun setMockWebResults(call: PluginCall) {
125
145
  Log.e(