@amazon-devices/keplerscript-appstore-iap-lib
In-App Purchasing (IAP) API provides methods for interacting with the Amazon Appstore purchasing framework.
To implement IAP, you must do the following:
Get Started
Setup
-
Add the following library dependency to the
dependencies
section of your package.json file."@amazon-devices/keplerscript-appstore-iap-lib": "~2.12.10", "@amazon-devices/package-manager-lib": "~1.0.0"
-
In your manifest.toml, add the following privileges required to access Ad ID Retriever.
[wants] [[wants.service]] id = "com.amazon.iap.core.service" [[wants.module]] id = "/com.amazon.iap.core@IIAPCoreUI" [needs] [[needs.module]] id = "/com.amazon.kepler.appstore.iap.purchase.core@IAppstoreIAPPurchaseCoreService"
Usage
Purchasing Service
Represents the primary methods for interacting with the Amazon Appstore purchasing framework.
All methods return a response using a Promise
.
public purchase(purchaseRequestParams: IAPTypes.PurchaseParams): Promise<PurchaseResponse>;
For additional information, see PurchasingService.
IAP API usage examples
The following examples show how to use the IAP methods:
const triggerPurchase = (sku?: string): void => {
Logger.debug(`Item ${sku} clicked`);
PurchasingService.purchase({ sku: sku })
.then((res) => {
// Handle purchase response.
})
.then((user) => {
// perform operation for user if required.
})
.catch((err) => {
// Handle exceptions if any
});
return;
}
The following shows the usage of the getProductData
method.
useEffect(() => { // Validate product SKUs before rendering product screen
// ...
// Calling getProductData when the component is rendered.
PurchasingService.getProductData({ skus: Constants.SKUS })
.then((res) => {
const [productData, unavailableSkus] = handleProductDataResponse(res);
})
.catch((err) => {
Logger.error(`Exception while calling getProductData ${err}`);
});
}, []);
Releated topics
Enumerations
- FulfillmentResult
LwaConsentStatus- ModifySubscriptionResponseCode
- NotifyFulfillmentResponseCode
- ProductDataResponseCode
- ProductType
- ProrationMode
- PurchaseResponseCode
- PurchaseUpdatesResponseCode
- UserDataResponseCode
- UserProfileAccessConsentStatus
- UserProfileAccessResponseCode
Classes
Interfaces
- CoinsReward
- ModifySubscriptionRequest
- ModifySubscriptionResponse
- NotifyFulfillmentRequest
- NotifyFulfillmentResponse
- Price
- Product
- ProductDataRequest
- ProductDataResponse
- Promotion
- PromotionPlan
- PurchaseRequest
- PurchaseResponse
- PurchaseUpdatesRequest
- PurchaseUpdatesResponse
- Receipt
- RequestId
- UserData
- UserDataRequest
- UserDataResponse
- UserProfileAccessResponse
Functions
Last updated: Sep 30, 2025