capacitor-plugin-cdv-purchase 13.14.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 +61 -0
- package/android/build.gradle +42 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/cc/fovea/iap/PurchasePlugin.java +1206 -0
- package/dist/definitions.d.ts +82 -0
- package/dist/esm/definitions.d.ts +82 -0
- package/dist/esm/definitions.js +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8438 -0
- package/dist/index.js.map +1 -0
- package/ios/CapacitorPluginPurchase.podspec +18 -0
- package/ios/Sources/PurchasePlugin/PurchasePlugin.swift +434 -0
- package/package.json +56 -0
- package/types/index.d.ts +27 -0
- package/www/capacitor-plugin.js +3 -0
- package/www/store.d.ts +6370 -0
- package/www/store.js +8660 -0
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# capacitor-plugin-cdv-purchase
|
|
2
|
+
|
|
3
|
+
In-App Purchase plugin for Capacitor 6+ — iOS (StoreKit 2) and Android (Google Play Billing).
|
|
4
|
+
|
|
5
|
+
This is the Capacitor edition of [cordova-plugin-purchase](https://github.com/j3k0/cordova-plugin-purchase), sharing the same API and adapter layer.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install capacitor-plugin-cdv-purchase
|
|
11
|
+
npx cap sync
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import 'capacitor-plugin-cdv-purchase';
|
|
18
|
+
|
|
19
|
+
const { Store, ProductType, Platform } = CdvPurchase;
|
|
20
|
+
const store = new Store();
|
|
21
|
+
|
|
22
|
+
// Register products
|
|
23
|
+
store.register([{
|
|
24
|
+
id: 'my_subscription',
|
|
25
|
+
type: ProductType.PAID_SUBSCRIPTION,
|
|
26
|
+
platform: Platform.GOOGLE_PLAY, // or Platform.APPLE_APPSTORE
|
|
27
|
+
}]);
|
|
28
|
+
|
|
29
|
+
// Listen for events
|
|
30
|
+
store.when()
|
|
31
|
+
.productUpdated((product) => { console.log('Product updated:', product); })
|
|
32
|
+
.approved((transaction) => transaction.verify())
|
|
33
|
+
.verified((receipt) => receipt.finish());
|
|
34
|
+
|
|
35
|
+
// Initialize
|
|
36
|
+
await store.initialize();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Migrating from cordova-plugin-purchase
|
|
40
|
+
|
|
41
|
+
If you're using `cordova-plugin-purchase` in a Capacitor app:
|
|
42
|
+
|
|
43
|
+
1. `npm install capacitor-plugin-cdv-purchase`
|
|
44
|
+
2. `npx cap sync`
|
|
45
|
+
3. Your code stays the same — the `CdvPurchase.Store` API is identical
|
|
46
|
+
4. Once confirmed working: `npm uninstall cordova-plugin-purchase`
|
|
47
|
+
|
|
48
|
+
## Platform Support
|
|
49
|
+
|
|
50
|
+
| Platform | Native API | Minimum OS |
|
|
51
|
+
|----------|-----------|------------|
|
|
52
|
+
| iOS | StoreKit 2 | iOS 15+ |
|
|
53
|
+
| Android | Google Play Billing 8.3 | API 23+ |
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
Full API documentation: https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
buildscript {
|
|
7
|
+
repositories {
|
|
8
|
+
google()
|
|
9
|
+
mavenCentral()
|
|
10
|
+
}
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath 'com.android.tools.build:gradle:8.7.3'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
apply plugin: 'com.android.library'
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
namespace "cc.fovea.iap"
|
|
20
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
|
|
21
|
+
defaultConfig {
|
|
22
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
|
|
23
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
|
|
24
|
+
}
|
|
25
|
+
compileOptions {
|
|
26
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
27
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
repositories {
|
|
32
|
+
google()
|
|
33
|
+
mavenCentral()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
dependencies {
|
|
37
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
38
|
+
implementation project(':capacitor-android')
|
|
39
|
+
implementation 'com.android.billingclient:billing:8.3.0'
|
|
40
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
41
|
+
testImplementation "junit:junit:$junitVersion"
|
|
42
|
+
}
|