@capgo/native-purchases 7.1.11 → 7.1.27
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 +38 -2
- package/android/build.gradle +1 -1
- package/ios/Plugin/NativePurchasesPlugin.swift +5 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
|
|
3
3
|
|
|
4
4
|
<div align="center">
|
|
5
|
-
<h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo
|
|
6
|
-
<h2><a href="https://capgo.app/consulting/?ref=plugin">
|
|
5
|
+
<h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo</a></h2>
|
|
6
|
+
<h2><a href="https://capgo.app/consulting/?ref=plugin"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
9
|
## In-app Purchases Made Easy
|
|
@@ -25,6 +25,42 @@ Add this to manifest
|
|
|
25
25
|
<uses-permission android:name="com.android.vending.BILLING" />
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
### Testing with Google Play Console
|
|
29
|
+
|
|
30
|
+
For testing in-app purchases on Android:
|
|
31
|
+
|
|
32
|
+
1. Upload your app to Google Play Console (internal testing track is sufficient)
|
|
33
|
+
2. Create test accounts in Google Play Console:
|
|
34
|
+
- Go to Google Play Console
|
|
35
|
+
- Navigate to "Setup" > "License testing"
|
|
36
|
+
- Add Gmail accounts to "License testers" list
|
|
37
|
+
3. Install the app from Google Play Store on a device signed in with a test account
|
|
38
|
+
4. Test purchases will be free and won't charge real money
|
|
39
|
+
|
|
40
|
+
## iOS
|
|
41
|
+
|
|
42
|
+
Add the "In-App Purchase" capability to your Xcode project:
|
|
43
|
+
|
|
44
|
+
1. Open your project in Xcode
|
|
45
|
+
2. Select your app target
|
|
46
|
+
3. Go to "Signing & Capabilities" tab
|
|
47
|
+
4. Click the "+" button to add a capability
|
|
48
|
+
5. Search for and add "In-App Purchase"
|
|
49
|
+
|
|
50
|
+
> 📖 **[Complete Testing Guide](./docs/TESTING_GUIDE_IOS.md)** - Comprehensive guide covering both Sandbox and StoreKit local testing methods with step-by-step instructions, troubleshooting, and best practices.
|
|
51
|
+
|
|
52
|
+
### Testing with Sandbox
|
|
53
|
+
|
|
54
|
+
For testing in-app purchases on iOS:
|
|
55
|
+
|
|
56
|
+
1. Create a sandbox test user in App Store Connect:
|
|
57
|
+
- Go to App Store Connect
|
|
58
|
+
- Navigate to "Users and Access" > "Sandbox Testers"
|
|
59
|
+
- Create a new sandbox tester account
|
|
60
|
+
2. On your iOS device, sign out of your regular Apple ID in Settings > App Store
|
|
61
|
+
3. Install and run your app
|
|
62
|
+
4. When prompted for Apple ID during purchase testing, use your sandbox account credentials
|
|
63
|
+
|
|
28
64
|
## Usage
|
|
29
65
|
|
|
30
66
|
Import the plugin in your TypeScript file:
|
package/android/build.gradle
CHANGED
|
@@ -49,7 +49,7 @@ repositories {
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
dependencies {
|
|
52
|
-
implementation "com.google.guava:guava:33.4.
|
|
52
|
+
implementation "com.google.guava:guava:33.4.8-android"
|
|
53
53
|
def billing_version = "7.1.1"
|
|
54
54
|
implementation "com.android.billingclient:billing:$billing_version"
|
|
55
55
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
@@ -114,16 +114,18 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
114
114
|
@objc func getProducts(_ call: CAPPluginCall) {
|
|
115
115
|
if #available(iOS 15.0, *) {
|
|
116
116
|
let productIdentifiers = call.getArray("productIdentifiers", String.self) ?? []
|
|
117
|
+
print("productIdentifiers \(productIdentifiers)")
|
|
117
118
|
DispatchQueue.global().async {
|
|
118
119
|
Task {
|
|
119
120
|
do {
|
|
120
121
|
let products = try await Product.products(for: productIdentifiers)
|
|
122
|
+
print("products \(products)")
|
|
121
123
|
let productsJson: [[String: Any]] = products.map { $0.dictionary }
|
|
122
124
|
call.resolve([
|
|
123
125
|
"products": productsJson
|
|
124
126
|
])
|
|
125
127
|
} catch {
|
|
126
|
-
print(error)
|
|
128
|
+
print("error \(error)")
|
|
127
129
|
call.reject(error.localizedDescription)
|
|
128
130
|
}
|
|
129
131
|
}
|
|
@@ -137,6 +139,7 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
137
139
|
@objc func getProduct(_ call: CAPPluginCall) {
|
|
138
140
|
if #available(iOS 15.0, *) {
|
|
139
141
|
let productIdentifier = call.getString("productIdentifier") ?? ""
|
|
142
|
+
print("productIdentifier \(productIdentifier)")
|
|
140
143
|
if productIdentifier.isEmpty {
|
|
141
144
|
call.reject("productIdentifier is empty")
|
|
142
145
|
return
|
|
@@ -146,6 +149,7 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
146
149
|
Task {
|
|
147
150
|
do {
|
|
148
151
|
let products = try await Product.products(for: [productIdentifier])
|
|
152
|
+
print("products \(products)")
|
|
149
153
|
if let product = products.first {
|
|
150
154
|
let productJson = product.dictionary
|
|
151
155
|
call.resolve(["product": productJson])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/native-purchases",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.27",
|
|
4
4
|
"description": "In-app Subscriptions Made Easy",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/Cap-go/native-purchases.git"
|
|
20
|
+
"url": "git+https://github.com/Cap-go/capacitor-native-purchases.git"
|
|
21
21
|
},
|
|
22
22
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/Cap-go/native-purchases/issues"
|
|
23
|
+
"url": "https://github.com/Cap-go/capacitor-native-purchases/issues"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"capacitor",
|