### Show Web Store Examples Source: https://mobilesdk.101xp.com/docs/samsung/other/webstore Examples of calling the showWebStore method with properties and optional locales. ```java // Java // Add your properties Map properties = new HashMap(); properties.put("first_purchase_property", your_purchase_property); // Show 101XP Web Store Platform101XP.showWebStore(properties) // OR any call with allowed locale Platform101XP.showWebStore(properties, Arrays.asList("en","ru")); ``` ```kotlin // Kotlin val properties: MutableMap = HashMap() properties["first_purchase_property"] = "first_property" Platform101XP.showWebStore(properties) //OR Platform101XP.showWebStore(properties,Arrays.asList("ru")) ``` -------------------------------- ### Example: Show Web Store with properties Source: https://mobilesdk.101xp.com/docs/ios/other/webstore Example usage of showWebStoreWithProperties: with a properties dictionary. Add your own properties and then call the method. ```objectivec // Add your properties id properties = @{@"key": @"test"}; // Show 101XP Web Store [P101XP showWebStoreWithProperties:properties]; ``` -------------------------------- ### Track installation event with applicationDidBecomeActive Source: https://mobilesdk.101xp.com/docs/ios/analytics Call this in the corresponding method to track the installation event. ```objectivec - (void)applicationDidBecomeActive:(UIApplication *)application { [P101XP applicationDidBecomeActive:application]; } ``` -------------------------------- ### Show Web Store example (Java and Kotlin) Source: https://mobilesdk.101xp.com/docs/amazon/other/webstore Example of showing the 101XP Web Store with custom properties and an optional allowed locale list. The properties are appended to the final URL as key=value pairs. ```java // Java // Add your properties Map properties = new HashMap(); properties.put("first_purchase_property", your_purchase_property); // Show 101XP Web Store Platform101XP.showWebStore(properties) // OR any call with allowed locale Platform101XP.showWebStore(properties, Arrays.asList("en","ru")); ``` ```kotlin // Kotlin val properties: MutableMap = HashMap() properties["first_purchase_property"] = "first_property" Platform101XP.showWebStore(properties) //OR Platform101XP.showWebStore(properties,Arrays.asList("ru")) ``` -------------------------------- ### Migration Example - After (1.6.x) Source: https://mobilesdk.101xp.com/docs/unity/migration Example of handling the authorization result after the changes, using error and token. ```csharp void OnAuthorize(AuthorizeResult result) { if (!string.IsNullOrEmpty(result.error)) { // handle error return; } // Token object with camelCase members Token token = result.token; if (token == null) { // handle unexpected missing token return; } // Guest / login status is now handled via Account (see section 5) } ``` -------------------------------- ### Migration Example - Before (≤1.5.x) Source: https://mobilesdk.101xp.com/docs/unity/migration Example of handling the authorization result before the changes, using error_message and is_guest. ```csharp void OnAuthorize(AuthorizeResult result) { if (!string.IsNullOrEmpty(result.error_message)) { // handle error return; } if (result.is_guest) { // guest flow } else { // logged-in user flow } var token = result.access_token; } ``` -------------------------------- ### Example: showWebStore() with properties and allowed locale (Kotlin) Source: https://mobilesdk.101xp.com/docs/android/other/webstore Kotlin example showing how to create a properties map and call showWebStore(). The allowedLocale list is optional; if the device locale is not found, the first element is used. ```kotlin // Kotlin val properties: MutableMap = HashMap() properties["first_purchase_property"] = "first_property" Platform101XP.showWebStore(properties) //OR Platform101XP.showWebStore(properties,Arrays.asList("ru")) ``` -------------------------------- ### Example: showWebStore() with properties and allowed locale (Java) Source: https://mobilesdk.101xp.com/docs/android/other/webstore Java example showing how to add properties and call showWebStore(). The properties map is passed to the method, and an optional allowedLocale list can be provided. If the device locale is not in the list, the first element is used. ```java // Java // Add your properties Map properties = new HashMap(); properties.put("first_purchase_property", your_purchase_property); // Show 101XP Web Store Platform101XP.showWebStore(properties) // OR any call with allowed locale Platform101XP.showWebStore(properties, Arrays.asList("en","ru")); ``` -------------------------------- ### Get account in Java Source: https://mobilesdk.101xp.com/docs/huawei/other/account Java example using Platform101XP.getAccount() to retrieve the Account object. The returned account has properties such as accountId, portalId, userGameId, mobileId, userName, userPhotoUrl, and isGuest. ```java import com.platform101xp.authorize.account.Account; Account account = Platform101XP.getAccount(); ``` -------------------------------- ### Get Platform101XPToken with Platform101XP.getToken() Source: https://mobilesdk.101xp.com/docs/huawei/other/Platform101XPToken Retrieve the Platform101XPToken object using Platform101XP.getToken(). The Java and Kotlin examples are equivalent and shown as separate tabs. ```java import com.platform101xp.authorize.token.Platform101XPToken; Platform101XPToken token = Platform101XP.getToken(); ``` ```kotlin import com.platform101xp.authorize.token.Platform101XPToken val token = Platform101XP.getToken() ``` -------------------------------- ### Get All Products with getProducts Source: https://mobilesdk.101xp.com/docs/ios/billing Call [P101XP getProducts:nil] to get all available products. Pass a product ID array to filter; nil returns all products. The result is delivered to p101xpOnGetProductsResult. ```objectivec [P101XP getProducts:nil]; ``` -------------------------------- ### Example JSON with consumable and entitlement items Source: https://mobilesdk.101xp.com/docs/amazon/billing Example JSON file showing a consumable item and an entitlement item. The entitlement item omits the smallIconUrl property. ```json { "com.amazon.sample.iap.consumables.orange":{ "itemType": "CONSUMABLE", "price": 10.00, "title": "Orange", "description": "An orange", "smallIconUrl": "http://www.amazon.com/orange.jpg" }, "com.amazon.sample.iap.entitlements.level2":{ "itemType": "ENTITLED", "price": 10.00, "title": "Level 2", "description": "An entitlement to play level 2" } } ``` -------------------------------- ### Get all products Source: https://mobilesdk.101xp.com/docs/unity/billing Retrieves the full list of available products. Returns a List. ```csharp List currentProducts = P101XP.GetInstance().GetAllProducts(); ``` -------------------------------- ### Request example placeholder Source: https://mobilesdk.101xp.com/docs/server-side-methods/checking-mobile-token-by-game-server-after-authorization Placeholder comment indicating that a request example is available on request. No actual code is provided. ```java // Please, request example if you need it ``` -------------------------------- ### Adjust event map example Source: https://mobilesdk.101xp.com/docs/ios/analytics Example event map for Adjust. Add P101XPAdjustAppToken and P101XPAdjustEvetMap to Info.plist; P101XPAdjustTrackEnabled enables tracking (true/false). ```json {"sdk-online": "sucpc8", "sdk_app_hidden": "662lk1", "sdk_call_authorize": "hhnyep", "sdk_detect_emulator": "arpv2p","sdk_eula_accepted": "mijy8d","sdk_eula_read": "yk3kv9", "sdk_eula_show": "ijsxnc","sdk_initialized": "3onpe6","sdk_mobvid_close": "felokb", "sdk_mobvid_open": "i2yt2o","sdk_online": "sucpc8", "sdk_open": "o1w442", "sdk_profile_close": "tudq7r", "sdk_purchase": "5v34tb", "sdk_qr_login": "79hd19", "sdk_qr_transit": "9vrjq9","sdk_support_open": "rfuzlx", "sdk_profile_open": "yqh4wd", "sdk_account_login": "i505ix","sdk_account_logout": "2oe4la"} ``` -------------------------------- ### Example of handling account result Source: https://mobilesdk.101xp.com/docs/unity/migration Example method OnAccountReceived that checks for errors, null account, and uses the isGuest flag. ```csharp void OnAccountReceived(AccountResult result) { if (!string.IsNullOrEmpty(result.error)) { // handle error return; } var account = result.account; if (account == null) { // account info not available yet or failed to load return; } bool isGuest = account.isGuest; // use account.accountId, account.userName, etc. } ``` -------------------------------- ### Authorize User Source: https://mobilesdk.101xp.com/docs/unity/authorization/usage Call Authorize() on the P101XP instance to start the authorization flow. ```csharp P101XP.GetInstance().Authorize(); ``` -------------------------------- ### Get a single product by ID Source: https://mobilesdk.101xp.com/docs/unity/billing Retrieves a single product by its identifier. Returns a Product object. ```csharp Product product = P101XP.GetInstance().GetProduct("some_product"); ``` -------------------------------- ### Get Token and Account Source: https://mobilesdk.101xp.com/docs/unity/authorization/usage Query the current authorization state. Token appears first, account appears later (async load). ```csharp Token token = P101XP.GetInstance().GetToken(); Account account = P101XP.GetInstance().GetAccount(); ``` -------------------------------- ### Send af_login event (Java) Source: https://mobilesdk.101xp.com/docs/amazon/analytics Example of sending the af_login event with player_id, player_name, and server_id attributes using Platform101XP.analyticsTrack(). ```Java // Java final Map properties = new HashMap(); properties.put("player_id", your_player_id); properties.put("player_name", your_player_name); properties.put("server_id", your_player_server_id); Platform101XP.analyticsTrack("af_login", properties); ``` -------------------------------- ### Initialize SDK in Awake() with event handler (P101XPBehaviour.cs) Source: https://mobilesdk.101xp.com/docs/unity/initialization A typical setup that performs SDK initialization inside the Awake() method of a P101XPBehaviour component. It subscribes to the InitializeEvent and calls Initialize() only once, using a static flag to prevent re-initialization. ```csharp private static bool isInitialized = false; private void SdkInitializeHandler(InitResult initResult) { // Handle initialization result here } private void Awake() { if (!isInitialized) { P101XP.GetInstance().InitializeEvent += SdkInitializeHandler; P101XP.GetInstance().Initialize(); isInitialized = true; } } ``` -------------------------------- ### Track Analytics Event with Recommended Attributes Source: https://mobilesdk.101xp.com/docs/unity/analytics Sends an analytics event using P101XP.GetInstance().AnalyticsTrack with a dictionary of attributes. The example uses player_id, player_name, and server_id, which are recommended for events like af_login. ```csharp var values = new Dictionary { { "player_id", yourPlayerId }, { "player_name", yourPlayerName }, { "server_id", yourServerId } }; P101XP.GetInstance().AnalyticsTrack("af_login", values); ``` -------------------------------- ### Get Platform101XPToken with Platform101XP.getToken() Source: https://mobilesdk.101xp.com/docs/amazon/other/Platform101XPToken Retrieves the Platform101XPToken object using Platform101XP.getToken(). The Java example uses a semicolon after the import statement, while the Kotlin example omits it. Both snippets are shown as separate language renderings of the same usage. ```java import com.platform101xp.authorize.token.Platform101XPToken; Platform101XPToken token = Platform101XP.getToken(); ``` ```kotlin import com.platform101xp.authorize.token.Platform101XPToken val token = Platform101XP.getToken() ``` -------------------------------- ### Get Account with Platform101XP.getAccount() Source: https://mobilesdk.101xp.com/docs/amazon/other/account Retrieves the account object using Platform101XP.getAccount(). The Java example uses a semicolon after the import statement, while the Kotlin example omits it. The returned account object contains properties such as accountId, portalId, userGameId, mobileId, userName, userPhotoUrl, and isGuest. ```java import com.platform101xp.authorize.account.Account; Account account = Platform101XP.getAccount(); ``` ```kotlin import com.platform101xp.authorize.account.Account val account = Platform101XP.getAccount() ``` -------------------------------- ### Initialize the SDK with P101XP.GetInstance().Initialize() Source: https://mobilesdk.101xp.com/docs/unity/initialization Call this method to initialize the SDK. Subscribe to the InitializeEvent to receive the initialization result. ```csharp P101XP.GetInstance().Initialize(); ``` -------------------------------- ### Get account in Kotlin Source: https://mobilesdk.101xp.com/docs/huawei/other/account Kotlin example using Platform101XP.getAccount() to retrieve the Account object. The returned account has properties such as accountId, portalId, userGameId, mobileId, userName, userPhotoUrl, and isGuest. ```kotlin import com.platform101xp.authorize.account.Account val account = Platform101XP.getAccount() ``` -------------------------------- ### onRewardedInviteLinkRecipient(String referrer, String event) Source: https://mobilesdk.101xp.com/docs/android/other/referral-system Callback method that is called after getting an invite by recipient. This method should return true if the user has fulfilled the conditions for the reward (for example, reached level 10). ```APIDOC ## onRewardedInviteLinkRecipient(String referrer, String event) ### Description Callback method that is called after getting an invite by recipient. This method should return true if the user has fulfilled the conditions for the reward (for example, reached level 10). ### Method Listener Callback ### Signature `boolean onRewardedInviteLinkRecipient(String referrer, String event)` ### Parameters - **referrer** (String) - Required - The identifier of the user who invited the current user. - **event** (String) - Required - Value from sendInviteLink() method. ### Returns - **boolean** - Return true if the user has fulfilled the conditions for the reward. ### Example ```java boolean onRewardedInviteLinkRecipient(String referrer, String event) { } ``` ```kotlin override fun onRewardedInviteLinkRecipient(referrer: String?, event: String?): Boolean { } ``` ``` -------------------------------- ### Platform101XP.initialize Source: https://mobilesdk.101xp.com/docs/android/advertising Initializes the 101XP SDK. Must be called after setting the advertising listener. ```APIDOC ## [Initialize] Platform101XP.initialize ### Description Initializes the 101XP SDK. Must be called after setting the advertising listener. ### Method initialize ### Parameters - **listener** (type not specified) - Required - The initialization listener. ### Request Example ```java Platform101XP.initialize(listener); ``` ### Response No return value. ``` -------------------------------- ### Configure 101XP iOS remote repository with setup_sdk_stage.sh Source: https://mobilesdk.101xp.com/docs/unity/integration Run this script to configure the 101XP plugin remote repository for iOS. After it finishes, check for errors; if none, the configuration is complete. ```bash chmod +x setup_sdk_stage.sh ./setup_sdk_stage.sh ``` -------------------------------- ### Initial state check using GetToken() and GetAccount() Source: https://mobilesdk.101xp.com/docs/unity/migration Recommended usage for checking authorization state at startup. ```csharp var token = sdk.GetToken(); var account = sdk.GetAccount(); bool isAuthorized = token != null; bool hasAccount = account != null; bool isGuest = account != null && account.isGuest; ``` -------------------------------- ### Initialize SDK in onCreate with caution (Kotlin) Source: https://mobilesdk.101xp.com/docs/samsung/initialization This is the Kotlin version of the correct configuration in onCreate, also showing the required order. ```Kotlin // Kotlin override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Initialize 101XP SDK. Platform101XP.onCreate(this) Platform101XP.initialize(listener) } ``` -------------------------------- ### Get AppsFlyer conversion data via P101XPDelegate Source: https://mobilesdk.101xp.com/docs/ios/analytics Delegate method of P101XPDelegate to get conversion data for AppsFlyer. ```objectivec (void)p101xpOnGetAnalyticsConversionData:(NSDictionary *)data; ``` -------------------------------- ### Create AdvertisingListener and initialize SDK (Java) Source: https://mobilesdk.101xp.com/docs/android/advertising Create an AdvertisingListener and set it via Platform101XP.setAdvertisingListener before initializing the SDK in MainActivity's onCreate. The listener includes callbacks for rewarded, interstitial, banner, and app open ads. ```java // Java AdvertisingListener advertisingListener = new AdvertisingListener() { @Override public void onRewardedInterstitialAdShowed(int amount, @androidx.annotation.Nullable String name, @androidx.annotation.Nullable Platform101XPError error) { } @Override public void onRewardedInterstitialAdLoaded(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onInterstitialAdShowed(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onInterstitialAdLoaded(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onBannerAdShowed(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onBannerAdShowed(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onAppOpenAdShowed(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onAppOpenAdLoaded(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onInitializationComplete() {} @Override public void onRewardedAdLoaded(@androidx.annotation.Nullable Platform101XPError error) {} @Override public void onRewardedAdShowed(int amount, @androidx.annotation.Nullable String name, @androidx.annotation.Nullable Platform101XPError error) {} }; // Initialize 101XP SDK. Platform101XP.onCreate(this); Platform101XP.setAdvertisingListener(advertisingListener); Platform101XP.initialize(listener); ``` -------------------------------- ### Initialize the SDK (Kotlin) Source: https://mobilesdk.101xp.com/docs/amazon/initialization Call Platform101XP.initialize(listener) to initialize the SDK. The listener must implement Platform101XPListener and its methods are called when SDK events occur. ```kotlin // Kotlin Platform101XP.initialize(listener) ``` -------------------------------- ### Show Review Dialog - P101XP.GetInstance().AppReview() Source: https://mobilesdk.101xp.com/docs/unity/other/application-review Shows the review dialog using standard logic, respecting delays and user history. ```csharp P101XP.GetInstance().AppReview(); ``` -------------------------------- ### Initialize the SDK (Java) Source: https://mobilesdk.101xp.com/docs/amazon/initialization Call Platform101XP.initialize(listener) to initialize the SDK. The listener must implement Platform101XPListener and its methods are called when SDK events occur. ```java //Java Platform101XP.initialize(listener); ``` -------------------------------- ### Example: Hook SendViralPost to UI Button Source: https://mobilesdk.101xp.com/docs/unity/other/viral-posts Example method OnShareButtonClicked that calls SendViralPost with custom text and image path using Application.persistentDataPath. Opens the Android share dialog with the provided content. ```csharp // Hook to a UI button public void OnShareButtonClicked() { P101XP.GetInstance().SendViralPost( text: "I just leveled up!", imagePath: Application.persistentDataPath + "/share.png" ); } ``` -------------------------------- ### Create AdvertisingListener and initialize SDK (Kotlin) Source: https://mobilesdk.101xp.com/docs/android/advertising Kotlin version of creating an AdvertisingListener and initializing the SDK. Set the listener before calling Platform101XP.initialize. ```kotlin // Kotlin val advertisingListener: AdvertisingListener = object : AdvertisingListener { override fun onRewardedInterstitialAdShowed(amount: Int, name: String?, error: Platform101XPError?) {} override fun onRewardedInterstitialAdLoaded(error: Platform101XPError?) {} override fun onInterstitialAdShowed(error: Platform101XPError?) {} override fun onInterstitialAdLoaded(error: Platform101XPError?) {} override fun onBannerAdLoaded(error: Platform101XPError?) {} override fun onBannerAdShowed(error: Platform101XPError?) {} override fun onAppOpenAdShowed(error: Platform101XPError?) {} override fun onAppOpenAdLoaded(error: Platform101XPError?) {} override fun onInitializationComplete() {} override fun onRewardedAdLoaded(error: Platform101XPError?) {} override fun onRewardedAdShowed(amount: Int, name: String?, error: Platform101XPError?) {} } // Initialize 101XP SDK. Platform101XP.onCreate(this) Platform101XP.setAdvertisingListener(advertisingListener) Platform101XP.initialize(listener) ``` -------------------------------- ### Open Webstore with parameters Source: https://mobilesdk.101xp.com/docs/unity/other/webstore Opens the Webstore with additional parameters: purchase properties (source, campaign) and allowed locales (en, ru). ```csharp var parameters = new Dictionary { { "source", "game" }, { "campaign", "summer_event" }, }; var allowedLocale = new List { "en", "ru" }; P101XP.GetInstance().ShowWebStore(parameters, allowedLocale); ``` -------------------------------- ### Make a payment with Platform101XP.purchaseProduct() Source: https://mobilesdk.101xp.com/docs/amazon/billing Initiate a purchase with purchaseProduct(). The serverId and properties are sent to the 101XP Billing Server and the game server. The result is delivered to onPurchaseProductResult() in the listener. ```java // Java Map properties = new HashMap(); properties.put("first_purchase_property", your_purchase_property); String serverId = your_server_id; Platform101XP.purchaseProduct(product, serverId, properties); ``` ```kotlin // Kotlin val properties: MutableMap = HashMap() properties["first_purchase_property"] = "first_property" val serverId: String = your_server_id; Platform101XP.purchaseProduct(product, serverId, properties) ``` -------------------------------- ### Send event to Sentry without value map Source: https://mobilesdk.101xp.com/docs/android/analytics Sends an event to Sentry without a value map using Platform101XP.analyticsSentryTrack(). The Java example includes an eventValue.put call, while the Kotlin example only calls the method. ```java // Java eventValue.put("test"); Platform101XP.analyticsSentryTrack("test"); ``` ```kotlin // Kotlin Platform101XP.analyticsSentryTrack("test") ``` -------------------------------- ### Show Web Store with showWebStoreWithProperties: Source: https://mobilesdk.101xp.com/docs/ios/other/webstore Call this method to display the 101XP Web Store. The properties dictionary contains optional key-value pairs appended to the store URL. ```objectivec + (void)showWebStoreWithProperties:(NSDictionary *)properties; ``` -------------------------------- ### Example: Use A/B Boolean Flag Source: https://mobilesdk.101xp.com/docs/unity/other/a-b-testing Example of using an A/B boolean flag to conditionally show a new or old shop UI. The default value is false, so the old shop is shown when the flag is not set. ```csharp if (P101XP.GetInstance().GetABTestingBool("new_shop_ui", false)) { ShowNewShop(); } else { ShowOldShop(); } ``` -------------------------------- ### Open Webstore with configured values Source: https://mobilesdk.101xp.com/docs/unity/other/webstore Calls ShowWebStore with null parameters to open the Webstore using the values configured in the Settings Inspector. ```csharp P101XP.GetInstance().ShowWebStore(null, null); ``` -------------------------------- ### Initialize P101XP SDK in viewDidAppear Source: https://mobilesdk.101xp.com/docs/ios/authorization/usage Call [P101XP initialize:self] in the viewDidAppear method of the main view controller to initialize the SDK. ```objectivec #import - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [P101XP initialize:self]; } ``` -------------------------------- ### Show Web Store Methods Source: https://mobilesdk.101xp.com/docs/samsung/other/webstore Methods to display the 101XP Web Store using Java or Kotlin. ```java // Java void showWebStore(Map properties); //OR void showWebStore(Map properties, List allowedLocale); ``` ```kotlin // Kotlin fun showWebStore(properties: Map?, allowedLocale: List? = null) ``` -------------------------------- ### getProductById() method Source: https://mobilesdk.101xp.com/docs/samsung/billing Gets product by ID from AndroidManifest in com.platform101xp.sdk.billing.sku. ```Java // Java Platform101XPProduct product = Platform101XP.getProductById("com.101xp.product"); ``` ```Kotlin // Kotlin val product = Platform101XP.getProductById("com.101xp.product") ``` -------------------------------- ### Get product by ID with getProductById (Kotlin) Source: https://mobilesdk.101xp.com/docs/android/billing Kotlin version of getProductById. ```Kotlin // Kotlin val product = Platform101XP.getProductById("com.101xp.product") ``` -------------------------------- ### Initialize SDK in onCreate after Platform101XP.onCreate (Java) Source: https://mobilesdk.101xp.com/docs/amazon/initialization In the Activity's onCreate, call Platform101XP.onCreate(this) before Platform101XP.initialize(listener). This is required to avoid errors. ```java //Java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Initialize 101XP SDK. Platform101XP.onCreate(this); Platform101XP.initialize(listener); } ``` -------------------------------- ### PHP sign calculating example Source: https://mobilesdk.101xp.com/docs/server-side-methods/game-server-payments-handler PHP example for calculating the request signature using the private key from managers. It sorts parameters, concatenates key=value pairs, appends the private key, and hashes with MD5. If the signature does not match, it returns an error; otherwise, it processes the payment and returns a success response with the transaction ID. ```php $privateKey = 'Secret key from our managers'; $signature = ''; $params = $_POST; unset($params['sign']); ksort($params); foreach ($params as $k => $v) { $signature .= $k . '=' . $v; } $signature = hash('md5', $signature . $privateKey); if ($_POST['sign'] == $signature) { $result = [ 'status' => 'error', 'error_message' => 'Signature is incorrect.', ]; exit(json_encode($result)); } // Other code that charge payment to game and gives response $result = [ 'status' => 'success', 'transaction_id' => 1234567, // your internal transaction id ]; echo json_encode($result); ``` -------------------------------- ### Initialize SDK in onCreate after Platform101XP.onCreate (Kotlin) Source: https://mobilesdk.101xp.com/docs/amazon/initialization In the Activity's onCreate, call Platform101XP.onCreate(this) before Platform101XP.initialize(listener). This is required to avoid errors. ```kotlin // Kotlin override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Initialize 101XP SDK. Platform101XP.onCreate(this) Platform101XP.initialize(listener) } ``` -------------------------------- ### ShowWebStore(parameters, allowedLocale) Source: https://mobilesdk.101xp.com/docs/unity/other/webstore Opens the 101XP web store using the values configured in the Settings Inspector. Optional URL properties are appended to the final web store URL as key=value pairs, and an optional list of allowed locale codes can be provided. ```APIDOC ## ShowWebStore(parameters, allowedLocale) ### Description Opens the Webstore using the values configured in the Settings Inspector. Optional URL properties are appended to the final Webstore URL as `key=value`. An optional list of allowed locale codes (e.g., `en`, `ru`) can be provided. ### Method `void ShowWebStore(Dictionary purchaseProperties, List allowedLocale)` ### Parameters - **purchaseProperties** (Dictionary) - Optional - URL properties appended to the final Webstore URL as `key=value`. - **allowedLocale** (List) - Optional - List of allowed locale codes, e.g., `en`, `ru`. ### Request Example ``` var parameters = new Dictionary { { "source", "game" }, { "campaign", "summer_event" }, }; var allowedLocale = new List { "en", "ru" }; P101XP.GetInstance().ShowWebStore(parameters, allowedLocale); ``` ``` -------------------------------- ### Implement p101xpOnGetAnalyticsConversionData delegate Source: https://mobilesdk.101xp.com/docs/ios/analytics Implement this delegate method to get conversion data from AppsFlyer. ```objectivec - (void)p101xpOnGetAnalyticsConversionData:(NSDictionary *)data; ``` -------------------------------- ### Platform101XP.initialize(listener) Source: https://mobilesdk.101xp.com/docs/huawei/initialization Initializes the 101XP SDK. The listener object's methods are called when events occur within the SDK. The listener class must implement the Platform101XPListener interface. Must be called in onCreate() after calling Platform101XP.onCreate(this). ```APIDOC ## Platform101XP.initialize(listener) ### Description Initializes the 101XP SDK. The listener object's methods are called when events occur within the SDK. The listener class must implement the Platform101XPListener interface. Must be called in onCreate() after calling Platform101XP.onCreate(this). ### Call Example (Java) ```java Platform101XP.initialize(listener); ``` ### Call Example (Kotlin) ```kotlin Platform101XP.initialize(listener) ``` ### Important - Must be called in `onCreate()` after calling `Platform101XP.onCreate(this)`. ### Example in onCreate ```java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Initialize 101XP SDK. Platform101XP.onCreate(this); Platform101XP.initialize(listener); } ``` ```kotlin override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Initialize 101XP SDK. Platform101XP.onCreate(this) Platform101XP.initialize(listener) } ``` ``` -------------------------------- ### showWebStore method signatures (Java and Kotlin) Source: https://mobilesdk.101xp.com/docs/amazon/other/webstore Method signatures for showing the 101XP Web Store. The first overload takes only properties; the second also takes an allowedLocale list. If the device locale is not in allowedLocale, the first element is used. ```java // Java void showWebStore(Map properties); //OR void showWebStore(Map properties, List allowedLocale); ``` ```kotlin // Kotlin fun showWebStore(properties: Map?, allowedLocale: List? = null) ``` -------------------------------- ### Get product by ID (Kotlin) Source: https://mobilesdk.101xp.com/docs/amazon/faq Request a product from the MSDK using its ID before making a purchase. ```kotlin //kotlin val product = Platform101XP.getProductById("com.101xp.product") ``` -------------------------------- ### ViewController.h and ViewController.m: P101XPDelegate conformance Source: https://mobilesdk.101xp.com/docs/ios/integration Conform to P101XPDelegate and call [P101XPSDK initialize:self] in viewDidAppear to enable feedback communication with the SDK. ```objectivec // ViewController.h #import @interface ViewController : UIViewController // ViewController.m - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [P101XPSDK initialize:self]; } ``` -------------------------------- ### Subscribing to authorization and account events Source: https://mobilesdk.101xp.com/docs/unity/migration Use events to be notified when data becomes available, as shown in this example. ```csharp sdk.AuthorizeResultEvent += OnAuthorize; sdk.GetAccountEvent += OnAccountReceived; ``` -------------------------------- ### Make a purchase Source: https://mobilesdk.101xp.com/docs/unity/billing Initiates a purchase. The serverId and purchaseProperty parameters are sent to the 101XP Billing Server and the game server. The result is delivered via the Purchase Event or, for alternative payment providers, via the Internal Order Event. ```csharp P101XP.GetInstance().PurchaseProduct(productId, serverId, purchaseProperty); ``` -------------------------------- ### Get Account Properties in Kotlin Source: https://mobilesdk.101xp.com/docs/android/other/account Use this snippet to retrieve the current user account object in Kotlin. ```kotlin import com.platform101xp.authorize.account.Account val account = Platform101XP.getAccount() ``` -------------------------------- ### Get Account Properties in Java Source: https://mobilesdk.101xp.com/docs/android/other/account Use this snippet to retrieve the current user account object in Java. ```java import com.platform101xp.authorize.account.Account; Account account = Platform101XP.getAccount(); ``` -------------------------------- ### Configure application-level build.gradle Source: https://mobilesdk.101xp.com/docs/samsung/integration Add this to your application-level build.gradle file to enable multidex, configure the SDK repository, and include the required dependencies. Note: if you add 'com.platform101xp:advertising_samsung:3.XX.XX', read the Advertising section. ```groovy android { defaultConfig { multiDexEnabled true } dexOptions { javaMaxHeapSize "4g" } } repositories { google() maven { url 'https://artifactory101xp.jfrog.io/artifactory101xp/p101xp-android-stage/' credentials { username = "sdk-user" password = "Dt!k(5JR&6" } } maven { url 'https://zendesk.jfrog.io/zendesk/repo' } maven { url 'https://maven.google.com/'} maven { url 'https://jitpack.io' } maven { url 'https://android-sdk.is.com/' } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "androidx.appcompat:appcompat:1.7.1" implementation "androidx.multidex:multidex:2.0.1" implementation 'com.platform101xp:sdk_samsung:3.XX.XX' implementation 'com.platform101xp:advertising_samsung:3.XX.XX' implementation 'com.platform101xp:api_samsung:3.XX.XX' implementation 'com.platform101xp:authorization_samsung:3.XX.XX' implementation 'com.platform101xp:base_samsung:3.XX.XX' implementation 'com.platform101xp:billing_samsung:3.XX.XX' implementation 'com.platform101xp:utils_samsung:3.XX.XX' } apply plugin: 'com.google.gms.google-services' ``` -------------------------------- ### Platform101XP.initialize(listener) Source: https://mobilesdk.101xp.com/docs/samsung/initialization Initializes the 101XP SDK. The listener object's methods are called when events occur within the SDK. The listener class must implement the Platform101XPListener interface. ```APIDOC ## Platform101XP.initialize(listener) ### Description Initializes the 101XP SDK. The listener object's methods are called when events occur within the SDK. The listener class must implement the Platform101XPListener interface. ### Method N/A (SDK method) ### Endpoint N/A ### Parameters - **listener** (Platform101XPListener) - Required - The listener object that will receive SDK events. ### Request Example ```java Platform101XP.initialize(listener); ``` ### Response N/A ``` -------------------------------- ### Get Adjust conversion data (Kotlin) Source: https://mobilesdk.101xp.com/docs/amazon/analytics Kotlin override of onGetAnalyticsConversionData to receive conversion data from Adjust. ```Kotlin // Kotlin override fun onGetAnalyticsConversionData(dataMap: Map?) { } ``` -------------------------------- ### showWebStore(Map properties) Source: https://mobilesdk.101xp.com/docs/amazon/other/webstore Shows the 101XP Web Store with optional properties appended to the URL. ```APIDOC ## showWebStore(Map properties) ### Description Shows the 101XP Web Store. Accepts optional properties that are appended to the final Web Store URL as key=value pairs. ### Method SDK method call ### Signature `void showWebStore(Map properties)` ### Parameters - **properties** (Map) - Required - Additional optional properties appended to the Web Store URL as "key=value". ### Example ```java Map properties = new HashMap(); properties.put("first_purchase_property", your_purchase_property); Platform101XP.showWebStore(properties); ``` ``` -------------------------------- ### Get Adjust conversion data (Java) Source: https://mobilesdk.101xp.com/docs/amazon/analytics Override onGetAnalyticsConversionData in Platform101XPListener to receive conversion data from Adjust. ```Java // Java @Override public void onGetAnalyticsConversionData(Map map) { } ``` -------------------------------- ### Make a Purchase with purchaseProduct Source: https://mobilesdk.101xp.com/docs/ios/billing Call [P101XP purchaseProduct:serverId:properties:] to initiate a purchase. The serverId and properties are sent to the 101XP Billing Server and game server. The result is delivered to the delegate method p101xpOnPurchaseProductResult. ```objectivec [P101XP purchaseProduct:product serverId:your_server_id properties:@{ @"player_id": your_property }]; ``` -------------------------------- ### Get product by ID with Platform101XP.getProductById() Source: https://mobilesdk.101xp.com/docs/amazon/billing Retrieve a product by its ID, which must match an ID listed in the billing_sku meta-data in AndroidManifest.xml. ```java // Java Platform101XPProduct product = Platform101XP.getProductById("com.101xp.product"); ``` ```kotlin // Kotlin val product = Platform101XP.getProductById("com.101xp.product") ```