Amazon Platform Resources
RevenueCat provides SDK's and integrations for Amazon to make in-app purchase and subscription development simple. Use these resources to take full advantage of all RevenueCat has to offer for the Amazon Appstore.
If you're looking for sample apps, head over to our Sample Apps doc.
Configuration
Syncing Purchases When Your App Is Completing Transactions
When the SDK is configured to not complete purchases on the Amazon Appstore, syncAmazonPurchase
will need to be called to ensure purchases are recorded. Failure to do so will result in no purchases being recorded.
- Unity
- Kotlin
public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
{
m_StoreController = controller;
storeExtensionProvider = extensions;
var purchases = GetComponent<Purchases>();
purchases.SetDebugLogsEnabled(true);
foreach (Product product in controller.products.all)
{
if (product.hasReceipt) {
var amazonExtensions = storeExtensionProvider.GetExtension<IAmazonExtensions>();
var userId = amazonExtensions.amazonUserId;
purchases.SyncObserverModeAmazonPurchase(
product.definition.id,
product.transactionID,
userId,
product.metadata.isoCurrencyCode,
Decimal.ToDouble(product.metadata.localizedPrice)
);
}
}
}
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
{
var purchases = GetComponent<Purchases>();
var amazonExtensions = storeExtensionProvider.GetExtension<IAmazonExtensions>();
var userId = amazonExtensions.amazonUserId;
purchases.SyncObserverModeAmazonPurchase(
e.purchasedProduct.definition.id,
e.purchasedProduct.transactionID,
userId,
e.purchasedProduct.metadata.isoCurrencyCode,
Decimal.ToDouble(e.purchasedProduct.metadata.localizedPrice)
);
return PurchaseProcessingResult.Complete;
}
Purchases.sharedInstance.syncAmazonPurchase(
receipt.termSku,
receipt.receiptId,
userData.userId,
isoCurrencyCode,
storeProduct.price
)