In-App Purchase Reference
Server Response Code
Table 1 enumerates the response codes passed to the application from the ONE store service(OSS).
The application that implements the AIDL and the SDK must process all response codes.all the delivered intent through Activity.startAct
Table 1. Summary of Server Response Codes for IAP API Calls
Response Code | Value | Description | How to handle |
---|---|---|---|
RESULT_OK | 0 | Success |
|
RESULT_USER_CANCELED | 1 | The payment has been cancelled. | This happens when a user explicitly cancels his/her payment. |
RESULT_SERVICE_UNAVAILABLE | 2 | The purchase has failed (an error occurred in the terminal or server network). | This is a temporary network error. Developers send an appropriate alert message and lead users to try again later. |
RESULT_BILLING_UNAVAILABLE | 3 | The purchase has failed (an error occurred in the purchase process). | This error occurs when processing a logic related to ONE store's purchase. If this problem happens, contact the person in charge in ONE store together with the log information and purchase information. |
RESULT_ITEM_UNAVAILABLE | 4 | The purchase has failed (the product is not on sale or not available for purchase). | The product is not on sale on the Developer Center or not available for purchase. It is required to check if the product registered on the Developer Center is valid. |
RESULT_DEVELOPER_ERROR | 5 | The purchase has failed (the purchase request is not valid). | This error occurs when calling abnormal parameters to send requests, including the purchase request. This error is required to be addressed in the development stage and must not actually happen in the published app. If this problem occurs, verify the developer's app code. |
RESULT_ERROR | 6 | The purchase has failed (a undefined other error occurred). | This error occurs when processing a logic related to ONE store's purchase. If this problem happens, contact the person in charge in ONE store together with the log information and purchase information. |
RESULT_ITEM_ALREADY_OWNED | 7 | The purchase has failed (you already have the item). | The managed product cannot be repurchased before being consumed. It is normal for this error message to appear because non-consumable type products cannot be repurchased. If this error message pops up for consumable items, it is required to verify the consumption logic after the purchase. |
RESULT_ITEM_NOT_OWNED | 8 | The purchase has failed (you do not have the item, and cannot consume it). | This error occurs when a consumption request is made for the managed product that was already consumed or was not purchased. It is required to proceed with the consumption of the product for consumable items which have not been consumed. |
RESULT_FAIL | 9 | The purchase has failed. Please try to pay again after checking your payment availability and payment methods. | This error occurs when processing a logic related to ONE store's purchase. If this problem happens, contact the person in charge in ONE store together with the log information and purchase information. |
RESULT_NEED_LOGIN | 10 | The purchase has failed (the ONE store login is required for the purchase). | This occurs when ONE store's account is not registered. Developers proceed with the ONE store login by calling the getLoginIntent of the AIDL and the launchLoginFlowAsync method of the SDK. If the ONE store login is not provided by the developers, the developers send an appropriate alert message and lead users to execute the ONE store app. |
RESULT_NEED_UPDATE | 11 | The purchase has failed (the update of the OSS app is required). | In this situation, it is required to install or update the OSS app. Developers proceed with the installation or update of the OSS app by calling the launchUpdateOrInstallFlow method of the SDK. If the installation/update of ONE store is not explicitly provided by the developers, the developers send an appropriate alert message and lead users to execute the ONE store app. |
RESULT_SECURITY_ERROR | 12 | The purchase has failed (the payment is requested in an abnormal app). | This occurs when the package name information included in the call specifications differs from the app which is actually called. In addition, this error also happens when the signing value of the developer's app is different from the signing value of the app registered on the Developer Center. The developer is required to correctly put the package name of the app registered on the Developer Center when calling the AIDL. The developer is also required to call the signed app if the test is not the Sandbox Test of the Developer Center. |
isBillingSupported() - Check Support
This method proceeds with checking whether support is provided for the purchase before ONE store's in-app is used.
The application can check the status by calling this method before using the ONE store in-app.
Table 2. Response Data for isBillingSupported Request
Type | Description |
---|---|
Integer | If success, the value is 0. If failed, the value is error. Please refer to Table 1 |
getProductDetails() - Check In-App Product Information
This method returns in-app product details that match the In-App ID.
Details of the String ArrayList which is mapped to the passed productDetailList key are summarized in Table 4.
Table 3. Response Data for getProductDetails Request
Key | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
productDetailList | String ArrayList | This is in-app product details which are returned when in-app product information is checked and it consists of the string list in JSON format. Please refer to Table 4. |
|
Table 4. Description of JSON Field for productDetailList of Response Data for getProductDetails Request
Field | Type | Description |
---|---|---|
productId | String | This is In-App ID. |
type | String | This is the definition value of the in-app product's product group and it uses the values of "inapp" and "auto".
|
price | String | This is in-app product price |
priceCurrencyCode | String | This is currency code for price. the Korean Won (KRW) is supported in the ONE store payment. |
title | String | This is in-app product title |
getPurchaseIntent() - Request Purchase
This is a response method for the 'request purchase' and returns the purchaseIntent for proceeding with the purchase as a response value.
If the application calls Activity.startActivityForResult() by using the purchaseIntent, the payment flow will be performed.
When the payment is completed, the end response to the 'request purchase' will be received in the intent.
Data returned to the response intent is summarized in Table 6.
Table 5. Response Data for getPurchaseIntent Request
Key | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
purchaseIntent | Intent | This is intent data to perform the payment flow. Call the delivered intent through Activity.startActivityForResult()on the application screen. |
Table 6 provides the description of the intent field delivered through onActivityResult() when the purchase is completed in the application.
Table 6. Intent Field Passed to onActivityResult() When Purchase Is Completed
Field | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
purchaseData | String (JSON) | This is purchase details. As for string data in JSON format, please refer to Table 7. |
| ||
purchaseSignature | String | This is string that includes the signature of purchase details signed with the developer's private key. To check whether the purchase status information value is not falsified, it is required to check with this value in the application. |
Table 7 provides the description of the purchaseData JSON field which is the purchase information field within the intent field passed when the purchase is completed.
Table 7. purchaseData Field in Intent Field Passed to onActivityResult() When Purchase Is Completed
Key | Type | Description |
---|---|---|
orderId | String | This is payment ID which is a unique identifier for payment transactions. |
packageName | String | This is the package of the application from which the purchase is initiated. |
productId | String | This is product identifier (ID) of in-app products. It should be designated in the in-app product list on the ONE store Developer Center. |
purchaseTime | long | This is the time when the purchase of the in-app product is made after January 1, 1970 (unit: ms). |
purchaseId | String | This is purchase ID which uniquely identifies a user's purchase for the items in question. The purchaseId value in the SandBox environment has the "SANDBOX" prefix.
|
developerPayload | String | Additional information on orders is designated and used by developers. This value can be designated when getPurchaseIntent is requested, and the same value will be included in the purchase details when the purchase is completed. |
getPurchaseIntentExtraParam() - Request Purchase
This is a method for the 'request purchase' and can deliver in addition the contents defined in Table 8 when the purchase is requested.
The gameUserId and promotionApplicable which are additional parameters are used to limit the participation in promotions.
As the response value of this method, the purchaseIntent for performing the purchase is returned.
Table 8. Extra Bundle data
Bundle Key | Type | Description |
---|---|---|
gameUserId | String | This delivers the unique identifier number of a user who is using the application. This is used as a key value to determine if it is available to participate in and to use promotions. |
promotionApplicable | boolean | This delivers if it is available to participate in the promotion.
|
The gameUserId, protectionApplicable parameters are optional and must be used only in advance for the promotion with ONE store department manager. In general, the value should not be sent. In addition, the gameUserId should be sent to a hashed unique value so that there is no privacy information protection issue when sending values in advance.
If the application calls Activity.startActivityForResult() by using the purchaseIntent, the payment flow is performed.
When the payment is completed, the end response to the 'request purchase' will be received in the intent.
Data returned to the response intent is summarized in Table 10.
Table 9. Response Data for getPurchaseIntentExtraParam Request
Key | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
purchaseIntent | Intent | This is intent data to perform the payment flow. Call the delivered intent through Activity.startActivityForResult() on the application screen. |
Table 10 provides the description of the intent field delivered through onActivityResult() when the purchase is completed in the application.
Table 10. Intent Field Passed to onActivityResult() When Purchase Is Completed
Field | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
purchaseData | String (JSON) | This is intent data to perform the payment flow. Call the delivered intent through Activity.startActivityForResult() on the application screen. |
| ||
purchaseSignature | String | This is intent data to perform the payment flow. Call the delivered intent through Activity.startActivityForResult() on the application screen |
Table 11 provides the description of the purchaseData JSON field which is the purchase information field within the intent field passed when the purchase is completed.
Table 11. purchaseData Field in Intent Field Passed to onActivityResult() When Purchase Is Completed
Key | Type | Description |
---|---|---|
orderId | String | This is payment ID which is a unique identifier for payment transactions. |
packageName | String | This is the package of the application from which the purchase is initiated. |
productId | String | This is product identifier (ID) of in-app products. This should be designated in the in-app product list on the ONE store Developer Center. |
purchaseTime | long | This is the time when the purchase of the in-app product is made after January 1, 1970 (unit: ms). |
purchaseId | String | This is the purchase ID which uniquely identifies a user's purchase for the items in question. The purchaseId value in the SandBox environment has the "SANDBOX" prefix.
|
developerPayload | String | Additional information on orders is designated and used by developers. This value can be designated when getPurchaseIntent is requested, and the same value will be included in the purchase details when the purchase is completed. |
getLoginIntent() - Request Login
This is a method to request the ONE store login in the application when the user has no ONE store account or receives an error code that requires the ONE store login. This method returns the loginIntent for performing a login as the response value.
If the application calls Activity.startActivityForResult() by using the loginIntent, the login flow will be performed. When the login is completed, the end response to the 'request login' will be received. Data returned after calling Activity.startActivityForResult() is summarized in Table 13.
Table 12. Response Data for getLoginIntent Request
Key | Type | Description |
---|---|---|
responseCode | int | success, the value is 0. If failed, the value is error. Please refer to Table 1. |
purchaseIntent | Intent | This is intent data to perform the login flow. Call the delivered intent through Activity.startActivityForResult() on the application screen. |
Table 13 provides the description of the response value delivered through onActivityResult() when the login is completed in the application.
Table 13. Response Value Passed to onActivityResult() When Login Is Completed
Key | Type | Description |
---|---|---|
responseCode | int | 성공했을 경우 0을, 실패했을 경우 에러코드를 전달합니다(에러코드는 <표 1> 참고). 성공할 경우 다른 API를 계속 이용할 수 있습니다. 실패는 고객이 로그인 화면을 취소하였거나(ex. Back key), 원스토어의 정상 회원이 아닌 경우 입니다. 실패한 경우 고객에게 원스토어를 구동하여 회원 상태를 확인하거나, 원스토어 고객센터로 연락하여 문제를 해결하도록 해야 합니다. |
getPurchases() - Check Purchase History
This method returns the list of the in-app products that are not consumed after the user purchased the consumable items. When the value of the consumable items which are not consumed is returned, developers are required to consume such consumable items by using the consumePurchase() API. When it comes to the purchased subscription item, the purchase information of the subscription item will be returned while the automatic payment is being made or if the subscription item is reserved to be cancelled .
Table 14. Response Data for getPurchases Request
Key | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
productIdList | ArrayList<String> | This is the productId string list of the purchases which are made in the application. |
| ||
purchaseDetailList | ArrayList<String> | This is the details of the purchases which are made in the application. It is the string list in JSON format and please refer to Table 11 for more details. |
| ||
purchaseSignatureList | ArrayList<String> | This is the string list which includes the signature of the purchases which are made in the application. |
| ||
continuationKey | String | When a user has many purchase history for the application in question, the user returns this response value to the ONE store server. If there is the continuationKey in the response, it is required to separately call the getPurchases and pass the continuationKey which is received as the response. |
Table 15 is the description of JSON field for the purchaseDetailList during the response to the getPurchase request.
Table 15. Description of JSON Field for productDetailList of Response Data for getPurchase Request
Key | Type | Description |
---|---|---|
orderId | String | This is payment ID which is a unique identifier for payment transactions. |
packageName | String | This is the package of the application from which the purchase is initiated. |
productId | String | This is product identifier (ID) of in-app product. This should be designated in the in-app product list on the ONE store Developer Center. |
purchaseTime | long | This is the time when the purchase of the in-app product is made after January 1, 1970 (unit: ms). |
purchaseState | int | This is the 'purchased' state.
|
recurringState | int | This is the automatic payment state of the subscription.
|
purchaseId | String | This is the purchase ID which uniquely identifies a user's purchase for the items in question. The purchaseId value in the SandBox environment has the "SANDBOX" prefix.
|
developerPayload | String | Additional information on orders is designated and used by developers. This value can be designated when getPurchaseIntent is requested, and the same value will be included in the purchase details when the purchase is completed. |
consumePurchase() - Request Consumption of In-App Product
This method is used for requesting the consumption of the in-app product for the purchased consumable product by using the getPurchaseIntent method.
When the in-app product is consumed, use the purchaseId included in the purchase information, and if successful, return this purchaseId value to the response data.
Table 16 is the response data value for the consumePurchase request.
Table 16. Response Data for consumePurchase Request
Key | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
purchaseId | String | This is purchase ID which uniquely identifies a user's purchase for the items in question. |
manageRecurringProduct() - Request Change to Subscription Status
For the subscription which is purchased using the getPurchaseIntent method, this method is used to request to reserve the cancellation of the subscription and to reverse the reservation of the product cancellation.
When there is a request
Table 17 is the response data value for the manageRecurringProduct request.
Table 17. Response Data for manageRecurringProduct Request
Key | Type | Description |
---|---|---|
responseCode | int | If success, the value is 0. If failed, the value is error. Please refer to Table 1. |
purchaseId | String | This is purchase ID which uniquely identifies a user's purchase for the items in question. |
Last updated