Payment Statement

You can access the payment statement of the amounts transferred or to be transferred to the merchant account within the transmitted date range.

It is divided into two categories as Merchant Payment Statement and Marketplace Payment Statement.

Merchant Payment Statement

1- Send the date range you want to see the payment details to https://www.paytr.com/rapor/odeme-dokumu/ via POST method.

Field name Explanation
merchant_id Merchant No
start_date Start Date:Date Format: 2022-01-01 (YYYY-MM-DD)
end_date End Date:Date Format: 2022-01-01 (YYYY-MM-DD )
paytr_token You should look at the example codes.


2- Your response to this request is returned in JSON format.

a. If there is no transaction within the given date duration, the status value returns failed. b. If there is a transaction within the given date duration the status value returns as "success" with the information in the table below returns. c. If there is any mistake in the request, the status value returns "error". In this case, you should check the "err_msg" for error details.

When the status value is “successful", the returned values are in the table below.

Field name Explanation Values
date_paid Payment Date e.g. 2022-02-07
currency Currency e.g. TL
sales Total sales amount e.g. 950.95
return Total refund amount e.g. 12.64
net Net amount transferred e.g. 938.31
merchant_iban Merchant IBAN number e.g. TR00000000000000000000000000
currency Currency e.g. TL, USD

Could you please translate this? You can handle the data block containing your future payments under the name 'future_payments.' Inside future_payments, in addition to the fields specified below, you can access the date and currency type values.

Field name Explanation Values
net_amounts Net amount 500
sale_amounts Sales amount 500
return_amounts Refund amount 150


Payment statement sample codes: It is explained in detail in the sample codes.

<?php

    $merchant_id    = 'XXXXXX';
    $merchant_key   = 'XXXXXX';
    $merchant_salt  = 'XXXXXX';

    #
    $start_date     = "2022-09-01";
    $end_date       = "2022-09-31";

    #
    ############################################################################################

    $paytr_token = base64_encode(hash_hmac('sha256', $merchant_id . $start_date . $end_date . $merchant_salt, $merchant_key, true));

    $post_vals = array('merchant_id' => $merchant_id,
        'start_date' => $start_date,
        'end_date' => $end_date,
        'paytr_token' => $paytr_token
    );
    #
    ############################################################################################

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/rapor/odeme-dokumu/");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 90);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 90);

    $result = @curl_exec($ch);

    if (curl_errno($ch)) {
        echo curl_error($ch);
        curl_close($ch);
        exit;
    }

    curl_close($ch);

    echo "<pre>";
    $result = json_decode($result, 1);

    if ($result['status'] == 'success')
    {

        print_r($result);
    }
    elseif ($result['status'] == 'failed')
    {

        echo "No payment statement was found in the relevant date range";
    }
    else
    {

        echo $result['err_no'] . " - " . $result['err_msg'];
    }

Payment statement sample codes Click to download.

Marketplace Payment Statement

1- Send the date you want to see the payment details to https://www.paytr.com/rapor/odeme-dokumu/ via POST method.

Field name Explanation
merchant_id Merchant No
start_date Start Date:Date Format: 2022-01-01 (YYYY-MM-DD)
end_date End Date:Date Format: 2022-01-01 (YYYY-MM-DD )
paytr_token You should look at the example codes.


2- Your response to this request is returned in JSON format.

a. If there is no transaction within the given date duration, the status value returns failed. b. If there is a transaction within the given date duration the status value returns as "success" with the information in the table below returns. c. If there is any mistake in the request, the status value returns "error". In this case, you should check the "err_msg" for error details.

When the status value is “successful", the returned values are in the table below.

Field name Explanation Values
date_paid Payment Date e.g. 2022-02-07
currency Currency e.g. TL
sales Total sales amount e.g. 950.95
return Total refund amount e.g. 12.64
net Net amount transferred e.g. 938.31
merchant_iban Merchant IBAN number e.g. TR000000000000000000000000000
currency Currency e.g. TL, USD


<?php

    $merchant_id    = 'XXXXXX';
    $merchant_key   = 'XXXXXX';
    $merchant_salt  = 'XXXXXX';

    #
    $start_date     = "2022-09-01";
    $end_date       = "2022-09-31";

    #
    ############################################################################################

    $paytr_token = base64_encode(hash_hmac('sha256', $merchant_id . $start_date . $end_date . $merchant_salt, $merchant_key, true));

    $post_vals = array('merchant_id' => $merchant_id,
        'start_date' => $start_date,
        'end_date' => $end_date,
        'paytr_token' => $paytr_token
    );
    #
    ############################################################################################

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/rapor/odeme-dokumu/");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 90);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 90);

    $result = @curl_exec($ch);

    if (curl_errno($ch)) {
        echo curl_error($ch);
        curl_close($ch);
        exit;
    }

    curl_close($ch);

    echo "<pre>";
    $result = json_decode($result, 1);

    if ($result[status] == 'success')
    {

        print_r($result);
    }
    elseif ($result[status] == 'failed')
    {

        echo "No payment statement was found in the relevant date range.";
    }
    else
    {

        echo $result[err_no] . " - " . $result[err_msg];
    }

For marketplace payment statement sample codes Click to download.