Sending consumption information
An API is provided to transmit user consumption information to the app store when an app user requests a refund.
The 'Consumption Information Transmission' API uses a Server-to-Server communication method between the Hive Server and the app server. When the Hive Server sends a consumption information transmission request to the app server, the app server returns the response value to the Hive Server.
End of support scheduled
App Store Consumption Information Transmission V1 is currently unavailable for new use and is scheduled for end of service. When building new integrations or updating existing services, be sure to implement based on the V2 API.
V1 → V2 changes¶
This is a summary of the changes when integrating with the V2 API, compared to the existing Consumption Information Transmission V1.
| Category | V1 | V2 |
|---|---|---|
| Request body | gameindex, appid, user_seq | gameindex, appid, server_id, player_id(=user_seq), transaction_id |
| Consumption status | consumption_status (integer 0/3) | delivery_status (5 string enum values) |
play_time | Present (required) | Removed |
| Consumption percentage | None | consumption_percentage added (millipercent, 0-100000) |
refund_preference | Integer, required | String enum, optional |
sample_content_provided | Required | Optional |
| Response format | code/message/data | code/message/data (same structure, success response code changed from 100 to 200) |
| Firewall IP | Single commercial/Sandbox IP | 6 Hive server IPs |
Note
Currently, the transmission of consumption information is only supported by the Apple App Store.
Operation flow¶
The following summarizes the overall operation flow of the 'Consumption Information Transmission' API call and response.
- App: Prepare the server URL by configuring the API endpoint
- App: Select Enable Consumption Information Transmission in the Hive console, and register the server URL
- App client: While the app is running, agree to transmit in-app product consumption information
- App user: Request a refund in the app
- Hive server: Send a POST API request to the server URL registered by the app, and receive consumption information data as the response value from the app server
- Hive server: Transmit consumption information to the app store
Warning
If the app client does not agree to the information transmission in the consent popup, the Hive server cannot transmit the data to the app store even if it receives the data from the app server.
Some of the consumption information to be transmitted to the app store exists only on the app server. In this case, for the Hive server to transmit the consumption information to the app store, the app server must first pass the data to the Hive server.
The app server URL is the API endpoint opened by the app server for the app server to pass data to the Hive server. After configuring the API endpoint and registering it as the app server URL, the Hive server sends a POST request to this API endpoint each time a user requests a refund, and receives the necessary data from the app server. The Hive server aggregates this data and completes the transmission of consumption information to the app store on behalf of the app.
API endpoint (server URL) configuration¶
When the app server receives a request at the API endpoint registered as the server URL, it must aggregate app user-specific data (consumption_status, play_time, refund_preference, sample_content_provided) and respond with the aggregated data that can be looked up using the user information (CS_CODE) in the request parameters.
Disable firewall rules¶
Disabling the firewall inbound rules allows API communication between the app server and the Hive server. You must disable the firewall inbound rules for the IP addresses below on the app server.
| Hive Server Type | IP Address |
|---|---|
| Commercial IP | 43.201.165.236 |
| Sandbox IP | 43.155.181.83 |
After disabling the firewall rules, refer to the information below to configure the API endpoint.
API request (Hive server → app server) configuration¶
This is the POST request information sent from the Hive server to the app server.
| API Information | Description |
|---|---|
| Method | POST |
| Response Format | JSON |
| Content-type | application/json |
Request body¶
The request body information is as follows.
| Name | Type | Required (Required: M, Optional: O) | Description |
|---|---|---|---|
| gameindex | String | M | App Center Game Index |
| appid | String | M | App Center AppID |
| user_seq | String | M | In-app user CS CODE |
The following is an example of the request body.
{
"gameindex": "539",
"appid": "com.com2us.hivesdk.normal.freefull.apple.global.ios.universal",
"user_seq": "222333"
}
API response (app server → Hive server) configuration¶
This is the information returned from the app server to the Hive server.
Response body¶
This is the response value information that the app server must pass to the Hive server when the response is successful.
| Name | Type | Required (Required: M, Optional: O) | Description |
|---|---|---|---|
| code | Integer | M | Response code (100: Success) |
| message | String | M | Result message according to the response code |
| data | Object | M | Response data (Returned only if the response is successful, not returned in case of an error) |
| ┕ consumption_status | Integer | M | Consumption status of consumable items ("0" or "3" must be selected as a fixed value response) |
| ┕ play_time | Integer | M | Game play time |
| ┕ refund_preference | Integer | M | Refund preference |
| ┕ sample_content_provided | Integer | M | Sample content provided status |
The following is an example of a successful response.
// success
{
"code": 100,
"message": "OK",
"data": {
"consumption_status": 0,
"play_time": 1,
"refund_preference": 2,
"sample_content_provided": 0
}
}
The following is an example of a failed response.
// Errors due to wrong parameters
{
"code": 400,
"message": "No parameter, or invalid parameter name."
}
// Errors due to invalid user information
{
"code": 200,
"message": "No data, or invalid cs_code."
}
Response codes¶
| Code | Description |
|---|---|
| 100 | Success |
| 200 | Invalid user information (CS_CODE) |
| 400 | Request parameter error |
| 401 | Request JSON error |
| 500 | Server processing error |
| 501 | DB communication error |