> For the complete documentation index, see [llms.txt](https://ctracker-docs.keywordrush.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ctracker-docs.keywordrush.com/for-developers/cashback-events.md).

# Cashback events

Cashback Tracker is a plugin for tracking and statistics. If you want to extend its functionality, you can use the following hooks.

{% hint style="warning" %}
You need PHP and WordPress coding skills to use this section.
{% endhint %}

### Order hooks

Cashback Tracker provides three events for custom functions:

|                        |                                            |
| ---------------------- | ------------------------------------------ |
| cbtrkr\_order\_create  | A new order was added with Pending status. |
| cbtrkr\_order\_approve | An order received Approved status.         |
| cbtrkr\_order\_decline | An order received Declined status.         |

Example of a hook:

```php
add_action('cbtrkr_order_create', 'myOrderCreate');

function myOrderCreate($order)
{
    //print_r($order);
}
```

\
The variable contains an array with the following data:

```php
array
(
    'id' => '177'
    'user_id' => '1'
    'order_id' => '1556116749647'
    'module_id' => 'Demo'
    'create_date' => '2019-04-24 14:39:09'
    'order_status' => '0'
    'completion_date' => null
    'advertiser_id' => '123'
    'advertiser_domain' => 'example.com'
    'currency_code' => 'USD'
    'sale_amount' => '590.00'
    'commission_amount' => '29.50'
    'subid' => 'cbtrkr-1'
    'click_date' => '2019-04-04 04:59:14'
    'action_date' => '2019-04-20 07:55:01'
    'user_referer' => ''
    'api_response' => ''
    'merchant_order_id' => '1556116749647'
)
```

Example of code to calculate cashback and currency:

```php
list($amount, $currency) = \CashbackTracker\application\components\Commission::calculateCashback($order);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ctracker-docs.keywordrush.com/for-developers/cashback-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
