Guide · Revenue

In-app purchase receipt validation, for games

If your revenue chart counts what the client says it bought, it counts sandbox purchases, refunds and fraud too. Here is how to validate App Store and Google Play purchases server-side.

Why validate

The client only knows what the store told it at purchase time. It cannot tell a test purchase from a real one reliably, it never hears about refunds, and a modified client can report anything. Validating with the store, from a server, is the only way to count real revenue once.

The flow

  1. The store completes the purchase on the device.
  2. The game sends the store's proof (a signed transaction or a purchase token) to your backend, untouched.
  3. The backend verifies it with Apple or Google and records the result once per transaction id.
  4. Store notifications (refunds, renewals) update that record later.

App Store (StoreKit 2)

StoreKit 2 gives each transaction as a JWS: a payload signed by Apple. Verify the signature chain against Apple's root certificate, check the bundle id and environment, and use the transaction id as your dedup key. Subscribe to App Store Server Notifications v2 for refunds and renewals.

csharp
// Unity IAP: forward the receipt as-is after the store confirms
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e) {
    UC.Purchase(e.purchasedProduct);   // sends store, sku, price, currency, receipt
    return PurchaseProcessingResult.Complete;
}

Google Play

Google gives a purchase token. Your backend calls the Play Developer API (purchases.products.get or purchases.subscriptionsv2.get) with a service account to confirm the purchase state, then acknowledges it. Real-time Developer Notifications deliver refunds and subscription changes.

dart
// Flutter in_app_purchase
if (p.status == PurchaseStatus.purchased) {
  Uncorrelate.purchase(
    sku: p.productID,
    price: product.rawPrice,
    currency: product.currencyCode,
    receipt: p.verificationData.serverVerificationData, // token on Android
    store: Platform.isIOS ? UCStore.appStore : UCStore.googlePlay,
  );
}

Refunds and sandbox

Record refunds as negative revenue on the day they happen, not by deleting the original purchase, so past reports stay reproducible. Keep sandbox purchases, but exclude them from revenue by default: they are useful for QA and misleading in a KPI.

Uncorrelate does all of this for you: the SDK forwards the store's proof, the server validates it with Apple and Google, listens for refunds, and only validated purchases count in revenue charts.

Your first chart is five minutes away.

Create a studio, add your app, ask a question. Free up to 10M events a month, no card, no sales call.