Skip to content

Purchase Analytics

The in-app purchase service reports every purchase to analytics on its own, including the ones that end without a sale: a cancel, a declined payment, a store that could not be reached. You do not need to log anything for a purchase.

Events

EventSent when
purchaseStartedPurchase() is called, before the store is asked.
purchaseSucceededThe store confirmed a purchase the game is waiting for.
purchaseFailedThe purchase answered Failed or StoreUnavailable.
purchaseCancelledThe purchase answered Cancelled.
purchaseDeferredA paid purchase arrived through PurchaseRecovered.
unvalidatedTransactionThe store confirmed a purchase, either in a purchase call or as a recovered purchase. This is the record the server validates for revenue.

A purchase that answers AnotherPurchaseInProgress sends no event, because the purchase never started.

Linking purchase events to your own events

Every event except purchaseDeferred carries the purchase’s session id and the economyChangeId you passed to Purchase(). The session id is the SessionId on the purchase result, so you can match any of your own events to the purchase events:

var economyChangeId = "shop-" + Guid.NewGuid().ToString("N");
var result = await inAppPurchases.Purchase(product, economyChangeId);
// result.SessionId and economyChangeId are on every event about this purchase.

On a recovered purchase, both ids are empty when the SDK could not identify the purchase call that started it.