Introduction
The Samsung IAP Publish API allows builders to effectively handle in-app buy (IAP) merchandise inside purposes. This API serves as the muse for dealing with CRUD (Create, Learn, Replace, Delete) operations associated to digital merchandise out there for buy. Builders can use this API to view current in-app merchandise, register new merchandise, modify product particulars akin to worth and outline, and take away merchandise which can be not wanted.
As part of this text, we are going to develop a backend software server and an internet software to streamline Samsung IAP product administration. The backend server will talk with the Samsung server by way of the Samsung IAP Publish API, dealing with requests associated to IAP merchandise to make sure easy integration and operation. The online software will present an intuitive, user-friendly interface, permitting builders and directors to visually handle Samsung IAP merchandise in a structured and arranged method.
By implementing this method, builders can considerably scale back handbook effort whereas sustaining higher management over their IAP merchandise. Moreover, the Publish API allows a unified product backend, serving to standardize workflows, implement constant insurance policies, and preserve clear audit trails—additional enhancing the design and operational effectivity of IAP administration.
To start, you’ll want to have a cellular software in Galaxy Retailer so to create Samsung IAP merchandise. For those who wouldn’t have one, comply with the Integration of Samsung IAP Providers in Android Apps article.
API overview
The Samsung IAP Publish API permits builders to handle IAP merchandise of their purposes by viewing, creating, updating, modifying, and deleting merchandise.
Base URL
The bottom URL for accessing the Samsung IAP Publish API endpoints is.
https://devapi.samsungapps.com/iap/v6/purposes/:packageName/objects
Substitute packageName with the precise bundle identify of your software to entry the related Samsung IAP endpoints.
Supported technique
The Samsung IAP Publish API permits fetching a listing of obtainable merchandise or viewing detailed details about a selected product utilizing GET requests. To register a brand new product, builders can ship a POST request, whereas updating an current product requires a PUT request. If solely partial modifications are wanted, a PATCH request is required. Lastly, merchandise could be eliminated with a DELETE request.
Header
Add the next fields to the request header.
- Authorization: This area requires Bearer token which is the entry token from Galaxy Retailer authentication server. For extra data, see the Create an Entry Token web page.
- Service Account ID: Get the Service Account ID worth by clicking the Help > API Service tabs on the Vendor Portal. For extra particulars, learn the part Create a service account and comply with step 6.
- Content material-Kind: Use
software/jsonas worth.
Implementation of Samsung Publish API
The Samsung IAP Publish API helps to handle IAP merchandise by performing CRUD operations akin to viewing, creating, updating, and eradicating merchandise. To make use of these operations, we have to arrange a server that processes API requests and executes these operations as instructed.
First, create a server. As soon as the server is prepared, we will combine the Samsung API for server-to-server communication.
On this instance, we use OkHttp for community communication to name the API. The front-end communicates with the Spring Boot server, and the Spring Boot server, in flip, interacts with the Samsung IAP service.
Implementation of the “Create Product” operation
A POST request is required to create a brand new product. For extra particulars, seek advice from the documentation.
non-public static ultimate String CREATE_API_URL = "https://devapi.samsungapps.com/iap/v6/purposes/com.instance.bookspot/objects";
@PostMapping(worth = "/create", consumes = org.springframework.http.MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity createItem(@org.springframework.internet.bind.annotation.RequestBody String requestBody) {
okhttp3.MediaType mediaType = okhttp3.MediaType.parse("software/json");
okhttp3.RequestBody physique = okhttp3.RequestBody.create(mediaType, requestBody);
Request request = new Request.Builder()
.url(CREATE_API_URL)
.submit(physique)
.addHeader("Content material-Kind", "software/json")
.addHeader("Authorization", "Bearer " + ACCESS_TOKEN)
.addHeader("service-account-id", SERVICE_ACCOUNT_ID)
.construct();
strive (Response response = consumer.newCall(request).execute()) {
String responseString = response.physique() != null ? response.physique().string() : "No response physique";
return ResponseEntity.standing(response.code()).physique(responseString);
} catch (IOException e) {
return ResponseEntity.standing(500).physique("Error: " + e.getMessage());
}
}
Instance response
After profitable execution of the POST request, the server will reply with the standing 200 (Success). Under is the visible illustration of the operation.
Determine 1: UI illustration of Create Product operation
For a listing of attainable response codes when a request fails, seek advice from Failure response codes.
Implementation of the “View Product Checklist” operation
To view the already created merchandise, we have to fetch them from the Samsung server. For this, we have to construct a GET request to retrieve the merchandise. For extra particulars, seek advice from the documentation.
non-public static ultimate String VIEW_API_URL = "https://devapi.samsungapps.com/iap/v6/purposes/com.instance.bookspot/objects?web page=1&measurement=20";
@GetMapping("/get")
public ResponseEntity getRequest() {
Request request = new Request.Builder()
.url(VIEW_API_URL)
.addHeader("Content material-Kind", "software/json")
.addHeader("Authorization", "Bearer " + ACCESS_TOKEN)
.addHeader("service-account-id", SERVICE_ACCOUNT_ID)
.construct();
strive (Response response = consumer.newCall(request).execute()) {
if (!response.isSuccessful()) {
String error = response.physique() != null ? response.physique().string() : "Unknown error";
return ResponseEntity.standing(response.code()).physique("Failed: " + error);
}
String json = response.physique() != null ? response.physique().string() : "{}";
return ResponseEntity.okay()
.contentType(org.springframework.http.MediaType.APPLICATION_JSON)
.physique(json);
} catch (IOException e) {
return ResponseEntity.standing(500).physique("Error: " + e.getMessage());
}
}
Instance response
After the request is efficiently despatched to the server, it’s going to reply with the standing code 200. Under is the visible illustration of the product retrieval course of.
Determine 2: UI illustration of View Product Checklist operation
For a listing of attainable response codes when a request fails, seek advice from Failure response codes.
Implementation of the “Modify Product” operation
To switch the listed merchandise, we have to create a PUT request based mostly on the required fields and carry out the modification operation accordingly. For extra particulars, seek advice from the documentation.
non-public static ultimate String MODIFY_API_URL = "https://devapi.samsungapps.com/iap/v6/purposes/com.instance.bookspot/objects";
@PutMapping(worth = "/replace", consumes = org.springframework.http.MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity updateItem(@RequestBody String requestBody) {
okhttp3.MediaType mediaType = okhttp3.MediaType.parse("software/json");
okhttp3.RequestBody physique = okhttp3.RequestBody.create(mediaType, requestBody);
Request request = new Request.Builder()
.url(MODIFY_API_URL)
.put(physique)
.addHeader("Content material-Kind", "software/json")
.addHeader("Authorization", "Bearer " + ACCESS_TOKEN)
.addHeader("service-account-id", SERVICE_ACCOUNT_ID)
.construct();
strive (Response response = consumer.newCall(request).execute()) {
String responseString = response.physique() != null ? response.physique().string() : "No response physique";
return ResponseEntity.standing(response.code()).physique(responseString);
} catch (IOException e) {
return ResponseEntity.standing(500).physique("Error: " + e.getMessage());
}
Instance response
Under is a visible illustration of a response to a profitable modification request.
Determine 3: UI illustration of Modify Product operation
For a listing of attainable response codes when a request fails, seek advice from Failure response codes.
Implementation of the “Take away Product” operation
To delete a product from the server, we have to make a DELETE request utilizing the required fields and execute the merchandise removing operation accordingly. For extra particulars, seek advice from the documentation.
non-public static ultimate String REMOVE_API_URL = "https://devapi.samsungapps.com/iap/v6/purposes/com.instance.bookspot/objects";
@DeleteMapping("/delete/{itemId}")
public ResponseEntity deleteItem(@PathVariable String itemId) {
String deleteUrl = REMOVE_API_URL + "https://developer.samsung.com/" + itemId;
Request request = new Request.Builder()
.url(deleteUrl)
.delete()
.addHeader("Content material-Kind", "software/json")
.addHeader("Authorization", "Bearer " + ACCESS_TOKEN)
.addHeader("service-account-id", SERVICE_ACCOUNT_ID)
.construct();
strive (Response response = consumer.newCall(request).execute()) {
String responseString = response.physique() != null ? response.physique().string() : "No response physique";
return ResponseEntity.standing(response.code()).physique(responseString);
} catch (IOException e) {
return ResponseEntity.standing(500).physique("Error: " + e.getMessage());
}
}
Instance response
Under is a visible illustration of the merchandise retrieval course of after a profitable take away operation.
Determine 4: UI illustration of Delete Product operation
For a listing of attainable response codes when a request fails, seek advice from Failure response codes.
Deploy the server
You’ll be able to deploy your server to CodeSandbox for testing functions. You can also use some other internet hosting web site in response to your necessities.
Conclusion
By successfully incorporating the Samsung IAP Publish API, you may create your individual webview to simply handle your IAP merchandise.
References
For extra data on this subject, seek advice from the assets.
- Obtain the pattern Spring boot server code
- Obtain the pattern structured Spring boot server code
- Samsung IAP Publish documentation
Elevate your perspective with NextTech Information, the place innovation meets perception.
Uncover the newest breakthroughs, get unique updates, and join with a worldwide community of future-focused thinkers.
Unlock tomorrow’s traits right now: learn extra, subscribe to our e-newsletter, and turn into a part of the NextTech group at NextTech-news.com

