@capgo/native-purchases 8.3.9 → 8.3.10
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
|
@@ -15,6 +15,7 @@ This plugin allows you to implement in-app purchases and subscriptions in your C
|
|
|
15
15
|
The only **free**, **battle-tested** in-app purchase plugin for Capacitor with full feature parity:
|
|
16
16
|
|
|
17
17
|
- **StoreKit 2 (iOS)** - Uses Apple's latest purchase APIs for iOS 15+
|
|
18
|
+
- **iOS subscription commitment plans** - Merchandises and purchases monthly subscriptions with 12-month commitments when StoreKit supports them
|
|
18
19
|
- **Google Play Billing 7.x (Android)** - Implements the newest billing library
|
|
19
20
|
- **Complete feature set** - In-app products AND subscriptions with base plans
|
|
20
21
|
- **Same JavaScript API** - Compatible interface with paid alternatives
|
|
@@ -93,6 +94,35 @@ Add the "In-App Purchase" capability to your Xcode project:
|
|
|
93
94
|
|
|
94
95
|
> 📖 **[Complete iOS Testing Guide](./docs/iOS_TESTING_GUIDE.md)** - Comprehensive guide covering both Sandbox and StoreKit local testing methods with step-by-step instructions, troubleshooting, and best practices.
|
|
95
96
|
|
|
97
|
+
### StoreKit Monthly Commitment Subscriptions
|
|
98
|
+
|
|
99
|
+
On supported iOS versions, the plugin exposes Apple's monthly subscription with 12-month commitment billing plan configuration from StoreKit:
|
|
100
|
+
|
|
101
|
+
- Show `product.pricingTerms` so users can compare the standard up-front plan and the monthly commitment plan before purchasing.
|
|
102
|
+
- Pass `billingPlanType: 'monthly'` to `purchaseProduct()` when the user chooses the monthly commitment plan.
|
|
103
|
+
- Read `transaction.billingPlanType`, `transaction.commitmentInfo`, and `transaction.renewalInfo.commitmentInfo` from purchases, restored purchases, and entitlement checks.
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const { products } = await NativePurchases.getProducts({
|
|
107
|
+
productIdentifiers: ['com.yourapp.premium.yearly'],
|
|
108
|
+
productType: PURCHASE_TYPE.SUBS,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const premiumYearly = products[0];
|
|
112
|
+
const monthlyCommitment = premiumYearly.pricingTerms?.find(
|
|
113
|
+
(term) => term.billingPlanType === 'monthly'
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (monthlyCommitment) {
|
|
117
|
+
// Display both billingDisplayPrice and commitmentInfo.priceString before purchase.
|
|
118
|
+
await NativePurchases.purchaseProduct({
|
|
119
|
+
productIdentifier: premiumYearly.identifier,
|
|
120
|
+
productType: PURCHASE_TYPE.SUBS,
|
|
121
|
+
billingPlanType: 'monthly',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
96
126
|
### Testing with Sandbox
|
|
97
127
|
|
|
98
128
|
For testing in-app purchases on iOS:
|
|
@@ -41,7 +41,7 @@ import org.json.JSONArray;
|
|
|
41
41
|
@CapacitorPlugin(name = "NativePurchases")
|
|
42
42
|
public class NativePurchasesPlugin extends Plugin {
|
|
43
43
|
|
|
44
|
-
private final String pluginVersion = "8.3.
|
|
44
|
+
private final String pluginVersion = "8.3.10";
|
|
45
45
|
public static final String TAG = "NativePurchases";
|
|
46
46
|
private static final Phaser semaphoreReady = new Phaser(1);
|
|
47
47
|
private BillingClient billingClient;
|
|
@@ -21,7 +21,7 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
21
21
|
CAPPluginMethod(name: "isEntitledToOldBusinessModel", returnType: CAPPluginReturnPromise)
|
|
22
22
|
]
|
|
23
23
|
|
|
24
|
-
private let pluginVersion: String = "8.3.
|
|
24
|
+
private let pluginVersion: String = "8.3.10"
|
|
25
25
|
private var transactionUpdatesTask: Task<Void, Never>?
|
|
26
26
|
|
|
27
27
|
@objc func getPluginVersion(_ call: CAPPluginCall) {
|