I set the store upa few months back and it worked. But now it seems to not be working; its passing the product id but not initiaing any requests and its not returning errors either
From the code below; I get the debug log "purchasing x product id; then nothing happens. Im sure this code worked before too
async public Task<bool> PlayFabPurchaseItemByID(string itemID, PlayFabEconomyAPIAsyncResult result)
{
if (!IsInitialized) throw new Exception("IAP Service is not initialized!");
Debug.Log("Player buying product " + itemID);
if (string.IsNullOrEmpty(purchaseIdempotencyId))
{
purchaseIdempotencyId = Guid.NewGuid().ToString();
}
GetItemRequest getSpringStoreRequest = new GetItemRequest()
{
AlternateId = new CatalogAlternateId()
{
Type = "FriendlyId",
Value = "SpringStorePF"
},
};
GetItemResponse getStoreResponse = await economyAPI.getItemAsync(getSpringStoreRequest);
if (getStoreResponse == null || string.IsNullOrEmpty(getStoreResponse?.Item?.Id))
{
result.error = "Unable to contact the store. Check your internet connection and try again in a few minutes.";
return false;
}
CatalogPriceAmount price = StorefrontCatalog.FirstOrDefault(item => item.Key == itemID).Value.PriceOptions.Prices.FirstOrDefault().Amounts.FirstOrDefault();
PurchaseInventoryItemsRequest purchaseInventoryItemsRequest = new PurchaseInventoryItemsRequest()
{
Amount = 1,
Item = new InventoryItemReference()
{
Id = itemID
},
PriceAmounts = new List<PurchasePriceAmount>
{
new PurchasePriceAmount()
{
Amount = price.Amount,
ItemId = price.ItemId
}
},
IdempotencyId = purchaseIdempotencyId,
StoreId = getStoreResponse.Item.Id
};
PurchaseInventoryItemsResponse purchaseInventoryItemsResponse = await economyAPI.purchaseInventoryItemsAsync(purchaseInventoryItemsRequest);
if (purchaseInventoryItemsResponse == null || purchaseInventoryItemsResponse?.TransactionIds.Count < 1)
{
result.error = "Unable to purchase. Try again in a few minutes.";
return false;
}
purchaseIdempotencyId = "";
result.message = "Purchasing!";
return true;
}