Returning Payments List

With this service, a transfer request has been made but you can access the list of returned payments due to the buyer account error. Returned payments are processed as a balance to a subaccount for your store. You can use the "Returning Payments - Send From Account" service to resend these returned payments.

1- To get the list of returned payments, send the information specified in the table to the URL related to POST: https://www.paytr.com/odeme/geri-donen-transfer

Required parameters for token creation

Field name / type Description Mandatory Limitations
merchant_id(integer) Merchant No: Merchant number given to you by PayTR Yes -
start_date(string) Start date: Sample format: 2020-05-29 00:05:56 (YYYY-MM-DD hh:mm:ss) Yes -
end_date End date: Sample format: 2020-05-29 23:59:10 (YYYY-MM-DD hh:mm:ss) Yes -
merchant_salt A value specific to your store, which you can access through the PayTR Merchant Panel > Information page. Yes -
merchant_key A value specific to your store, which you can access through the PayTR Merchant Panel > Information page. Yes -


* Values to be sent in POST REQUEST:

Field name / type Description Mandatory Limitations
merchant_id (string) Merchant No: Merchant number given to you by PayTR Yes -
start_date (integer) Start date: Sample format: 2020-05-29 00:05:56 (YYYY-MM-DD hh:mm:ss) Yes -
end_date(integer) End date: Sample format: 2020-05-29 23:59:10 (YYYY-MM-DD hh:mm:ss) Yes -
dummy (integer) Dummy is used to create data No 1 or 0 (1 needs to be sent for Dummy data)
paytr_token(string) PayTR Token: The value you create to make sure that the request comes from you and that the content has not changed Yes (See sample code for calculation



2- Your request will be returned in JSON format. a. If there is no bounce payment within the specified date range, the status value returns failed. b. If there is any bounce payment within the specified date range, the status value success and the information in the table below will be returned. c. If you have an error in the query, the status value returns an error. In this case, you should check the err_msg content for the error detail. Other information returned in the status success status is detailed in the table below. Same values are returned without any difference in Sales and Returns transactions.

Description Field name / type Values
Reference No: The distinguishing number of the transaction ref_no Example: 1000001
The date on which the returned payment was detected date_detected Example: 2020-06-08
The date the payment was returned date_reimbursed Example: 2020-06-08
Receiver name and surname transmitted in the transfer request transfer_name Example: TEST USER
IBAN transmitted in the transfer request transfer_iban -
Amount transmitted in the transfer request transfer_amount Example: 35.18
Currency transmitted in the transfer request transfer_currency Example: TL
Date of transfer request transfer_date Example: 2020-06-08


<?php

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

    $start_date = "2020-05-20 00:00:00";
    $end_date = "2020-06-16 23:59:59";

    $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/odeme/geri-donen-transfer");
    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);

    $result = json_decode($result, 1);

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

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

        echo "ilgili tarih araliginda islem bulunamadi";
    }
    else
    {

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

Returning payments list sample codes click to download