Quantcast
Jump to content


Recommended Posts

Posted

2021-03-08-01-banner.jpg

Selling digital content is a popular business all over the world. If you are interested in selling your digital items in the Samsung ecosystem, then you need to learn about the Samsung In-App Purchase (IAP) SDK. You can implement Samsung IAP in your Android, Unity, and Unreal Applications.

Since server to server communication is more secure and reliable, payment transaction should be verified from the IAP server. This is the second of two blogs on this topic. In the first part, we discussed how to integrate Samsung’s IAP server API into your app’s server. In this blog, we will learn how to communicate with your server through an Android app.

Please go through the documentation of Samsung IAP SDK to integrate Samsung IAP SDK in your app. Then build your own app server for server verification which is covered in the first part of this blog. To know about server API, read Samsung IAP Server API.

Get Started

Let’s learn through a simple Android game. This game has an item which can only be used for a certain period of time. So, it is a subscription type item. If a user buys this item, then the item will be available after purchase verification.

When the app is launched, the app checks if this item is already subscribed or not. There can be one of two results:

  • The item is not subscribed, then the app offers to subscribe this item.
  • The item is subscribed then the app gets the current status of this subscription through getSubscriptionStatus Server API. The subscription status can be active or cancel. Subscription can be canceled for various reasons. If the IAP server returns the subscription status as ‘cancel’ then the app notifies it to the user.

Implementation of these two cases are discussed in the next sections.


2021-03-08-01-01.jpg

Implement Android IAP

At first, integrate Samsung IAP SDK in your Android app and register it in the seller office to test In-App items. When the app is launched, call getOwnedList() API. It returns a list of in-app items that the app user currently has from previous purchases. If the item is not in this list, then the app offers to purchase the item.

To purchase any item, call startPayment(). This API notifies the end user if the purchase succeeded or failed. If the purchase is successful, then do the server verification. If your app’s server validates the purchase, then make the item available to the user, otherwise request user to purchase it again.

public void onPayment(ErrorVo _errorVo, PurchaseVo _purchaseVo) {
    if (_errorVo != null) {
        if (_errorVo.getErrorCode() == IapHelper.IAP_ERROR_NONE) {
            if (_purchaseVo != null) {
                if (mPassThroughParam != null && _purchaseVo.getPassThroughParam() != null) {
                    if (mPassThroughParam.equals(_purchaseVo.getPassThroughParam())) {
                        if (_purchaseVo.getItemId().equals(ITEM_ID_SUBSCRIPTION)) {
                            mMainActivity.setBackgroundPurchaseId(_purchaseVo.getPurchaseId());
                            new PurchaseVerification(mMainActivity).execute(_purchaseVo.getPurchaseId());
                        }
                    } 
                }
            } 
         }
     }
}

If the item is available in this list, then detailed information of this item such as purchase ID will be available in the OwnedProductVo type ArrayList. To call getSubscriptionStatus Server API, we need the purchase ID of the item. So, send this ID to your app’s server to get the status of the subscribed item.

public void onGetOwnedProducts(ErrorVo _errorVo, ArrayList<OwnedProductVo> _ownedList) {
        if (_errorVo != null) {
            if (_errorVo.getErrorCode() == IapHelper.IAP_ERROR_NONE) {
                if (_ownedList != null) {
                    for (OwnedProductVo item : _ownedList) {
                        if (item.getItemId().compareTo(ItemName.ITEM_ID_SUBSCRIPTION) == 0) {
                            // Check whether subscription is canceled or not.
                            new SubscriptionDetails(mMainActivity).execute(item.getPurchaseId());
                        }
                    }
                }
            } else {
                Log.e(TAG, "onGetOwnedProducts ErrorCode [" + _errorVo.getErrorCode() +"]");
            }
        }
    }

Connect Your App with Your App Server

Create an asynchronous task for communicating with the server. This task has two parts. One is to send purchase ID to your app server and the other is to receive the result from the app server. Use doInBackground() method for these two tasks. Return this result to your main UI through onPostExecute() method.

Create a class which extends AsyncTask<String,Void,String> for server verification. Then write the following code in doInBackground() method to send the purchase ID:

CookieHandler.setDefault( new CookieManager( null, CookiePolicy.ACCEPT_ALL ) );
try{
   URL url = new URL("http:// "); //URL of your app’ server
   URLConnection connection = url.openConnection();
   connection.setDoOutput(true);
   connection.setDoInput(true);
   OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream(); 
   String y = "";
   for(int i = 0;i < x.length;i++)
   {
        y = y + x[i];
   }
   out.write(y);
   out.close();
   }catch(Exception e){ 
   }

Receive to the server verification result using the following code:

String output = "";
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String s = "";
while((s = in.readLine())!= null)
{
       output = output + s;
       in.close();
}
return output;    

Now, create an Interface called ServerResponse and implement it in an Activity where you want to show the result from your app’s server.

public interface ServerResponse {
    void processFinish(String output);
}

After receiving the result from the server, return the result to your main UI through onPostExecute() method.

protected void onPostExecute(String result) {
    serverresponse.processFinish(result);
}

Test your app

Let’s test the app. Upload your web app onto a server. Then use that URL in your app to check server verification in doInBackground() method. Keep in mind that Samsung In-App Purchase can’t be tested in an emulator of Android Studio. So use a Samsung device to test your app. Read the Test Guide before starting to test your app. A simple Android game is attached at the end of this article where app to server communication is implemented.

This game has a blue background image which can be subscribed. If this item is not in an active subscription period, then the app offers to subscribe the background. If the user purchases the item, then the game verifies the purchase through the server. If the purchase is verified, then it shows that the subscription status is activated and the app makes the item available. If the user unsubscribes the item from the Galaxy Store, subscription status becomes ‘cancel’. However, as the active subscription period has not ended yet, the item is still available in the app.


2021-03-08-01-02.jpg
2021-03-08-01-03.jpg
2021-03-08-01-04.jpg

Wrapping Up

In these two blogs, we have covered the full communication between your app, server and IAP server. Now you will be able to implement purchase verification through your server. If your app is free but has some premium contents, then you can monetize your app. Samsung In-App Purchase provides many ways to earn money from your app. Go to Galaxy Store Games to find out more details about it.

Follow Up

This site has many resources for developers looking to build for and integrate with Samsung devices and services. Stay in touch with the latest news by creating a free account or by subscribing to our monthly newsletter. Visit the Marketing Resources page for information on promoting and distributing your apps. Finally, our developer forum is an excellent way to stay up-to-date on all things related to the Galaxy ecosystem.

View the full blog at its source



  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Similar Topics

    • By Mahesh Gadhe
      Hi 
      I have a Samsung professional digital signage display device (TV) where I manually download and install the app through the web app address. Instead, I want the app to auto-update. If I replace the previously installed file with a new one, the device should automatically detect the new version, download, and install it without any manual interaction.
    • By Samsung Newsroom
      Samsung TV Plus1 is going all-in on one of the hottest content categories, with the arrival of nearly 4,000 hours of free-to-stream Korean shows and movies now available on-demand in the U.S. With audiences around the world falling in love with the exhilarating world of Korean culture and entertainment, Samsung TV Plus is proud to offer viewers access to premium titles across a variety of genres like K-Dramas, K-Crime, K-Thrillers and K-Romance, just to name a few.
       
      With the October 3rd arrival of new K-Content from Korea’s most acclaimed production companies CJ ENM and NEW ID and distribution company KT Alpha, Samsung TV Plus is now one of the largest providers of Korean scripted and unscripted TV series and movies in the U.S.
       
      ▲ Nearly 4,000 hours of free-to-stream Korean shows and movies are now available on-demand in the U.S. on Samsung TV Plus, the company’s FAST (Free Ad-supported Streaming TV) service.
       
       
      Endless Entertainment on the World’s #1 Smart TV
      The premium offering in the U.S. will bring monthly exclusives from CJ ENM with hit series like Voice 4 and Dark Hole, along with romance drama Doom at Your Service. The psychological thriller drama Beyond Evil distributed by NEW ID will also be arriving soon.
       
      Samsung TV Plus and CJ ENM have also teamed up to bring unscripted, never before seen programs to the U.S., which includes popular food entertainment shows such as The Genius Paik and Three Meals a Day, along with travel shows House on Wheels and Youn’s Kitchen. And for the movie enthusiasts, Samsung TV Plus is now home to NEW ID and KT Alpha’s largest K-Movie offering in the U.S., with hit titles like NEW ID’s award winning Korean films Burning, starring Steven Yeun of Beef and A Taxi Driver, starring Kang-ho Song of the award-winning global blockbuster, Parasite. Fans can also enjoy popular movies from KT Alpha such as Joint Security Area, Oh! Brothers, The President’s Last Bang, 26 Years.
       
      “K-Content is no longer niche — it’s one of the fastest growing and most watched categories globally, and Samsung TV Plus is uniquely positioned to deliver an unparalleled experience in this space with an endless offering of premium K-Content,” said Salek Brodsky, Senior Vice President & General Manager of Samsung TV Plus. “Our partnerships with the leading Korean production and distribution companies CJ ENM, NEW ID and KT Alpha came naturally, with Samsung TV Plus being the platform of choice to reach the largest audience possible, of both existing K-Fans and new viewers.”
       
       
      An Immersive Plunge Into a Galaxy of K-Content
      “As a leading entertainment company, CJ ENM offers the widest range of K-Content, from hit dramas and variety shows to K-Pop and globally acclaimed films. Through Samsung TV Plus, we are excited not only to bring our diverse content libraries to international audiences but also to explore new collaboration opportunities to further expand the impact of Korean entertainment.” added Seo Jang-ho, SVP of CJ ENM Content Business Division.
       

      How To Watch
      Samsung TV Plus offers the best of TV, all for free – and is available exclusively across the Samsung TV, Galaxy, Smart Monitor, and Family Hub lineups. This includes the 2024 Samsung Neo QLED 8K, Neo QLED 4K, OLED, and The Frame, which are designed with advanced AI2 that can upscale even your favorite older classics on Samsung TV Plus into stunning 4K and 8K quality.
       
       
      1 Samsung TV Plus is the go-to service for free, premium entertainment that allows content owners and advertisers to engage consumers at scale. As a leader in free ad-supported TV (FAST) and video-on-demand (AVOD), Samsung TV Plus is the #1 free ad-supported app on Samsung Smart TVs, with nearly 3,000 ad-supported linear channels available globally in 27 countries across 630M active devices. Samsung TV Plus is accessible on 2016-2024 Samsung Smart TVs, Galaxy devices, Smart Monitors and Family Hub refrigerators. To learn more, visit samsungtvplus.com.
      2 Uses AI-based formulas.
      View the full article
    • By Samsung Newsroom
      Samsung Electronics today announced that it has been named the number one signage manufacturer for the fifteenth consecutive year by market research firm Omdia, once again demonstrating its leadership in the global digital signage market.1
       
      According to Omdia, in 2023 Samsung not only led the global signage market with a 33% market share, but also sold over 2 million units — a record-breaking number for the company.2
       
      “Achieving first place in the global display signage market for 15 consecutive years reflects our commitment to innovation and our ability to adapt to evolving market conditions and the needs of our customers,” said Hoon Chung, Executive Vice President of Visual Display Business at Samsung Electronics. “We will continue to provide the highest value to our customers by offering specialized devices, solutions and services that address their diverse needs.”
       
      Samsung Electronics is regularly introducing differentiated signage products that meet various business environment needs.
       
      The Wall, the world’s first modular display with micro LED technology. Thanks to its modular format, The Wall allows customers to adjust the sign’s size, ratio and shape based on preference and use case. Smart Signage, which provides an excellent sense of immersion with its ultra-slim profile and uniform bezel design. Outdoor Signage tailored for sports, landmark markets, and electric vehicle charging stations. The screens in the Outdoor Signage portfolio are designed for clear visibility in any weather environment. Samsung Interactive Display, an e-board optimized for the education market that puts educational tools at the fingertips of educators and students.  
      The expansion of The Wall lineup is a clear indication of Samsung’s innovations and leading technology. Products like The Wall All-in-One and The Wall for Virtual Production were chosen by customers for their exceptional convenience and unique use cases, while The Wall has been selected as the display of choice for luxury hotels like Atlantis The Royal in Dubai and Hilton Waikiki Beach in Hawaii.
       
      Samsung’s leadership in the digital signage industry can be attributed to the company’s commitment to product and service innovation. For example, the introduction of the world’s first transparent Micro LED display in January was noted by industry experts as the next generation of commercial display, earning accolades such as “Most Mind-Blowing LED” and “Best Transparent Display” from the North American AV news outlet, rAVe.
       

       
      The recent introduction of the Samsung Visual eXperience Transformation (VXT) platform further demonstrates Samsung’s commitment to display innovation. This cloud-native platform combines content and remote signage operations on a single, secure platform, offering services and solutions that go beyond just hardware while ensuring seamless operation and management for users.
       
      Looking ahead, the global display signage market is poised for rapid growth, with an expected annual increase of 8% leading to a projected market size of $24.6 billion by 2027, up from $14 billion in 2020.3
       
       
      1 Omdia Q4 2023 Public Display Report; Based on sales volume. Note: consumer TVs are excluded.
      2 Omdia Q4 2023 Public Display Report; Based on sales volume. Note: consumer TVs are excluded.
      3 According to the combined LCD and LED signage sales revenue. Omdia Q4 2023 Public Displays Market Tracker (excluding Consumer TV), Omdia Q4 LED Video Displays Market Tracker.
      View the full article
    • By Samsung Newsroom
      Samsung Electronics today announced the official launch of its Visual eXperience Transformation (VXT) Platform, a cloud-native Content Management Solution (CMS) combining content and remote signage management on one secure platform. Designed with ease-of-use in mind, the all-in-one solution allows businesses to easily create and manage their digital displays.
       
      “Cloud migration is an unstoppable trend,” said Alex Lee, Executive Vice President of Visual Display Business at Samsung Electronics. “VXT is an innovative step toward this migration in that it makes high-tech signage more readily accessible, no matter where our customers are. But not only is high-tech signage accessible, the content and remote management solutions VXT provides are user-friendly.”
       
       
      Efficient Cloud-Native Solution for All Business Needs
      Samsung VXT is the next evolution of CMS software from MagicINFO, delivering an enhanced cloud-native solution tailored for seamless content creation and management of all B2B displays — including LCD, LED signage and The Wall. VXT streamlines the deployment and updating of software directly via a cloud portal, which eliminates the cumbersome process of manual updates. Registration of devices is designed for efficiency, as well, with a simple 6-digit pairing code that allows for quick and secure setup.
       
      By streamlining digital signage operations and management, VXT offers a versatile solution that meets the needs of any sector, whether it be retail, hospitality, food and beverage or corporate. The solution has already received recognition from prominent partners such as Hy-Vee’s retail media network, RedMedia, which uses VXT CMS to manage a network of over 10,000 Samsung smart signage screens — including the QBR-Series, which has been installed across all of Hy-Vee’s grocery stores and retail locations.
       
       
      Intuitive Content and Screen Management
      Unlike other CMS solutions, VXT is a turnkey solution developed by Samsung that allows users to seamlessly create content and manage screens in one application. It consists of three CMS modules: VXT CMS, VXT Canvas1 and VXT Players, and each module makes content creation and screen management easier than ever:
       
      VXT CMS: Content management is simplified through an intuitive interface that simultaneously handles content, playlists and schedules. The remote management feature allows real-time management of multiple devices. Additionally, robust security features — such as private certificates and allowing customizable security solutions for every business need. VXT Canvas: What You See is What You Get (WYSIWYG)-based creative tools that enable anyone to create content effortlessly and more intuitively with support for various templates, widgets and partner content. Users can create original content with custom and company fonts, as well as templates and images pre-loaded on the system for added convenience. VXT Players: VXT supports Tizen and Android-based players,2 while also managing multiple web elements simultaneously on one screen. Additionally, a web-based virtual screen allows users to easily view and manage their signage deployments.  
      VXT also combines content, solutions and expertise of third-party system integrators, software developers and content partners to provide users with access to an even broader range of incredible content, specific to vertical use cases, without the need for additional customization or development.3 Some of the notable Pre-Integrated Repeatable Solutions (PIRS) include:
       
      VXT Art: Users can access a diverse library of artwork and photos with just a few clicks, and content from various art museums and galleries can be used across businesses ranging from office spaces to restaurants and beyond. Link My POS: This solution enabled by Wisar Digital allows businesses to use VXT Canvas to pull product data from Point Of Sale (POS) systems, eliminating the need to manually enter data or export data. Link My POS improves overall efficiency and reduces pricing errors, which in turn saves time and money. Ngine Real Estate: This solution developed through a partnership with Ngine Networks lets businesses display properties that are for sale or rent by using VXT to forego re-entering data when connecting directly to their platforms. Ngine Automotive: Cars, bikes and boats can be listed as for sale or rent by connecting directly to business displays, without needing to enter information. Messages can be resumed on social network platforms, as well. This solution has also been achieved by partnering with Ngine Networks.  
       
      Seamlessly Control and Manage from Anywhere
      By offering compatibility with both desktop and mobile devices4, Samsung VXT revolutionizes content management because it caters to both the advanced needs of desktop users and the convenience required by mobile users. This flexibility allows users to manage their content anytime, anywhere.
       
      Furthermore, VXT is designed to substantially reduce downtime in digital signage operations. Through advanced modular architecture, VXT isolates and minimizes the impact of any potential failures, allowing users to swiftly address disruptions. VXT also comes with an early warning feature, which detects potential issues — such as extreme temperature changes or network instability — and alerts customers before failure occurs. This offers greater peace of mind by allowing users to take preemptive actions or speed up the recovery time.
       
      VXT’s energy management tool offers an at-a-glance view of energy consumption levels, as well. Customers can optimize their energy use based on monthly insights and adjust settings like brightness levels and automatic on/off times accordingly.
       
       
      Availability
      Samsung will hold a global launch event of VXT on January 31 at Integrated Systems Europe (ISE) 2024 in Barcelona. Designed as an omni-channel service, VXT will be accessible through various subscription plans, including both monthly and annual options. Customers can also make offline purchases through existing B2B sales channels worldwide, while online purchases will initially be made available in the U.S. before a subsequent global rollout in 2024. Prospective users can take advantage of a 60-day free trial before subscribing.
       
      For more information on Samsung’s VXT platform, please visit https://vxt.samsung.com.
       
       
      1 VXT CMS and VXT Canvas supported on Chrome browser only.
      2 VXT is compatible with Android devices running Android 10 or higher, and with Tizen devices on Tizen 6.5 or higher.
      3 For PIRS partner content, additional subscription payment is required.
      4 VXT CMS and VXT Canvas supported on Chrome browser only.
      View the full article
    • By Samsung Newsroom
      Transparent LEDs are poised to redefine viewing experiences, making the line between content and reality virtually indistinguishable. Leveraging this groundbreaking technology, Samsung Electronics has upleveled its leading MICRO LED display to expand how users enjoy visual content.
       
      The company’s Transparent MICRO LED display was unveiled for the first time at Samsung First Look 2024 on January 7 (local time) — ahead of the Consumer Electronics Show (CES) 2024, the world’s largest consumer electronics and information technology exhibition held in Las Vegas from January 9-12. Combining superior craftsmanship with six years of tireless research and development, this new modular MICRO LED wowed attendees with its futuristic design. The Transparent MICRO LED’s crystal-clear, glass-like display has revolutionized the viewing experience and attracted the attention of global consumers.
       
      Check out how Transparent MICRO LEDs will make everything from sports to movies more vivid and immersive in the video below.
       
       View the full article





×
×
  • Create New...