### ExoPlayer Implementation Example Source: https://docs.purchasely.com/docs/display-video-on-android An example implementation of `PLYPlayerInterface` using ExoPlayer. This snippet shows the basic methods for player control and setup. ```Kotlin class PurchaselyPlayerView(context: Context) : PlayerView(context), PLYPlayerInterface { private var exoPlayer: SimpleExoPlayer = SimpleExoPlayer.Builder(context).build() override fun setup(url: String, contentMode: String, isMuted: Boolean) { val mediaItem = MediaItem.fromUri(Uri.parse(url)) exoPlayer.addMediaItem(mediaItem) exoPlayer.playWhenReady = false exoPlayer.prepare() resizeMode = when (contentMode) { "fill" -> AspectRatioFrameLayout.RESIZE_MODE_ZOOM "fit" -> AspectRatioFrameLayout.RESIZE_MODE_FIT else -> AspectRatioFrameLayout.RESIZE_MODE_ZOOM } player = exoPlayer controllerAutoShow = false if (isMuted) { exoPlayer.volume = 0f } else { exoPlayer.volume = 1f } exoPlayer.repeatMode = Player.REPEAT_MODE_ALL hideController() } override fun play() { exoPlayer.play() } override fun pause() { exoPlayer.pause() } override fun release() { exoPlayer.release() } } ``` -------------------------------- ### Media3 Player Implementation Example Source: https://docs.purchasely.com/docs/display-video-on-android A sample implementation of `PLYPlayerInterface` using the Media3 library. This example demonstrates how to set up, play, pause, and release the player. ```Kotlin @OptIn(UnstableApi::class) class Media3PlayerView(context: Context) : PlayerView(context), PLYPlayerInterface { private var exoPlayer = ExoPlayer .Builder(context) .build() override fun setup(url: String, contentMode: String, isMuted: Boolean, repeat: Boolean) { val mediaItem = MediaItem.fromUri(Uri.parse(url)) exoPlayer.addMediaItem(mediaItem) exoPlayer.playWhenReady = false exoPlayer.prepare() resizeMode = when (contentMode) { "fill" -> AspectRatioFrameLayout.RESIZE_MODE_ZOOM "fit" -> AspectRatioFrameLayout.RESIZE_MODE_FIT else -> AspectRatioFrameLayout.RESIZE_MODE_ZOOM } player = exoPlayer controllerAutoShow = false if (isMuted) { exoPlayer.volume = 0f } else { exoPlayer.volume = 1f } exoPlayer.repeatMode = Player.REPEAT_MODE_ALL hideController() } override fun play() { exoPlayer.play() } override fun pause() { exoPlayer.pause() } override fun release() { exoPlayer.release() } } ``` -------------------------------- ### Start Purchasely SDK in Kotlin Source: https://docs.purchasely.com/docs/general-sdk-initialization Initialize the Purchasely SDK in your Android Kotlin application. This setup should occur in your Application class's `onCreate` method. The `userId` parameter is optional. ```kotlin import android.app.Application import io.purchasely.ext.Purchasely import io.purchasely.google.GoogleStore class YourApplication: Application() { override fun onCreate() { super.onCreate() Purchasely.Builder(applicationContext) .apiKey("00000000-1111-2222-3333-444444444444") .userId(null) // optional if you already know your user id .build() .start { isConfigured, error -> if(isConfigured) { // Purchasely setup is complete ) } } } ``` -------------------------------- ### Install React Native SDK Source: https://docs.purchasely.com/docs/general-react-native Install the main Purchasely SDK package for React Native using npm. ```shell npm install react-native-purchasely --save ``` -------------------------------- ### Start SDK with User ID Source: https://docs.purchasely.com/docs/general-user-identification To log in a user, provide your user ID. Purchasely will save this user ID for all subsequent sessions until `Purchasely.userLogout()` is called or the user uninstalls the application. If the user is already logged in when the SDK starts, you can provide the user ID directly in the `Purchasely.start()` method. ```Swift import Purchasely func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { Purchasely.start( withAPIKey: "00000000-1111-2222-3333-444444444444", appUserId: "XYZ-123-ABC-456" // user ID logLevel: .debug ) {(success, error) in print(success) } return true } ``` ```Kotlin import android.app.Application import io.purchasely.ext.Purchasely import io.purchasely.google.GoogleStore class YourApplication: Application() { override fun onCreate() { super.onCreate() Purchasely.Builder(applicationContext) .apiKey("00000000-1111-2222-3333-444444444444") .userId("XYZ-123-ABC-456") // user ID .build() .start { isConfigured, error -> if(isConfigured) { // Purchasely setup is complete ) } } } ``` ```React Native import Purchasely from 'react-native-purchasely'; // Everything is optional except apiKey and storeKit1 // Example with default values try { const configured = await Purchasely.start({ apiKey: '00000000-1111-2222-3333-444444444444', logLevel: LogLevels.ERROR, // set to debug in development mode to see logs userId: "XYZ-123-ABC-456" // user ID }); } catch (e) { console.log("Purchasely SDK not configured properly"); } ``` ```Flutter // Everything is optional except apiKey and storeKit1 // Example with default values bool configured = await Purchasely.start( apiKey: '00000000-1111-2222-3333-444444444444', logLevel: PLYLogLevel.error, // set to debug in development mode to see logs userId: "XYZ-123-ABC-456" // user ID ); if (!configured) { print('Purchasely SDK not configured'); return; } ``` ```Cordova /*** * @params String apiKey * @params StringArray stores : may be Google, Amazon and Huawei * @params String userId * @params Purchasley.LogLevel logLevel * @params Purchasely.RunningMode runningMode **/ Purchasely.startWithAPIKey( '00000000-1111-2222-3333-444444444444', ['Google'], "XYZ-123-ABC-456", // user ID Purchasely.LogLevel.DEBUG ); ``` -------------------------------- ### Start SDK with User ID - Kotlin Source: https://docs.purchasely.com/docs/general-user-identification Initialize the Purchasely SDK with an API key and an optional user ID. This is useful if the user is already logged in when the app starts. ```kotlin import android.app.Application import io.purchasely.ext.Purchasely import io.purchasely.google.GoogleStore class YourApplication: Application() { override fun onCreate() { super.onCreate() Purchasely.Builder(applicationContext) .apiKey("00000000-1111-2222-3333-444444444444") .userId("XYZ-123-ABC-456") // user ID .build() .start { isConfigured, error -> if(isConfigured) { // Purchasely setup is complete ) } } } ``` -------------------------------- ### Version Consistency Example Source: https://docs.purchasely.com/docs/general-kotlinjava Maintain consistent versions across all Purchasely SDK dependencies for stability. This example shows core, google-play, and player dependencies at the same version. ```gradle implementation 'io.purchasely:core:5.7.4' implementation 'io.purchasely:google-play:5.7.4' implementation 'io.purchasely:player:5.7.4' ``` -------------------------------- ### Swift Usage Example: Set Custom Screen Delegate Source: https://docs.purchasely.com/docs/byos-implementation Example of how to instantiate and set a custom SwiftUI screen delegate. This should be done after the Purchasely SDK has been initialized. ```swift let customScreenDelegate = CustomScreenViewDelegate() Purchasely.setCustomScreenViewDelegate(customScreenDelegate) ``` -------------------------------- ### UI/SDK Events Listener Setup (React Native) Source: https://docs.purchasely.com/docs/analytics-integration No special setup is required for React Native. Proceed to the 'Receiving events' section for implementation details. ```typescript // Nothing special to setup, just go to "Receiving events" below ``` -------------------------------- ### UI/SDK Events Listener Setup (Unity) Source: https://docs.purchasely.com/docs/analytics-integration UI/SDK event listening is not available for Unity at the moment. ```csharp //not available at the moment ``` -------------------------------- ### Install Unity SDK Source: https://docs.purchasely.com/docs/general-sdk-installation Configure your Unity project to use the Purchasely SDK by adding this dependency. ```xml io.purchasely unity [4.0,4.999] ``` -------------------------------- ### Start SDK with User ID - Cordova Source: https://docs.purchasely.com/docs/general-user-identification Initialize the Purchasely SDK with an API key, store list, user ID, and log level. This is useful if the user is already logged in when the app starts. ```javascript /*** * @params String apiKey * @params StringArray stores : may be Google, Amazon and Huawei * @params String userId * @params Purchasley.LogLevel logLevel * @params Purchasely.RunningMode runningMode **/ Purchasely.startWithAPIKey( '00000000-1111-2222-3333-444444444444', ['Google'], "XYZ-123-ABC-456", // user ID Purchasely.LogLevel.DEBUG ); ``` -------------------------------- ### Handle Multiple Placements with ContextSDK Source: https://docs.purchasely.com/docs/contextsdk Demonstrates how to use the ContextSDK across different app placements like onboarding, post-action, and settings. It shows creating contexts and presenting paywalls. ```swift // During onboarding func showOnboardingPaywall() { let context = ContextManager.instantContext(flowName: "purchasely_onboarding", duration: 3) presentPurchaselyPaywall(placement: "onboarding", context: context) } // After completing a key action func showPostActionPaywall() { let context = ContextManager.instantContext(flowName: "purchasely_post_action", duration: 3) presentPurchaselyPaywall(placement: "post_action", context: context) } // In settings func showSettingsPaywall() { let context = ContextManager.instantContext(flowName: "purchasely_settings", duration: 3) presentPurchaselyPaywall(placement: "settings", context: context) } private func presentPurchaselyPaywall(placement: String, context: Context) { // Set the context as a Purchasely user attribute Purchasely.setUserAttribute(withBoolValue: context.shouldUpsell, forKey: "context_should_upsell") let paywallController = Purchasely.presentationController( for: placement, loaded: { [weak self] controller, success, error in if let controller = controller, success { self?.present(controller, animated: true) } else { context.log(.skipped) } }, completion: { result, _ in switch result { case .purchased: context.log(.positive) case .cancelled: context.log(.negative) case .restored: context.log(.skipped) @unknown default: context.log(.skipped) } } ) } ``` -------------------------------- ### Get Anonymous User ID - Unity Source: https://docs.purchasely.com/docs/general-user-identification Retrieve the anonymous user ID for the current app installation. This ID remains consistent as long as the app is installed. ```csharp _purchasely.GetAnonymousUserId(); ``` -------------------------------- ### Fetch Presentation for a Placement Source: https://docs.purchasely.com/docs/pre-fetching This example demonstrates how to pre-fetch a presentation for a specific placement ID. It includes handling potential errors, displaying the presentation if successful, and managing the result when the presentation is closed. ```APIDOC ## Fetch Presentation for a Placement ### Description Pre-fetches a presentation associated with a given placement ID. This allows for loading the screen content in advance, improving the user experience by reducing loading times when the screen is eventually displayed. ### Method `Purchasely.fetchPresentation(for:completion:loadedCompletion:completion:) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters for `fetchPresentation` method: - `for`: (String) The placement ID for which to fetch the presentation. - `fetchCompletion`: A closure that is called when the presentation is fetched. It receives a `PLYPresentation` object and an `Error`. - `presentation`: An optional `PLYPresentation` object containing the fetched presentation data. - `error`: An optional `Error` object if the fetch operation failed. - `loadedCompletion`: A closure that is called when the presentation has been loaded and displayed. - `completion`: A closure that is called when the presentation controller is closed. It receives a `Result` (purchased, restored, cancelled) and the selected `plan`. ### Request Example ```swift // fetch presentation for placement Purchasely.fetchPresentation( for: "onboarding", fetchCompletion: { presentation, error in // closure to get presentation and display it guard let presentation = presentation, error == nil else { print("Error while fetching presentation: \(error?.localizedDescription ?? "unknown")") return } if presentation.type == .normal || presentation.type == .fallback { // Display directly presentation.display(from: myUIViewController) // alternatively: get the UIViewController to manage the transition yourself // note: this method won't work with Flows let purchaselyController = presentation.controller } else if presentation.type == .deactivated { // nothing to display } else if presentation.type == .client { let presentationId = presentation.id let planIds = presentation.plans // display your own Screen } }, completion: { result, plan in // closure when presentation controller is closed to get result switch result { case .purchased: print("User purchased: \(plan?.name)") break case .restored: print("User restored: \(plan?.name)") break case .cancelled: break @unknown default: break } }, loadedCompletion: { // closure when presentation is loaded and displayed } ) ``` ### Response #### Success Response The `fetchCompletion` closure receives a `PLYPresentation` object upon successful fetching. The `PLYPresentation` object contains properties like `id`, `height`, `language`, `flowId`, `placementId`, `audienceId`, `abTestId`, `abTestVariantId`, `type`, `controller`, `plans`, `metadata`, and `backgroundColor`. #### Response Example ```swift class PLYPresentation { let id: String? let height: Int? let language: String let flowId: String? let placementId: String? let audienceId: String? let abTestId: String? let abTestVariantId: String? let type: PLYPresentationType let controller: PLYPresentationViewController? let plans: [PLYPresentationPlan] let metadata: PLYPresentationMetadata? let backgroundColor: UIColor? } ``` ``` -------------------------------- ### Initialize Purchasely in PaywallObserver Mode (React Native) Source: https://docs.purchasely.com/docs/sdk-initialization Start the Purchasely SDK in `paywallObserver` mode for React Native applications. This example shows optional parameters like `storeKit1`, `logLevel`, `userId`, and `androidStores`. ```typescript import Purchasely from 'react-native-purchasely'; // Everything is optional except apiKey and storeKit1 // Example with default values try { const configured = await Purchasely.start({ apiKey: '00000000-1111-2222-3333-444444444444', storeKit1: false, // set to false to use StoreKit2, true to use StoreKit1, logLevel: LogLevels.ERROR, // set to debug in development mode to see logs userId: null, // if you know your user id, set it here runningMode: RunningMode.PaywallObserver, // select between full and paywallObserver androidStores: ['Google'] // default is Google, don't forget to add the dependency to the same version }); } catch (e) { console.log("Purchasely SDK not configured properly"); } ``` -------------------------------- ### Initialize Purchasely SDK in React Native Source: https://docs.purchasely.com/docs/sdk-initialization Initialize the Purchasely SDK for React Native applications. This example demonstrates setting the API key, store kit version, log level, and running mode. Ensure the 'react-native-purchasely' package is installed. ```typescript import Purchasely from 'react-native-purchasely'; // Everything is optional except apiKey and storeKit1 // Example with default values try { const configured = await Purchasely.start({ apiKey: '00000000-1111-2222-3333-444444444444', storeKit1: false, // set to false to use StoreKit2, true to use StoreKit1, logLevel: LogLevels.ERROR, // set to debug in development mode to see logs userId: null, // if you know your user id, set it here runningMode: RunningMode.FULL, // select between full and paywallObserver androidStores: ['Google'] // default is Google, don't forget to add the dependency to the same version }); } catch (e) { console.log("Purchasely SDK not configured properly"); } ``` -------------------------------- ### Device Layout Structure Example Source: https://docs.purchasely.com/docs/composer-adapting-screens-to-devices Illustrates how device layouts are structured, showing separate configurations for portrait and landscape orientations. ```text Smartphone ↳ Portrait - Sticky button ↳ Landscape - Scroll Tablet - Scroll ``` -------------------------------- ### Start Purchasely SDK in Swift Source: https://docs.purchasely.com/docs/general-sdk-initialization Initialize the Purchasely SDK in your Swift application. This should be the first method called upon application launch. The `appUserId` is optional if you already know the user ID. ```swift import Purchasely func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { Purchasely.start( withAPIKey: "00000000-1111-2222-3333-444444444444", appUserId: nil, // optional if you already know your user id logLevel: .debug ) {(success, error) in print(success) } return true } ``` -------------------------------- ### Install Amazon In-App Purchases for React Native Source: https://docs.purchasely.com/docs/installation-react-native Install the Amazon In-App Purchases NPM dependency for React Native. ```shell npm install @purchasely/react-native-purchasely-amazon --save ``` -------------------------------- ### Kotlin Usage Example: Set Custom Screen Provider Source: https://docs.purchasely.com/docs/byos-implementation Demonstrates setting a custom screen provider in Kotlin, either by creating a new instance of a class or by using an anonymous object implementation for inline logic. ```kotlin val customScreenProvider = CustomScreenProvider() Purchasely.setCustomScreenProvider(customScreenProvider) // OR using anonymous object implementation Purchasely.setCustomScreenProvider( object : PLYCustomScreenProvider { override fun onCustomScreenRequested(presentation: PLYPresentation): PLYCustomScreen? { return when(presentation.id) { "login" -> { // Custom Login View PLYCustomScreen.View(yourCustomLoginView) // Or Custom Login Fragment // PLYCustomScreen.Fragment(yourCustomLoginFragment()) } else -> { return null } } } } ) ``` -------------------------------- ### Install Huawei Mobile Services for React Native Source: https://docs.purchasely.com/docs/installation-react-native Install the Huawei Mobile Services NPM dependency for React Native. ```shell npm install @purchasely/react-native-purchasely-huawei --save ``` -------------------------------- ### Install Google Play Billing for React Native Source: https://docs.purchasely.com/docs/installation-react-native Install the Google Play Billing NPM dependency for React Native. ```shell npm install @purchasely/react-native-purchasely-google --save ``` -------------------------------- ### Initialize Purchasely SDK in Unity (C#) Source: https://docs.purchasely.com/docs/sdk-initialization Initialize the Purchasely SDK within a Unity project using C#. This snippet shows how to instantiate the Purchasely runtime with user ID, StoreKit version, log level, running mode, and callbacks for start and event handling. ```csharp private PurchaselyRuntime.Purchasely _purchasely; _purchasely = new PurchaselyRuntime.Purchasely("USER_ID", false, // true for StoreKit 1, false for StoreKit 2 LogLevel.Debug, RunningMode.Full, OnPurchaselyStart, OnPurchaselyEvent); ``` -------------------------------- ### Initialize Purchasely with Google Store Source: https://docs.purchasely.com/docs/installation-cordova Start the Purchasely SDK with your API key, specifying Google as the store. Use StoreKit 1 and set the log level for production. ```typescript Purchasely.startWithAPIKey( '00000000-1111-2222-3333-444444444444', ['Google'], true, // true for StoreKit 1, false for StoreKit 2 null, // user id if user is conencted Purchasely.LogLevel.DEBUG, // set to ERROR in production Purchasely.RunningMode.full ); ``` -------------------------------- ### User Deletion Request JSON Body Example Source: https://docs.purchasely.com/docs/user-deletion-request Example of the JSON body required to specify the user ID for deletion. ```json { "user_id": "12345" } ``` -------------------------------- ### Install External Dependency Manager Source: https://docs.purchasely.com/docs/installation-unity Install the External Dependency Manager package from its Unity package file to handle Cocoapods and Gradle dependencies. ```bash external-dependency-manager-latest.unitypackage ``` -------------------------------- ### Initialize Purchasely in PaywallObserver Mode (Unity C#) Source: https://docs.purchasely.com/docs/sdk-initialization Initialize the Purchasely SDK in `paywallObserver` mode for Unity applications using C#. This example shows how to instantiate the Purchasely runtime with user ID, StoreKit version, log level, and running mode. ```csharp private PurchaselyRuntime.Purchasely _purchasely; _purchasely = new PurchaselyRuntime.Purchasely("USER_ID", false, // true for StoreKit 1, false for StoreKit 2 LogLevel.Debug, RunningMode.PaywallObserver, OnPurchaselyStart, OnPurchaselyEvent); ``` -------------------------------- ### Purchase Promotional Offer in Kotlin Source: https://docs.purchasely.com/docs/promotional-offer-implementation This snippet shows how to purchase a promotional offer using Kotlin. It involves fetching the plan and then the specific offer by its vendor ID before initiating the purchase. ```Kotlin val plan = Purchasely.plan("plan_id on purchasely console") val offer = plan?.promoOffers?.firstOrNull { it.vendorId == "offer_id on purchasely console" } Purchasely.purchase(activity, plan, offer, onSuccess = { plan -> Log.d("Purchasely", "Purchase success with ${plan?.name}") }, onError = { Log.e("Purchasely", "Purchase error", it) }) ``` -------------------------------- ### Basic Authentication Example Source: https://docs.purchasely.com/docs/flow-configuration Explains how Basic authentication works, where username and password are combined and base64-encoded for the Authorization header. ```text Your username and password are being sent in the [header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) of the request. ``` -------------------------------- ### Initialize Purchasely in PaywallObserver Mode (Kotlin) Source: https://docs.purchasely.com/docs/sdk-initialization Initialize the Purchasely SDK in `paywallObserver` mode for Android applications using Kotlin. This example includes setting up Google Play Store and a callback for configuration completion. ```kotlin import android.app.Application import io.purchasely.ext.Purchasely import io.purchasely.google.GoogleStore class YourApplication: Application() { override fun onCreate() { super.onCreate() Purchasely.Builder(applicationContext) .apiKey("00000000-1111-2222-3333-444444444444") .runningMode(PLYRunningMode.PaywallObserver) .stores(listOf(GoogleStore())) // Set the list of stores you want to have .build() .start { isConfigured, error -> if(isConfigured) { // Purchasely setup is complete ) } } } ``` -------------------------------- ### Import Receipt via Ruby Source: https://docs.purchasely.com/docs/subscribers-base-import Example of how to import a receipt using Ruby's Net::HTTP library. Demonstrates setting up the request, headers, and handling the response. ```ruby require 'net/http' require 'json' # Url url = URI('https://s2s.purchasely.io/receipts') request = Net::HTTP::Post.new(url) # Headers request['Content-Type'] = 'application/json' request['X-API-KEY'] = '00000000-1111-2222-3333-444444444444' request['X-PLATFORM-TYPE'] = 'PLAY_STORE' # Payload payload = { purchase_token: "aaaNNNcccDDDeeeFFF", user_id: "1234", store_product_id: "subscription_id:base_plan_id" } request.body = payload.to_json # Send request http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE response = http.request(request) # Response case response.code when '200' transaction_id = JSON.parse(response.body)['id'] when '403', '422' errors = JSON.parse(response.body)['errors'] end ``` -------------------------------- ### Start SDK with User ID - Flutter Source: https://docs.purchasely.com/docs/general-user-identification Initialize the Purchasely SDK with an API key and an optional user ID. This is useful if the user is already logged in when the app starts. ```typescript // Everything is optional except apiKey and storeKit1 // Example with default values bool configured = await Purchasely.start( apiKey: '00000000-1111-2222-3333-444444444444', logLevel: PLYLogLevel.error, // set to debug in development mode to see logs userId: "XYZ-123-ABC-456" // user ID ); if (!configured) { print('Purchasely SDK not configured'); return; } ``` -------------------------------- ### Start SDK with User ID - React Native Source: https://docs.purchasely.com/docs/general-user-identification Initialize the Purchasely SDK with an API key and an optional user ID. This is useful if the user is already logged in when the app starts. ```typescript import Purchasely from 'react-native-purchasely'; // Everything is optional except apiKey and storeKit1 // Example with default values try { const configured = await Purchasely.start({ apiKey: '00000000-1111-2222-3333-444444444444', logLevel: LogLevels.ERROR, // set to debug in development mode to see logs userId: "XYZ-123-ABC-456" // user ID }); } catch (e) { console.log("Purchasely SDK not configured properly"); } ``` -------------------------------- ### Apple App Store - StoreKit 2 CSV Example Source: https://docs.purchasely.com/docs/subscribers-base-import Example CSV format for importing Apple App Store purchases using StoreKit 2. Includes identifier, user_id, and is_unknown fields. ```csv identifier;user_id;is_unknown 310001721313211;1234;false 310001234567890;;true ``` -------------------------------- ### Google Play Store - Billing v5 CSV Example Source: https://docs.purchasely.com/docs/subscribers-base-import Example CSV format for importing Google Play Store purchases with Billing version 5 or later. Includes identifier, store_product_id, user_id, and is_unknown fields. ```csv identifier;store_product_id;user_id;is_unknown aaaNNNcccDDDeeeFFF;subscription_id:base_plan_id;1234;false 000111222333444555;subscription_id:base_plan_id;;true ``` -------------------------------- ### Initialize Purchasely SDK in Cordova Source: https://docs.purchasely.com/docs/sdk-initialization Initialize the Purchasely SDK for Cordova applications. This example demonstrates the `startWithAPIKey` method, specifying the API key, stores, StoreKit version, user ID, log level, and running mode. ```javascript /** * @params String apiKey * @params StringArray stores : may be Google, Amazon and Huawei * @params String userId * @params Purchasley.LogLevel logLevel * @params Purchasely.RunningMode runningMode **/ Purchasely.startWithAPIKey( '00000000-1111-2222-3333-444444444444', ['Google'], false, // true for StoreKit 1, false for StoreKit 2 null, // user id of user Purchasely.LogLevel.DEBUG, Purchasely.RunningMode.full ); ```