# fluent-cart/1.6.4/app/Events/Order/OrderPaid.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 82 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Events/Order/OrderPaid.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/app/Events/Order/OrderPaid.php
- Modified: 2026-06-11T12:21:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/app/Events/Order/OrderPaid.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Events\Order;

use FluentCart\App\Events\EventDispatcher;
use FluentCart\App\Listeners;
use FluentCart\App\Models\Customer;
use FluentCart\App\Models\Order;
use FluentCart\App\Models\OrderTransaction;

class OrderPaid extends EventDispatcher
{

    public string $hook = 'fluent_cart/order_paid';
    protected array $listeners = [
        Listeners\Order\OrderPaid::class,
    ];

    /**
     * @var Order $order
     */
    public Order $order;

    /**
     * @var Customer|null $customer
     */
    public ?Customer $customer;

    /**
     * @var OrderTransaction|null $transaction
     */
    public ?OrderTransaction $transaction;

    public function __construct(Order $order, $customer = null, $transaction = null)
    {
        $this->order = $order;
        $this->order->load('customer', 'order_items', 'shipping_address', 'billing_address');
        $this->customer = $customer;
        $this->transaction = $transaction;
    }

    public function toArray(): array
    {
        return [
            'order'       => $this->order,
            'customer'    => $this->customer ?? null,
            'transaction' => $this->transaction ?? null
        ];
    }

    public function getActivityEventModel()
    {
        return $this->order;
    }

    public function beforeDispatch()
    {
        if (!$this->order->receipt_number) {
            $this->order = $this->order->generateReceiptNumber();
        }
    }

    public function afterDispatch()
    {
        /**
         * 3rd party devs: Please do not use this hook to add any action that
         * use: fluent_cart/order_paid_done
         */
        $id = as_enqueue_async_action('fluent_cart/order_paid_async_private_handle', [
            [
                'order_id' => $this->order->id
            ]
        ], 'fluent-cart');

        if ($id) {
            $this->order->updateMeta('action_scheduler_id', $id);
        }

    }

}

```
