> Site index: https://usehardal.com/llms.txt
> Every content route also serves markdown at <url>.md

# What Is Receipt Validation?

Receipt validation checks an App Store or Google Play purchase on a server before counting revenue. Apple signs a JWS. Google checks a purchase token.

Source: https://usehardal.com/glossary/receipt-validation

---

Receipt validation checks a mobile store purchase on a server before you count it as revenue. The App Store and Google Play are the source of truth for whether a charge happened. The device tells you a purchase occurred. Your server asks the store to confirm the signed transaction or the purchase token, and only then records an event such as `purchase`.

Skipping that step means a tampered client can send a product ID you never sold.

## How does it work on each store?

**Apple, StoreKit 2.** A successful purchase yields a `Transaction`. `Transaction.jwsRepresentation` is a JSON Web Signature (JWS) signed by Apple. `VerificationResult` tells the app whether StoreKit already verified that signature on device. For revenue, the server verifies again. The App Store Server API method Get Transaction Info (`GET /inApps/v1/transactions/{transactionId}`) returns `signedTransactionInfo`, another Apple-signed JWS. Decoded claims include `transactionId`, `productId`, `price`, `currency`, and `purchaseDate`. Subscription flows also use `signedRenewalInfo`.

**Google Play.** The Play Billing Library purchase includes `Purchase.getPurchaseToken()`. The server calls the Google Play Developer API. `purchases.products.get` reads a one-time product by package name, product ID, and token. `purchases.subscriptionsv2.get` reads a subscription. The response includes the purchase state. A pending or canceled purchase is not the same event as a charged one. Consume or acknowledge the purchase the way the product type requires, or the store can refund it automatically.

Store the store's transaction ID as your order ID. Retries of the same notification must not create a second purchase. See [event deduplication](https://usehardal.com/glossary/event-deduplication).

## A concrete example

A player buys a coin pack.

On iOS the server receives `signedTransactionInfo`. After signature checks, the payload contains `productId` `coins_small`, `transactionId` `1000000123456789`, `currency` `USD`, and a `price` in milliunits as Apple defines that field. The server writes one `purchase` event with `transaction_id` set to that `transactionId`, `product_id` `coins_small`, `currency` `USD`, and `store` `app_store`. It does not write a second event when the same notification is delivered again.

On Android the client sends the purchase token to your server, not to the ad network. The server calls `purchases.products.get`. When the purchase state is purchased, it writes `purchase` with `transaction_id` set to the order ID from the Play response, `product_id` `coins_small`, and `store` `play`. A refund later is a `refund` event with the same `transaction_id`, not a deleted row and not a negative purchase that still counts as a new customer.

The milliunit price and the purchase token are fields to verify. They are not a recommended price.

## What are the limits?

Device receipts and tokens can be replayed. Verification has to be idempotent on `transactionId` or the Play order ID.

Apple's price claim and Google's price are what the store charged in that currency. They are not net proceeds after tax and store commission unless you apply that adjustment yourself and label it.

Subscription renewals are new transactions with their own IDs. A validation pipeline that only accepts the original purchase will miss renewal revenue. A pipeline that treats every renewal notification as a new user will inflate customer counts.

Pending purchases, family sharing, and promotional grants can look like a charge. Read the store's status fields before you send the event to an ad platform as value.

Server-side validation does not bypass [App Tracking Transparency](https://usehardal.com/glossary/app-tracking-transparency). Confirming a purchase with Apple or Google is a transaction with the store. It does not authorize tracking the buyer across other companies' apps.

## How Hardal handles it

Hardal does not replace the App Store Server API or the Play Developer API. Your server validates the JWS or the purchase token, then sends Hardal the confirmed `purchase` (and later `refund`) with `transaction_id`, `value`, `currency`, and `product_id`. Hardal can route that event to the destinations you allow and keep it beside ad revenue events. See [impression-level ad revenue](https://usehardal.com/glossary/ad-revenue-ilrd).

Send refunds. A purchase value that never reverses will train bidding on revenue you gave back. The [mobile game revenue signals](https://usehardal.com/blog/mobile-game-mmp-revenue-signals) note covers why store revenue has to reach the networks you optimize for, and [Hardal for Gaming](https://usehardal.com/solutions/gaming) is the product context.

**Related terms:** [Events](https://usehardal.com/glossary/events), [Event deduplication](https://usehardal.com/glossary/event-deduplication), [Impression-level ad revenue](https://usehardal.com/glossary/ad-revenue-ilrd)
