- Download the
Purchases.unitypackage
in the release. - Open your Unity Project
- Select Import package -> Custom package
- Select Purchases.unitypackage and make sure all of the files are selected and press import
-
If
Package Manager Resolver
asks to solve conflicts, choose library versions and select OK -
Select Use Amazon in the Editor
If calling setup on runtime, you can select “Use Runtime Setup” and call setup this way.
var builder = PurchasesConfiguration.Builder.Init("amazon_specific_api_key")
.SetUseAmazon(true);
purchases.Setup(builder.Build());
-
Due to technical limitations, RevenueCat will only validate purchases made in production or in Live App Testing and won't validate purchases made with the Amazon App Tester. You can read more about the different testing environments in our Amazon (Beta) docs.
-
Due to technical limitations with the Amazon SDK,
SyncPurchases
doesn't work when on Amazon observer mode. In order to sync purchases with RevenueCat you have to send the current active subscriptions when Unity IAP initializes and after every successful purchase. For example:
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.SyncAmazonPurchase(
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.SyncAmazonPurchase(
e.purchasedProduct.definition.id,
e.purchasedProduct.transactionID,
userId,
e.purchasedProduct.metadata.isoCurrencyCode,
Decimal.ToDouble(e.purchasedProduct.metadata.localizedPrice)
);
return PurchaseProcessingResult.Complete;
}