Get Started with the Samsung IAP APIs
The Samsung In-App Purchase (IAP) APIs provide the following functionality:
- Orders - View payments and refunds for a specific date
- Publish - View, register, modify, and remove IAP items
- Subscription - Cancel, refund, revoke or check the status of IAP subscription items
To start using the IAP APIs, you must meet certain requirements and use the required authorization header parameters described below.
Requirements
In order to use the IAP APIs, the following is required:
-
The IAP APIs are part of the Galaxy Store Developer API. You must meet all of the requirements of the Galaxy Store Developer API including, but not limited to, creating the access token, including the access token in the authorization header of every IAP API call, and having commercial seller status to manage in-app purchase items.
-
The IAP APIs must be connected with the content in the In App Purchase tab area of Seller Portal. To create this connection, you must either initially distribute your content using the Content Publish API or the content must be in the
For Sale
state in Seller Portal. If this connection does not exist, matching product information cannot be retrieved. -
You must integrate the IAP SDK into your app. All binaries registered in your content must support IAP.
If these requirements are not met, error code 106 is returned.
Authorization header parameters
Every request must include authorization header parameters which specify the content type, your access token, and service account ID. See Create an Access Token for more information about how to create an access token and service account ID.
Attribute | Description |
---|---|
Authorization | Required .Use Bearer <your-access-token> where <your-access-token> is the access token you requested from the Galaxy Store authentication server
|
service-account-id | Required. The service account ID used to create the JWT associated with the access token (can be found in the Assistance > API Service area of Seller Portal) |
content-type | Required. Must be application/json
|
The following example shows the header used with the IAP APIs:
curl -X <IAP_PUBLISH-or-IAP_ORDER-or-IAP_SUBSCRIPTION_API_REQUEST> \
-H "content-type: application/json" \
-H "Authorization: Bearer <your-access-token>" \
-H "service-account-id: <your-service-account-id>"
URL path parameters
The URL path for every IAP Publish and Subscription API request must contain the package name (for the IAP Orders API, the package name may be required in the body parameter). For the IAP Subscription API, the in-app item purchase transaction identifier is also required.
Attribute | Description |
---|---|
packageName | Required for IAP Order and Subscription APIs. The app's package name |
purchaseId | Required for IAP Subscription API. Unique identifier of the in-app item purchase transaction |
The following example shows the URL path for creating an item using the IAP Publish API:
https://devapi.samsungapps.com/iap/v6/applications/<packageName>/items
The following example shows the URL path for canceling, refunding, or revoking a subscription using the IAP Subscription API:
https://devapi.samsungapps.com/iap/seller/v6/applications/<packageName>/items/purchases/subscriptions/<purchaseId>