Cordova
We rely on NPM to distribute our Cordova SDK
Main dependency
cordova plugin add @purchasely/[email protected]Don't forget to change the minimum OS versions to match Purchasely requirements (iOS 13.4 / Android 23)
// Podfile
...
platform :ios, '13.4'
...// Edit file android/build.gradle
buildscript {
ext {
minSdkVersion = 23 //min version must not be below 23
compileSdkVersion = 36
targetSdkVersion = 35
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}Android setup
We do not include a store by default in our SDK; with Android you can choose to use Google and/or Huawei and/or Amazon.
See below to add the store you want to use
VersioningAll your dependencies must always be at the same version for example
"dependencies": { "@purchasely/cordova-plugin-purchasely": "6.0.0-rc.1", "@purchasely/cordova-plugin-purchasely-google": "6.0.0-rc.1" },
Google Play Billing
To add Google as a store, you can use our NPM dependency
cordova plugin add @purchasely/[email protected]Then you must add Google in the list of stores
Purchasely.start(
'X-API-KEY',
['Google'],
false, // false for StoreKit 2 (recommended), true for StoreKit 1
null, // user id if user is connected
Purchasely.LogLevel.DEBUG, // set to ERROR in production
Purchasely.RunningMode.full, // ⚠️ v6 default is Observer — set .full to handle purchases
(isConfigured) => {},
(error) => { console.error(error); }
);Google Play Billing v8
If you use Google Play Billing in version 8, please read this to make it work with Purchasely
Other stores
Our Cordova SDK does not contains other stores to avoid unnecessary integrations. You have to specifically declare which stores you want.
To add our stores dependencies to your project, you just need to add them to the app/build.gradle file of your android folder in your project. The version must be the same than purchasely main dependency
dependencies {
//Amazon App Store
implementation 'io.purchasely:amazon:6.0.0-rc.1'
//Huawei Mobile Services
implementation 'io.purchasely:huawei-services:6.0.0-rc.1'
}