Transactions

Returns the amount of transactions registered on the website, along with a percentage value and an indicator if it's a positive or negative change (compared to the previous interval).

Method: GET

URL: https://api.retargeting.app/v1/partners-api/transactions

Function parameters

Field Type Required Description
rest_key number or text True The REST API Key of the client.
date_from number Optional (Required only if date_to parameter is given) Unix Timestamp (Example: 1732209406). If not provided, default fallback is 30 days in the past from now.
date_to number Optional Unix Timestamp (Example: 1734801406). If not provided, default fallback is the current time.

The interval between date_from and date_to parameters (if provided) must not exceed 30 days.

Your account status must be in one of the states: PAID, PAYMENT ERROR or ACCOUNT SUSPENDED.

If your account is Inactive or Closed the API call will not work.

The API call will respond with JSON format.

Example

    <?php

    require_once "vendor/autoload.php";

    $apiURL = "https://api.retargeting.app/v1/partners-api/transactions";
    $apiKey = "REST_KEY";

    $client = new GuzzleHttp\Client();

    $registerData = [
        "rest_key" => $apiKey,
    ];

    $request = $client->request("GET", $apiURL, ["query" => $registerData]);
                    

If the API call succeeds, then the response will be as seen below:

{
    status: "success",
    data: {
        value: 38,
        percentage: "75.50"
        increase: true
    }
}
                    

If the API call fails, then the responses will be similar to the ones below:

When the rest_key parameter is invalid:

{
    status: "error",
    message: "Incorrect rest key!"
}
                    

When the account is not active:

{
    status: "error",
    message: "Your account is not active!"
}
                    

When the interval between date_from and date_to parameters is greater than 30 days:

{
    status: "error",
    message: "Interval is greater than 30 days"
}
                    

When date_from parameter is not provided together with date_to parameter:

{
    status: "fail",
    data: {
        validator: {
            date_from: [
                "The date from field is required when date to is present."
            ]
        }
    }
}
                    

When something went wrong:

{
    status: "error",
    message: "Something went wrong"
}