> ## Documentation Index
> Fetch the complete documentation index at: https://docs.manalens.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Purchase and refund events

> Reference for purchase and refund events: in-game purchases, verified Steam and itch.io purchases, Stripe and Paddle payments, and subscription records.

A `purchase` event records a sale, and a `refund` event records a refund. They come from four places:

| Source | `type` | `channel` | Who sends it |
| - | - | - | - |
| [In-game purchase](#in-game-purchases) | `track` | `web`, `app`, `server` | Your game, website or backend |
| [Verified Steam purchase](#store-purchases) | `track` | `server` | Manalens, from the Steam link |
| [itch.io purchase](#store-purchases) | `revenue` | `itch` | Manalens, from the itch.io sync |
| [Stripe or Paddle payment or refund](#payments-and-refunds) | `revenue` | `stripe`, `paddle` | Manalens, from the webhook and the daily sync |

Reports count one sale once: when a player has a provider payment, that player's own `purchase` and `revenue` events are left out of Overview and Attribution. See [one sale is counted once](https://docs.manalens.dev/features/revenue.md#one-sale-is-counted-once). Use `purchase` as a goal on the [Attribution](https://docs.manalens.dev/attribution/overview.md) page, or as a step of a funnel.

## In-game purchases

When a player pays real money in your game or on your website, send a `purchase` track event.

```gdscript theme={null}
Manalens.track("purchase", {"amount_cents": 499, "currency": "USD", "item": "soundtrack"})
```

| Property | Type | Description |
| - | - | - |
| `amount_cents` | Number | The amount in the minor unit of `currency` (cents for USD or EUR). If the event has no `revenue`, Manalens adds `revenue` in major units as it stores the event. For most currencies, it is `amount_cents` / 100. For currencies with no minor unit (JPY, KRW, VND and others), it is `amount_cents`. For BHD, JOD, KWD, OMR and TND, it is `amount_cents` / 1000. Without `currency`, it divides by 100. |
| `revenue` | Number | The amount in major currency units, such as `4.99`. A numeric string such as `"4.99"` is stored as a number. A `revenue` that you send wins. |
| `currency` | String | A three-letter ISO 4217 code, such as `USD`. Stored in upper case. Manalens converts the revenue to the report currency. See [currency](https://docs.manalens.dev/features/revenue.md#currency). |
| `item` | String | What the player bought |

So a purchase counts in the Overview **Revenue** metric, the [Revenue dashboard template](https://docs.manalens.dev/features/dashboards.md#revenue) and [attribution](https://docs.manalens.dev/attribution/overview.md). The ARPDAU and ARPPU cards of the Game KPIs template use Stripe, Paddle and itch.io payments instead. Do not send `store` with `steam`, `itch`, `epic` or `gog`: Manalens writes those purchases itself and refuses them from a website or a game (`SERVER_ONLY_EVENT`). An in-game `purchase` without `store` is accepted. See [revenue from custom events](https://docs.manalens.dev/features/revenue.md#revenue-from-custom-events).

## Tracking microtransactions and in-app purchases

Send one `purchase` event for each real-money sale in your game: a skin, a currency pack, a battle pass or an item bought through Steam, the App Store or Google Play. Manalens does not read these store transactions itself, so this event is how they reach your reports.

Send it once the payment is complete: for a Steam microtransaction, after your backend's `FinalizeTxn` call succeeds. Add any other properties you need. They are stored with the event: filter on them with an **Event property** filter, or read them with SQL.

```gdscript theme={null}
Manalens.track("purchase", {
    "amount_cents": 499,
    "currency": "USD",
    "item": "starter_pack",
    "transaction_id": "4823019935",
    "store_product_id": "1001",
    "price_tier": "4.99",
    "placement": "shop_daily_offer"
})
```

We recommend:

* **`amount_cents` and `currency` on every sale.** Send the price the player paid in that currency, before store fees. Manalens converts it to the reporting currency.
* **A `transaction_id` property with the store's order ID.** Manalens does not dedupe on it. It lets you find one sale with an Event property filter or in SQL. It also lets you match the sale with your store report.
* **Send each sale from one place.** A retry of the same event (the same `message_id`) counts once. Two events for one sale, for example one from the game and one from your backend, count twice.
* **If you can, send it from your backend.** A purchase that your server checked with the store is sent with the [secret key](https://docs.manalens.dev/sdks/server.md). A modified client cannot fake it. A purchase from the game build is sent with the publishable key, which anyone can read.
* **Send refunds as a `refund` event with negative `revenue`**, such as `-4.99`, and the same `transaction_id`. `amount_cents` cannot be negative. See [refunds](https://docs.manalens.dev/features/revenue.md#refunds).
* **Use `resource`, not `purchase`, for in-game currency.** A player spending gold or gems is a [`resource` event](https://docs.manalens.dev/sdks/app-events#event-conventions) with `flow: "sink"`. It adds no revenue.
* **Do not send `store`** with `steam`, `itch`, `epic` or `gog` on an in-game purchase (`SERVER_ONLY_EVENT`). Use your own property, such as `store_product_id`, for store details.

These events count in the Overview **Revenue** metric, the [Revenue dashboard template](https://docs.manalens.dev/features/dashboards.md#revenue) (revenue, ARPDAU, ARPPU and daily conversion) and [attribution](https://docs.manalens.dev/attribution/overview.md). The ARPDAU and ARPPU cards of the Game KPIs template read Stripe, Paddle and itch.io payments only. For revenue by item, group by `JSONExtractString(properties, 'item')` in the [SQL Explorer](https://docs.manalens.dev/features/explorer.md).

## Store purchases

### Steam

A player can have a [verified Steam account](https://docs.manalens.dev/integrations/steam.md). If it gets your base game or a DLC with a permanent license, Manalens writes one `purchase` event with `store: "steam"` for the player. The event is a server `track` event of the game install that linked. It has the user ID of the player (if known). Its time is the time that Steam gives for the purchase. See [Steam purchases in Attribution](https://docs.manalens.dev/integrations/steam.md#steam-purchases) for the rules for writing the event.

| Property | Description |
| - | - |
| `store` | `steam` |
| `product_id`, `product_name` | The Steam product |
| `role` | `base` or `dlc` |
| `provider` | `steam` |
| `license` | `permanent` |

The event has no amount: Steam gives no price for one player. `context.library_name` is `manalens-steam-link`.

### itch.io

The [itch.io sync](https://docs.manalens.dev/integrations/itch.md) writes one `purchase` event with `store: "itch"` for each itch.io purchase of your game, with `type` `revenue` and `channel` `itch`. It has the [payment properties](#payments-and-refunds) and also `source`, `sale_rate`, `quantity`, `purchase_type`, `game_id` and `game_ids`. An itch.io donation is a `purchase` with `donation: true`.

## Payments and refunds

A Stripe, Paddle or itch.io payment becomes a `purchase` event, and a Stripe or Paddle refund becomes a `refund` event. They have `type` `revenue` and the provider as `channel`. Clients cannot send these channels, so these are verified payments. See [Revenue](https://docs.manalens.dev/features/revenue.md#provider-payments-as-events).

| Property | Type | Description |
| - | - | - |
| `revenue` | Number | The amount in currency units. A refund is negative. |
| `currency` | String | The currency of the payment |
| `kind` | String | `invoice_paid` for a payment, `refund` for a refund |
| `provider` | String | `stripe`, `paddle` or `itch` |
| `record_id` | String | The ID of the payment record |
| `refunded_record_id` | String | Refunds only: the `record_id` of the refunded payment |
| `provider_event_id` | String | The ID of the provider's event |
| `customer_id`, `subscription_id` | String | The provider's customer and subscription IDs |
| `client_reference_id`, `checkout_session_id` | String | A Stripe Checkout payment's reference and session ID |
| `status` | String | The provider's status of the record |
| `settled_amount`, `settled_currency` | Number, String | Paddle: the payout amount in the payout currency, before fees |

The player of a payment is the `user_id` in the checkout metadata, else a Checkout Session's `client_reference_id`, else a guest checkout's anonymous ID. See [link revenue to users](https://docs.manalens.dev/features/revenue.md#link-revenue-to-users). `context.identity_mode` is `billing`.

## Subscription records

A change of a Stripe or Paddle subscription is stored with `type` `subscription`. Its event name is the subscription status from the provider, such as `active` or `canceled`. It has the payment properties above, with `mrr` (the monthly recurring revenue) and `mrr_known` (`false` for an MRR that Manalens cannot work out). It is not a `purchase` and adds no revenue.

## Sample payload

An in-game purchase from a game build:

```json theme={null}
{
  "type": "track",
  "event": "purchase",
  "message_id": "0f4b0c39-4a77-4f3c-a5e2-6f5c1f2b7d10",
  "channel": "app",
  "version": "0.1.0",
  "original_timestamp": "2026-11-09T10:05:00.000Z",
  "anonymous_id": "3f0c5c1e-8a8e-4c1b-9d7e-2b1f4e6a9c10",
  "session_id": "1762682400000",
  "user_id": "player_42",
  "context": {
    "app": { "platform": "windows", "storefront": "itch", "app_version": "1.4.0", "build": "571", "engine": "godot" },
    "locale": "en-US"
  },
  "properties": { "amount_cents": 499, "currency": "USD", "item": "soundtrack" }
}
```

Manalens stores it with `"revenue": 4.99`.

## FAQ

> [accordion] Why was my purchase refused with SERVER\_ONLY\_EVENT?
>
> The event has `store` set to `steam`, `itch`, `epic` or `gog`. Anyone can read the publishable key, so only Manalens writes store purchases. Leave out `store` for an in-game purchase, or send the event from your backend with the secret key.

> [accordion] Does a Steam refund remove the purchase?
>
> No. Attribution counts purchases, and Manalens writes no negative Steam event. The player gets the label **Refunded or revoked** instead. See [Steam integration](https://docs.manalens.dev/integrations/steam.md#steam-purchases).

> [accordion] I also send my own purchase event. Is the sale counted twice?
>
> No. When a player has a Stripe, Paddle or itch.io payment, that player's own `purchase` and `revenue` events are left out of Overview and Attribution.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.