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

# Transactions

> Send transaction events to OpenRevenue so revenue and conversion value can appear in analytics reports.

## Track a transaction

The browser tracker exposes `window.openrevenue.transaction()`. Pass a stable name, and optionally an amount in major units with an ISO currency code.

```ts checkout-success.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
window.openrevenue.transaction("checkout_completed", {
  amount: 49.99,
  currency: "USD",
})
```

| Name | Type | Description |
| - | - | - |
| `eventName` | string | The transaction label stored with the event. |
| `amount` | number? | Optional purchase amount in major units (e.g. 49.99). Stored as minor units server-side. |
| `currency` | string? | Optional ISO 4217 currency (e.g. USD). Required when amount is set; defaults to USD if omitted with an amount. |
| `type` | "transaction" | The tracker sends transaction events with the transaction event type automatically. |
| `path` | string | The current page path where the transaction was recorded. |
| `sessionId` | string | The browser session ID associated with the conversion. |

## When to call it

Call transactions only after the payment, upgrade, or conversion has succeeded. The safest place is usually a success page or a client-side callback after your server confirms the purchase.

> [!WARNING]
>
> Do not call transaction tracking before payment confirmation. Otherwise abandoned checkouts can look like revenue.

## Examples

```tsx success.tsx theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
useEffect(() => {
  window.openrevenue.transaction("pro_upgrade", { amount: 29, currency: "USD" })
}, [])
```

```ts checkout.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
if (checkout.status === "complete") {
  window.openrevenue.transaction("checkout_completed", {
    amount: checkout.total / 100,
    currency: checkout.currency,
  })
}
```

```ts name-only.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
// Still valid — name only, no amount
window.openrevenue.transaction("newsletter_signup")
```

## Amounts vs payment providers

Tracker transactions store the event name, optional amount/currency, and visit context. They do not replace payment-provider webhooks — connect Stripe, Polar, or another provider with [Revenue integrations](https://docs.openrevenue.com/advanced/revenue.md) for order-level attribution, refunds, and MRR-style reporting. Avoid double-counting the same sale in both places.

> [!TIP]
>
> Tracker amounts show up on the project Events page and Goals → Events tab (and [GET /events](https://docs.openrevenue.com/api/project-api/events.md)). Use Revenue integrations when you already have a payment provider for order-level attribution, refunds, and MRR-style reporting.


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