@revenuecat/purchases-capacitor 8.0.0-beta.4 → 9.0.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 +141 -45
- package/RevenueCatPurchasesCapacitor.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/revenuecat/purchases/capacitor/PurchasesPlugin.kt +23 -14
- package/dist/docs.json +245 -42
- package/dist/esm/definitions.d.ts +29 -10
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +8 -5
- package/dist/esm/web.js +9 -3
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +9 -3
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +9 -3
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/PurchasesPlugin.m +1 -0
- package/ios/Plugin/PurchasesPlugin.swift +41 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,7 +55,6 @@ This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package
|
|
|
55
55
|
|
|
56
56
|
* [`configure(...)`](#configure)
|
|
57
57
|
* [`setMockWebResults(...)`](#setmockwebresults)
|
|
58
|
-
* [`setFinishTransactions(...)`](#setfinishtransactions)
|
|
59
58
|
* [`setSimulatesAskToBuyInSandbox(...)`](#setsimulatesasktobuyinsandbox)
|
|
60
59
|
* [`addCustomerInfoUpdateListener(...)`](#addcustomerinfoupdatelistener)
|
|
61
60
|
* [`removeCustomerInfoUpdateListener(...)`](#removecustomerinfoupdatelistener)
|
|
@@ -69,6 +68,7 @@ This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package
|
|
|
69
68
|
* [`purchaseSubscriptionOption(...)`](#purchasesubscriptionoption)
|
|
70
69
|
* [`purchaseDiscountedPackage(...)`](#purchasediscountedpackage)
|
|
71
70
|
* [`restorePurchases()`](#restorepurchases)
|
|
71
|
+
* [`recordPurchase(...)`](#recordpurchase)
|
|
72
72
|
* [`getAppUserID()`](#getappuserid)
|
|
73
73
|
* [`logIn(...)`](#login)
|
|
74
74
|
* [`logOut()`](#logout)
|
|
@@ -77,6 +77,7 @@ This plugin is based on [CapGo's Capacitor plugin](https://www.npmjs.com/package
|
|
|
77
77
|
* [`getCustomerInfo()`](#getcustomerinfo)
|
|
78
78
|
* [`syncPurchases()`](#syncpurchases)
|
|
79
79
|
* [`syncObserverModeAmazonPurchase(...)`](#syncobservermodeamazonpurchase)
|
|
80
|
+
* [`syncAmazonPurchase(...)`](#syncamazonpurchase)
|
|
80
81
|
* [`enableAdServicesAttributionTokenCollection()`](#enableadservicesattributiontokencollection)
|
|
81
82
|
* [`isAnonymous()`](#isanonymous)
|
|
82
83
|
* [`checkTrialOrIntroductoryPriceEligibility(...)`](#checktrialorintroductorypriceeligibility)
|
|
@@ -153,19 +154,6 @@ Default is false
|
|
|
153
154
|
--------------------
|
|
154
155
|
|
|
155
156
|
|
|
156
|
-
### setFinishTransactions(...)
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
setFinishTransactions(options: { finishTransactions: boolean; }) => Promise<void>
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
| Param | Type | Description |
|
|
163
|
-
| ------------- | --------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
164
|
-
| **`options`** | <code>{ finishTransactions: boolean; }</code> | Set finishTransactions to false if you aren't using Purchases SDK to make the purchase |
|
|
165
|
-
|
|
166
|
-
--------------------
|
|
167
|
-
|
|
168
|
-
|
|
169
157
|
### setSimulatesAskToBuyInSandbox(...)
|
|
170
158
|
|
|
171
159
|
```typescript
|
|
@@ -376,6 +364,26 @@ Restores a user's previous purchases and links their appUserIDs to any user's al
|
|
|
376
364
|
--------------------
|
|
377
365
|
|
|
378
366
|
|
|
367
|
+
### recordPurchase(...)
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
recordPurchase(options: { productID: string; }) => Promise<{ transaction: PurchasesStoreTransaction; }>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Use this method only if you already have your own IAP implementation using StoreKit 2 and want to use
|
|
374
|
+
RevenueCat's backend. If you are using StoreKit 1 for your implementation, you do not need this method.
|
|
375
|
+
|
|
376
|
+
You only need to use this method with *new* purchases. Subscription updates are observed automatically.
|
|
377
|
+
|
|
378
|
+
| Param | Type | Description |
|
|
379
|
+
| ------------- | ----------------------------------- | ----------------------------------------------------------------------------------- |
|
|
380
|
+
| **`options`** | <code>{ productID: string; }</code> | The productID that was purchased that needs to be synced with RevenueCat's backend. |
|
|
381
|
+
|
|
382
|
+
**Returns:** <code>Promise<{ transaction: <a href="#purchasesstoretransaction">PurchasesStoreTransaction</a>; }></code>
|
|
383
|
+
|
|
384
|
+
--------------------
|
|
385
|
+
|
|
386
|
+
|
|
379
387
|
### getAppUserID()
|
|
380
388
|
|
|
381
389
|
```typescript
|
|
@@ -484,14 +492,27 @@ for subscriptions anytime a sync is needed, like after a successful purchase.
|
|
|
484
492
|
syncObserverModeAmazonPurchase(options: SyncObserverModeAmazonPurchaseOptions) => Promise<void>
|
|
485
493
|
```
|
|
486
494
|
|
|
495
|
+
| Param | Type |
|
|
496
|
+
| ------------- | ------------------------------------------------------------------------------- |
|
|
497
|
+
| **`options`** | <code><a href="#syncamazonpurchaseoptions">SyncAmazonPurchaseOptions</a></code> |
|
|
498
|
+
|
|
499
|
+
--------------------
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
### syncAmazonPurchase(...)
|
|
503
|
+
|
|
504
|
+
```typescript
|
|
505
|
+
syncAmazonPurchase(options: SyncAmazonPurchaseOptions) => Promise<void>
|
|
506
|
+
```
|
|
507
|
+
|
|
487
508
|
This method will send a purchase to the RevenueCat backend. This function should only be called if you are
|
|
488
509
|
in Amazon observer mode or performing a client side migration of your current users to RevenueCat.
|
|
489
510
|
|
|
490
511
|
The receipt IDs are cached if successfully posted, so they are not posted more than once.
|
|
491
512
|
|
|
492
|
-
| Param | Type
|
|
493
|
-
| ------------- |
|
|
494
|
-
| **`options`** | <code><a href="#
|
|
513
|
+
| Param | Type |
|
|
514
|
+
| ------------- | ------------------------------------------------------------------------------- |
|
|
515
|
+
| **`options`** | <code><a href="#syncamazonpurchaseoptions">SyncAmazonPurchaseOptions</a></code> |
|
|
495
516
|
|
|
496
517
|
--------------------
|
|
497
518
|
|
|
@@ -1068,16 +1089,17 @@ Check if configure has finished and Purchases has been configured.
|
|
|
1068
1089
|
|
|
1069
1090
|
Holds parameters to initialize the SDK.
|
|
1070
1091
|
|
|
1071
|
-
| Prop
|
|
1072
|
-
|
|
|
1073
|
-
| **`apiKey`**
|
|
1074
|
-
| **`appUserID`**
|
|
1075
|
-
| **`
|
|
1076
|
-
| **`userDefaultsSuiteName`**
|
|
1077
|
-
| **`
|
|
1078
|
-
| **`useAmazon`**
|
|
1079
|
-
| **`shouldShowInAppMessagesAutomatically`**
|
|
1080
|
-
| **`entitlementVerificationMode`**
|
|
1092
|
+
| Prop | Type | Description |
|
|
1093
|
+
| ----------------------------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1094
|
+
| **`apiKey`** | <code>string</code> | RevenueCat API Key. Needs to be a string |
|
|
1095
|
+
| **`appUserID`** | <code>string \| null</code> | A unique id for identifying the user |
|
|
1096
|
+
| **`purchasesAreCompletedBy`** | <code><a href="#purchasesarecompletedby">PurchasesAreCompletedBy</a></code> | Set this to MY_APP and provide a <a href="#storekit_version">STOREKIT_VERSION</a> if you have your own IAP implementation and want to only use RevenueCat's backend. Defaults to <a href="#purchases_are_completed_by_type">PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT</a>. If you are on Android and setting this to MY_APP, will have to acknowledge the purchases yourself. If your app is only on Android, you may specify any StoreKit version, as it is ignored by the Android SDK. |
|
|
1097
|
+
| **`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. |
|
|
1098
|
+
| **`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. |
|
|
1099
|
+
| **`useAmazon`** | <code>boolean</code> | An optional boolean. Android only. Required to configure the plugin to be used in the Amazon Appstore. |
|
|
1100
|
+
| **`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 |
|
|
1101
|
+
| **`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. |
|
|
1102
|
+
| **`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. |
|
|
1081
1103
|
|
|
1082
1104
|
|
|
1083
1105
|
#### CustomerInfo
|
|
@@ -1200,23 +1222,29 @@ For more info see https://docs.revenuecat.com/docs/entitlements
|
|
|
1200
1222
|
|
|
1201
1223
|
Type representing a product from the Store.
|
|
1202
1224
|
|
|
1203
|
-
| Prop | Type | Description
|
|
1204
|
-
| --------------------------------- | ------------------------------------------------------------------------------------- |
|
|
1205
|
-
| **`identifier`** | <code>string</code> | Product Id.
|
|
1206
|
-
| **`description`** | <code>string</code> | Description of the product.
|
|
1207
|
-
| **`title`** | <code>string</code> | Title of the product.
|
|
1208
|
-
| **`price`** | <code>number</code> | <a href="#price">Price</a> of the product in the local currency. Contains the price value of defaultOption for Google Play.
|
|
1209
|
-
| **`priceString`** | <code>string</code> | Formatted price of the item, including its currency sign. Contains the formatted price value of defaultOption for Google Play.
|
|
1210
|
-
| **`
|
|
1211
|
-
| **`
|
|
1212
|
-
| **`
|
|
1213
|
-
| **`
|
|
1214
|
-
| **`
|
|
1215
|
-
| **`
|
|
1216
|
-
| **`
|
|
1217
|
-
| **`
|
|
1218
|
-
| **`
|
|
1219
|
-
| **`
|
|
1225
|
+
| Prop | Type | Description |
|
|
1226
|
+
| --------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1227
|
+
| **`identifier`** | <code>string</code> | Product Id. |
|
|
1228
|
+
| **`description`** | <code>string</code> | Description of the product. |
|
|
1229
|
+
| **`title`** | <code>string</code> | Title of the product. |
|
|
1230
|
+
| **`price`** | <code>number</code> | <a href="#price">Price</a> of the product in the local currency. Contains the price value of defaultOption for Google Play. |
|
|
1231
|
+
| **`priceString`** | <code>string</code> | Formatted price of the item, including its currency sign. Contains the formatted price value of defaultOption for Google Play. |
|
|
1232
|
+
| **`pricePerWeek`** | <code>number</code> | Null for INAPP products. The price of the <a href="#purchasesstoreproduct">PurchasesStoreProduct</a> in a weekly recurrence. This means that, for example, if the period is monthly, the price will be divided by 4. Note that this value may be an approximation. For Google subscriptions, this value will use the basePlan to calculate the value. |
|
|
1233
|
+
| **`pricePerMonth`** | <code>number</code> | Null for INAPP products. The price of the <a href="#purchasesstoreproduct">PurchasesStoreProduct</a> in a monthly recurrence. This means that, for example, if the period is annual, the price will be divided by 12. Note that this value may be an approximation. For Google subscriptions, this value will use the basePlan to calculate the value. |
|
|
1234
|
+
| **`pricePerYear`** | <code>number</code> | Null for INAPP products. The price of the <a href="#purchasesstoreproduct">PurchasesStoreProduct</a> in a yearly recurrence. This means that, for example, if the period is monthly, the price will be multiplied by 12. Note that this value may be an approximation. For Google subscriptions, this value will use the basePlan to calculate the value. |
|
|
1235
|
+
| **`pricePerWeekString`** | <code>string</code> | Null for INAPP products. The price of the <a href="#purchasesstoreproduct">PurchasesStoreProduct</a> formatted for the current locale in a weekly recurrence. This means that, for example, if the period is monthly, the price will be divided by 4. It uses a currency formatter to format the price in the given locale. Note that this value may be an approximation. For Google subscriptions, this value will use the basePlan to calculate the value. |
|
|
1236
|
+
| **`pricePerMonthString`** | <code>string</code> | Null for INAPP products. The price of the <a href="#purchasesstoreproduct">PurchasesStoreProduct</a> formatted for the current locale in a monthly recurrence. This means that, for example, if the period is annual, the price will be divided by 12. It uses a currency formatter to format the price in the given locale. Note that this value may be an approximation. For Google subscriptions, this value will use the basePlan to calculate the value. |
|
|
1237
|
+
| **`pricePerYearString`** | <code>string</code> | Null for INAPP products. The price of the <a href="#purchasesstoreproduct">PurchasesStoreProduct</a> formatted for the current locale in a yearly recurrence. This means that, for example, if the period is monthly, the price will be multiplied by 12. It uses a currency formatter to format the price in the given locale. Note that this value may be an approximation. For Google subscriptions, this value will use the basePlan to calculate the value. |
|
|
1238
|
+
| **`currencyCode`** | <code>string</code> | Currency code for price and original price. Contains the currency code value of defaultOption for Google Play. |
|
|
1239
|
+
| **`introPrice`** | <code><a href="#purchasesintroprice">PurchasesIntroPrice</a> \| null</code> | Introductory price. |
|
|
1240
|
+
| **`discounts`** | <code>PurchasesStoreProductDiscount[] \| null</code> | Collection of discount offers for a product. Null for Android. |
|
|
1241
|
+
| **`productCategory`** | <code><a href="#product_category">PRODUCT_CATEGORY</a> \| null</code> | Product category. |
|
|
1242
|
+
| **`productType`** | <code><a href="#product_type">PRODUCT_TYPE</a></code> | The specific type of subscription or one time purchase this product represents. Important: In iOS, if using StoreKit 1, we cannot determine the type. |
|
|
1243
|
+
| **`subscriptionPeriod`** | <code>string \| null</code> | Subscription period, specified in ISO 8601 format. For example, P1W equates to one week, P1M equates to one month, P3M equates to three months, P6M equates to six months, and P1Y equates to one year. Note: Not available for Amazon. |
|
|
1244
|
+
| **`defaultOption`** | <code><a href="#subscriptionoption">SubscriptionOption</a> \| null</code> | Default subscription option for a product. Google Play only. |
|
|
1245
|
+
| **`subscriptionOptions`** | <code>SubscriptionOption[] \| null</code> | Collection of subscription options for a product. Google Play only. |
|
|
1246
|
+
| **`presentedOfferingIdentifier`** | <code>string \| null</code> | Offering identifier the store product was presented from. Null if not using offerings or if fetched directly from store via getProducts. |
|
|
1247
|
+
| **`presentedOfferingContext`** | <code><a href="#presentedofferingcontext">PresentedOfferingContext</a> \| null</code> | Offering context this package belongs to. Null if not using offerings or if fetched directly from store via getProducts. |
|
|
1220
1248
|
|
|
1221
1249
|
|
|
1222
1250
|
#### PurchasesIntroPrice
|
|
@@ -1268,6 +1296,7 @@ Used only for Google
|
|
|
1268
1296
|
| **`introPhase`** | <code><a href="#pricingphase">PricingPhase</a> \| null</code> | The intro trial <a href="#pricingphase">PricingPhase</a> of the subscription. Looks for the first pricing phase of the <a href="#subscriptionoption">SubscriptionOption</a> where amountMicros is greater than 0. There can be a freeTrialPhase and an introductoryPhase in the same <a href="#subscriptionoption">SubscriptionOption</a>. |
|
|
1269
1297
|
| **`presentedOfferingIdentifier`** | <code>string \| null</code> | Offering identifier the subscription option was presented from |
|
|
1270
1298
|
| **`presentedOfferingContext`** | <code><a href="#presentedofferingcontext">PresentedOfferingContext</a> \| null</code> | Offering context this package belongs to. Null if not using offerings or if fetched directly from store via getProducts. |
|
|
1299
|
+
| **`installmentsInfo`** | <code><a href="#installmentsinfo">InstallmentsInfo</a> \| null</code> | For installment subscriptions, the details of the installment plan the customer commits to. Null for non-installment subscriptions. Installment plans are only available for Google Play subscriptions. |
|
|
1271
1300
|
|
|
1272
1301
|
|
|
1273
1302
|
#### PricingPhase
|
|
@@ -1326,6 +1355,16 @@ Contains data about the context in which an offering was presented.
|
|
|
1326
1355
|
| **`ruleId`** | <code>string</code> | The rule id from the targeting used to obtain this object. |
|
|
1327
1356
|
|
|
1328
1357
|
|
|
1358
|
+
#### InstallmentsInfo
|
|
1359
|
+
|
|
1360
|
+
Type containing information of installment subscriptions. Currently only supported in Google Play.
|
|
1361
|
+
|
|
1362
|
+
| Prop | Type | Description |
|
|
1363
|
+
| ------------------------------------ | ------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
1364
|
+
| **`commitmentPaymentsCount`** | <code>number</code> | Number of payments the customer commits to in order to purchase the subscription. |
|
|
1365
|
+
| **`renewalCommitmentPaymentsCount`** | <code>number</code> | After the commitment payments are complete, the number of payments the user commits to upon a renewal. |
|
|
1366
|
+
|
|
1367
|
+
|
|
1329
1368
|
#### GetProductOptions
|
|
1330
1369
|
|
|
1331
1370
|
| Prop | Type | Description |
|
|
@@ -1410,7 +1449,7 @@ Holds the logIn result
|
|
|
1410
1449
|
| **`created`** | <code>boolean</code> | True if the call resulted in a new user getting created in the RevenueCat backend. |
|
|
1411
1450
|
|
|
1412
1451
|
|
|
1413
|
-
####
|
|
1452
|
+
#### SyncAmazonPurchaseOptions
|
|
1414
1453
|
|
|
1415
1454
|
| Prop | Type | Description |
|
|
1416
1455
|
| --------------------- | --------------------------- | ------------------------------------------------------------------------------- |
|
|
@@ -1442,6 +1481,40 @@ Holds the introductory price status
|
|
|
1442
1481
|
### Type Aliases
|
|
1443
1482
|
|
|
1444
1483
|
|
|
1484
|
+
#### PurchasesAreCompletedBy
|
|
1485
|
+
|
|
1486
|
+
Allows you to specify whether you want RevenueCat to complete your app's purchases
|
|
1487
|
+
or if your app will do so.
|
|
1488
|
+
|
|
1489
|
+
You can configure RevenueCat to complete your purchases like so:
|
|
1490
|
+
```typescript
|
|
1491
|
+
Purchases.configure({
|
|
1492
|
+
apiKey: "123",
|
|
1493
|
+
purchasesAreCompletedBy: PURCHASES_ARE_COMPLETED_BY.REVENUECAT,
|
|
1494
|
+
});
|
|
1495
|
+
```
|
|
1496
|
+
|
|
1497
|
+
You can specify that purchase are completed by your app like so:
|
|
1498
|
+
```typescript
|
|
1499
|
+
Purchases.configure({
|
|
1500
|
+
apiKey: "123",
|
|
1501
|
+
purchasesAreCompletedBy: {
|
|
1502
|
+
type: PURCHASES_ARE_COMPLETED_BY.MY_APP,
|
|
1503
|
+
storeKitVersion: <a href="#storekit_version">STOREKIT_VERSION</a>.STOREKIT_1
|
|
1504
|
+
},
|
|
1505
|
+
});
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1508
|
+
<code><a href="#purchases_are_completed_by_type">PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT</a> | <a href="#purchasesarecompletedbymyapp">PurchasesAreCompletedByMyApp</a></code>
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
#### PurchasesAreCompletedByMyApp
|
|
1512
|
+
|
|
1513
|
+
Configuration option that specifies that your app will complete purchases.
|
|
1514
|
+
|
|
1515
|
+
<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>
|
|
1516
|
+
|
|
1517
|
+
|
|
1445
1518
|
#### CustomerInfoUpdateListener
|
|
1446
1519
|
|
|
1447
1520
|
Listener used on updated customer info
|
|
@@ -1468,9 +1541,31 @@ Listener used to receive log messages from the SDK.
|
|
|
1468
1541
|
<code>(logLevel: <a href="#log_level">LOG_LEVEL</a>, message: string): void</code>
|
|
1469
1542
|
|
|
1470
1543
|
|
|
1544
|
+
#### SyncObserverModeAmazonPurchaseOptions
|
|
1545
|
+
|
|
1546
|
+
<code><a href="#syncamazonpurchaseoptions">SyncAmazonPurchaseOptions</a></code>
|
|
1547
|
+
|
|
1548
|
+
|
|
1471
1549
|
### Enums
|
|
1472
1550
|
|
|
1473
1551
|
|
|
1552
|
+
#### PURCHASES_ARE_COMPLETED_BY_TYPE
|
|
1553
|
+
|
|
1554
|
+
| Members | Value | Description |
|
|
1555
|
+
| ---------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1556
|
+
| **`MY_APP`** | <code>"MY_APP"</code> | RevenueCat will **not** automatically acknowledge any purchases. You will have to do so manually. **Note:** failing to acknowledge a purchase within 3 days will lead to Google Play automatically issuing a refund to the user. For more info, see [revenuecat.com](https://docs.revenuecat.com/docs/observer-mode#option-2-client-side). |
|
|
1557
|
+
| **`REVENUECAT`** | <code>"REVENUECAT"</code> | RevenueCat will automatically acknowledge verified purchases. No action is required by you. |
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
#### STOREKIT_VERSION
|
|
1561
|
+
|
|
1562
|
+
| Members | Value | Description |
|
|
1563
|
+
| ---------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1564
|
+
| **`STOREKIT_1`** | <code>"STOREKIT_1"</code> | Always use StoreKit 1. |
|
|
1565
|
+
| **`STOREKIT_2`** | <code>"STOREKIT_2"</code> | Always use StoreKit 2 (StoreKit 1 will be used if StoreKit 2 is not available in the current device.) - 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. |
|
|
1566
|
+
| **`DEFAULT`** | <code>"DEFAULT"</code> | Let RevenueCat use the most appropiate version of StoreKit |
|
|
1567
|
+
|
|
1568
|
+
|
|
1474
1569
|
#### ENTITLEMENT_VERIFICATION_MODE
|
|
1475
1570
|
|
|
1476
1571
|
| Members | Value | Description |
|
|
@@ -1562,6 +1657,7 @@ Listener used to receive log messages from the SDK.
|
|
|
1562
1657
|
| **`IMMEDIATE_WITH_TIME_PRORATION`** | <code>1</code> | Replacement takes effect immediately, and the remaining time will be prorated and credited to the user. This is the current default behavior. |
|
|
1563
1658
|
| **`IMMEDIATE_AND_CHARGE_PRORATED_PRICE`** | <code>2</code> | Replacement takes effect immediately, and the billing cycle remains the same. The price for the remaining period will be charged. This option is only available for subscription upgrade. |
|
|
1564
1659
|
| **`IMMEDIATE_WITHOUT_PRORATION`** | <code>3</code> | Replacement takes effect immediately, and the new price will be charged on next recurrence time. The billing cycle stays the same. |
|
|
1660
|
+
| **`DEFERRED`** | <code>6</code> | Replacement takes effect when the old plan expires, and the new price will be charged at the same time. |
|
|
1565
1661
|
| **`IMMEDIATE_AND_CHARGE_FULL_PRICE`** | <code>5</code> | Replacement takes effect immediately, and the user is charged full price of new plan and is given a full billing cycle of subscription, plus remaining prorated time from the old plan. |
|
|
1566
1662
|
|
|
1567
1663
|
|
|
@@ -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 = '13.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'PurchasesHybridCommon', '
|
|
16
|
+
s.dependency 'PurchasesHybridCommon', '13.0.0'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
package/android/build.gradle
CHANGED
|
@@ -53,7 +53,7 @@ dependencies {
|
|
|
53
53
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
54
54
|
implementation project(':capacitor-android')
|
|
55
55
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
56
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:
|
|
56
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:13.0.0'
|
|
57
57
|
testImplementation "junit:junit:$junitVersion"
|
|
58
58
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
59
59
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
@@ -10,6 +10,7 @@ import com.getcapacitor.PluginMethod
|
|
|
10
10
|
import com.getcapacitor.annotation.CapacitorPlugin
|
|
11
11
|
import com.revenuecat.purchases.CustomerInfo
|
|
12
12
|
import com.revenuecat.purchases.Purchases
|
|
13
|
+
import com.revenuecat.purchases.PurchasesAreCompletedBy
|
|
13
14
|
import com.revenuecat.purchases.Store
|
|
14
15
|
import com.revenuecat.purchases.common.PlatformInfo
|
|
15
16
|
import com.revenuecat.purchases.hybridcommon.ErrorContainer
|
|
@@ -52,7 +53,6 @@ import com.revenuecat.purchases.hybridcommon.setCreative as setCreativeCommon
|
|
|
52
53
|
import com.revenuecat.purchases.hybridcommon.setDisplayName as setDisplayNameCommon
|
|
53
54
|
import com.revenuecat.purchases.hybridcommon.setEmail as setEmailCommon
|
|
54
55
|
import com.revenuecat.purchases.hybridcommon.setFBAnonymousID as setFBAnonymousIDCommon
|
|
55
|
-
import com.revenuecat.purchases.hybridcommon.setFinishTransactions as setFinishTransactionsCommon
|
|
56
56
|
import com.revenuecat.purchases.hybridcommon.setFirebaseAppInstanceID as setFirebaseAppInstanceIDCommon
|
|
57
57
|
import com.revenuecat.purchases.hybridcommon.setKeyword as setKeywordCommon
|
|
58
58
|
import com.revenuecat.purchases.hybridcommon.setLogHandler as setLogHandlerCommon
|
|
@@ -77,7 +77,7 @@ class PurchasesPlugin : Plugin() {
|
|
|
77
77
|
|
|
78
78
|
companion object {
|
|
79
79
|
private const val PLATFORM_NAME = "capacitor"
|
|
80
|
-
private const val PLUGIN_VERSION = "
|
|
80
|
+
private const val PLUGIN_VERSION = "9.0.0"
|
|
81
81
|
|
|
82
82
|
private const val CUSTOMER_INFO_KEY = "customerInfo"
|
|
83
83
|
}
|
|
@@ -86,21 +86,29 @@ class PurchasesPlugin : Plugin() {
|
|
|
86
86
|
fun configure(call: PluginCall) {
|
|
87
87
|
val apiKey = call.getStringOrReject("apiKey") ?: return
|
|
88
88
|
val appUserID = call.getString("appUserID")
|
|
89
|
-
val
|
|
89
|
+
val purchasesAreCompletedByString = call.getString("purchasesAreCompletedBy")
|
|
90
|
+
val purchasesAreCompletedBy = if (purchasesAreCompletedByString == PurchasesAreCompletedBy.REVENUECAT.name) {
|
|
91
|
+
PurchasesAreCompletedBy.REVENUECAT.name
|
|
92
|
+
} else {
|
|
93
|
+
call.getObject("purchasesAreCompletedBy")?.getString("type")
|
|
94
|
+
}
|
|
90
95
|
val useAmazon = call.getBoolean("useAmazon")
|
|
91
96
|
val store = if (useAmazon == true) Store.AMAZON else Store.PLAY_STORE
|
|
92
97
|
val platformInfo = PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION)
|
|
93
98
|
val shouldShowInAppMessages = call.getBoolean("shouldShowInAppMessagesAutomatically")
|
|
94
99
|
val entitlementVerificationMode = call.getString("entitlementVerificationMode")
|
|
100
|
+
val pendingTransactionsForPrepaidPlansEnabled = call.getBoolean("pendingTransactionsForPrepaidPlansEnabled")
|
|
101
|
+
|
|
95
102
|
configure(
|
|
96
103
|
context.applicationContext,
|
|
97
104
|
apiKey,
|
|
98
105
|
appUserID,
|
|
99
|
-
|
|
106
|
+
purchasesAreCompletedBy,
|
|
100
107
|
platformInfo,
|
|
101
108
|
store,
|
|
102
109
|
shouldShowInAppMessagesAutomatically = shouldShowInAppMessages,
|
|
103
110
|
verificationMode = entitlementVerificationMode,
|
|
111
|
+
pendingTransactionsForPrepaidPlansEnabled = pendingTransactionsForPrepaidPlansEnabled,
|
|
104
112
|
)
|
|
105
113
|
Purchases.sharedInstance.updatedCustomerInfoListener = UpdatedCustomerInfoListener { customerInfo ->
|
|
106
114
|
for (callbackId in customerInfoListeners) {
|
|
@@ -119,14 +127,6 @@ class PurchasesPlugin : Plugin() {
|
|
|
119
127
|
call.resolve()
|
|
120
128
|
}
|
|
121
129
|
|
|
122
|
-
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
123
|
-
fun setFinishTransactions(call: PluginCall) {
|
|
124
|
-
if (rejectIfNotConfigured(call)) return
|
|
125
|
-
val finishTransactions = call.getBooleanOrReject("finishTransactions") ?: return
|
|
126
|
-
setFinishTransactionsCommon(finishTransactions)
|
|
127
|
-
call.resolve()
|
|
128
|
-
}
|
|
129
|
-
|
|
130
130
|
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
131
131
|
fun setSimulatesAskToBuyInSandbox(call: PluginCall) {
|
|
132
132
|
logNotSupportedFunctionalityInAndroid("setSimulatesAskToBuyInSandbox")
|
|
@@ -264,6 +264,11 @@ class PurchasesPlugin : Plugin() {
|
|
|
264
264
|
restorePurchasesCommon(getOnResult(call, CUSTOMER_INFO_KEY))
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
@PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
|
|
268
|
+
fun recordPurchase(call: PluginCall) {
|
|
269
|
+
rejectNotSupportedInAndroid(call, "recordPurchase")
|
|
270
|
+
}
|
|
271
|
+
|
|
267
272
|
@PluginMethod(returnType = PluginMethod.RETURN_PROMISE)
|
|
268
273
|
fun getAppUserID(call: PluginCall) {
|
|
269
274
|
if (rejectIfNotConfigured(call)) return
|
|
@@ -314,13 +319,18 @@ class PurchasesPlugin : Plugin() {
|
|
|
314
319
|
|
|
315
320
|
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
316
321
|
fun syncObserverModeAmazonPurchase(call: PluginCall) {
|
|
322
|
+
syncAmazonPurchase(call)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
326
|
+
fun syncAmazonPurchase(call: PluginCall) {
|
|
317
327
|
if (rejectIfNotConfigured(call)) return
|
|
318
328
|
val productID = call.getStringOrReject("productID") ?: return
|
|
319
329
|
val receiptID = call.getStringOrReject("receiptID") ?: return
|
|
320
330
|
val amazonUserID = call.getStringOrReject("amazonUserID") ?: return
|
|
321
331
|
val isoCurrencyCode = call.getString("isoCurrencyCode")
|
|
322
332
|
val price = call.getDouble("price")
|
|
323
|
-
Purchases.sharedInstance.
|
|
333
|
+
Purchases.sharedInstance.syncAmazonPurchase(
|
|
324
334
|
productID,
|
|
325
335
|
receiptID,
|
|
326
336
|
amazonUserID,
|
|
@@ -411,7 +421,6 @@ class PurchasesPlugin : Plugin() {
|
|
|
411
421
|
|
|
412
422
|
@PluginMethod(returnType = PluginMethod.RETURN_NONE)
|
|
413
423
|
fun setProxyURL(call: PluginCall) {
|
|
414
|
-
if (rejectIfNotConfigured(call)) return
|
|
415
424
|
val urlString = call.getString("url")
|
|
416
425
|
setProxyURLStringCommon(urlString)
|
|
417
426
|
call.resolve()
|