---
title: "Revenue — Plausible for Laravel | Roundly"
description: "Attach exact revenue to events as a money-for-laravel Money — decimal strings, no floats, invalid currencies refused up front."
url: https://roundly-consulting.com/open-source/docs/plausible-for-laravel/revenue
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Plausible for Laravel](https://roundly-consulting.com/open-source/docs/plausible-for-laravel.md)

# Revenue

Revenue is a money-for-laravel Money wrapped in the Revenue DTO, so the amount is exact at any size and never passes through a float:

```php
use RoundlyConsulting\Money\Money;
use RoundlyConsulting\Plausible\DataTransferObjects\Revenue;

Revenue::of('49', 'eur');                       // {"currency":"EUR","amount":"49.00"}
Revenue::of('1500', 'JPY');                     // {"currency":"JPY","amount":"1500"}
Revenue::make(Money::ofMinor(1299, 'USD'));     // {"currency":"USD","amount":"12.99"}
Revenue::make($order->total);                   // any Money you already hold

Revenue::of('92233720368547758.08', 'USD');     // beyond int64 — sent exactly
```

## On an event

```php
use RoundlyConsulting\Plausible\DataTransferObjects\Revenue;
use RoundlyConsulting\Plausible\Facades\Plausible;
use RoundlyConsulting\Plausible\Requests\Events\CaptureEventRequest;

// With the event() shortcut
Plausible::events()->fromRequest(request())->event(
    'purchase',
    url: 'https://my-site.com/checkout',
    revenue: Revenue::make($order->total),
);

// Or on an explicit request, queued
Plausible::events()
    ->fromRequest(request())
    ->captureQueued(CaptureEventRequest::make(
        site: 'my-site.com',
        url: 'https://my-site.com/checkout',
        name: 'purchase',
        revenue: Revenue::of('49.00', 'EUR'),   // or Revenue::make($order->total)
        props: ['plan' => 'pro'],
    ));
```

## Rules

- of() takes major units as a decimal string or an int — there is no float overload.
- make() takes any Money you already hold, such as an order total.
- The payload amount is the currency’s decimal string (toDecimal()); Plausible accepts it as a string.
- Revenue never rounds for you — round with money first when a value has more decimals than its currency.

## Validation

Plausible silently drops revenue it can’t understand, so anything invalid is refused up front with RoundlyConsulting\\Plausible\\Exceptions\\InvalidRevenue (a PlausibleException), with the money exception chained as getPrevious():

- an unknown or malformed currency code (EURO);
- a custom, non-ISO 4217 currency such as loyalty points — Plausible converts ISO currencies only and would silently drop the revenue;
- more decimals than the currency allows (12.999 USD);
- a malformed amount (1,50 or 1e3).

```php
use RoundlyConsulting\Plausible\Exceptions\InvalidRevenue;

try {
    Revenue::of('12.999', 'USD');   // more decimals than USD allows
} catch (InvalidRevenue $e) {
    $e->getMessage();               // "Invalid revenue amount [12.999]: …"
    $e->getPrevious();              // the underlying money-for-laravel exception
}

Revenue::of('49', 'EURO');          // InvalidRevenue — not a 3-letter ISO 4217 code
Revenue::of('1,50', 'EUR');         // InvalidRevenue — malformed amount
Revenue::of('1e3', 'EUR');          // InvalidRevenue — malformed amount
```

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/plausible-for-laravel.md)
