@purchasely/cordova-plugin-puchasely-google

Purchasely Google plugin for Android devices


Keywords
ecosystem:cordova, cordova-android, purchasely, in-app, ios, android, iap, purchases, subscription, storekit, billing, google, play, app, store, huawei, hms, amazon
License
ISC
Install
npm install @purchasely/cordova-plugin-puchasely-google@4.3.1

Documentation

Cordova plugin Purchasely

Purchasely is a solution to ease the integration and boost your In-App Purchase & Subscriptions on the App Store, Google Play Store and Huawei App Gallery.

Installation

cordova plugin add @purchasely/cordova-plugin-purchasely

To use Google Play In-App Purchases on Android devices

cordova plugin add @purchasely/cordova-plugin-purchasely-google

Usage

More details in our documentation

Purchasely.start(
    'API_KEY',                     // set your own api key
    ['Google'],                    // list of stores for Android, accepted values: Google, Huawei and Amazon
    false,                         // set to false to use StoreKit2, true to use StoreKit1
    null,                          // set your user id
    Purchasely.LogLevel.DEBUG,     // log level, should be warning or error in production
    Purchasely.RunningMode.full,   // running mode, can be paywallObserver or full
    (isConfigured) => {
        if(isConfigured) {
            // Purchasely is ready, you can display paywalls, set user attributes, start a purchase flow etc.
        }
    },
    (error) => {
        console.log(error);
    }
);

// display a paywall from a placement
Purchasely.presentPresentationForPlacement(
    'placementId',
    'my_content_id', // may be null
    false, //display in fullscreen mode
    (callback) => {
        console.log(callback);
        if(callback.result == Purchasely.PurchaseResult.CANCELLED) {
            console.log("User cancelled purchased");
        } else {
            console.log("User purchased " + callback.plan.name);
        }
    },
    (error) => {
        console.log("Error with purchase : " + error);
    }
);

🏁 Documentation

A complete documentation is available on our website https://docs.purchasely.com