Purchasely
Search…
Cordova SDK
Guide for integrating Purchasely SDK inside your Cordova app

Installation

NPM

You can use NPM to install Purchasely by running this command in your project:
1
cordova plugin add @purchasely/cordova-plugin-purchasely
Copied!
Don't forget to change the minimum OS versions to match Purchasely requirements (iOS 11 / Android 21)

iOS Integration

You must have an iOS platform for your project. If it is not the case, you can simply add it with a cordova command :
1
cordova platform add ios
Copied!

Android Integration

Enable AndroidX

AndroidX is mandatory to display our paywalls, it is deactivated by default. You can enable it easily by editing your config.xml file.
1
<platform name="android">
2
<allow-intent href="market:*" />
3
<preference name="AndroidXEnabled" value="true" />
4
</platform>
Copied!

Add Android platform

You must have an Android platform for your project. If it is not the case, you can simply add it with a cordova command :
1
cordova platform add android
Copied!

Add Stores dependencies

Our Cordova SDK does not contains a store to avoid unnecessary integrations. You have to specifically declare which stores you want. To add Android dependencies to your project, you need to create a file platforms/android/app/build-extras.gradle
Then you add the stores dependencies you wish to use.
build-extras.gradle
1
dependencies {
2
//Google Play Store
3
implementation 'io.purchasely:google-play:2.7.2'
4
5
//Amazon App Store
6
implementation 'io.purchasely:amazon:2.7.2'
7
8
//Huawei Mobile Services
9
implementation 'io.purchasely:huawei-services:2.7.2'
10
}
Copied!

Huawei Integration

Huawei needs a little more configuration to work properly, to integrate Huawei Mobile Services, please refer to our Android documentation : https://docs.purchasely.com/quick-start/sdk-installation/quick-start#huawei-mobile-services
Last modified 2d ago