Returning Payments Callback

After the transfer request you create from the returned payments, you receive a Success response, and your request to send from the account is received successfully by the PayTR system.The PayTR system will process your request in an average of 5 minutes, check the trans_info content you send, and make the transfers. If incorrect information is detected during the check, the relevant transaction is marked as unsuccessful. The resulting result is notified by POST to the address you defined as PayTR Mağaza Paneli > Ayarlar > Platform Transfer Sonucu Bildirim URL in JSON format. Please review the sample codes (paytr_back_donen_odeme_callback_example.php).

The result of each payment process (success or failed) will be sent separately to the Callback URL by PAYTR system. You can process according to the demand result by considering the result value contained in the incoming values.

POST REQUEST FIELDS AND VALUES sent to the Callback URL by the PayTR system:

Field name Description Value
mode It comes with cashout value as constant cashout
hash It will be used in Hash control Example: wszlFsC7nrfCPvP77kdEzzE4smGdV4FWvDibKlXIpRM=
trans_id A unique value that you send to Paytr when making a request to send a returned payment from the account Example: 12345aaabbb
processed_result The values that you send to PayTR when making a request to send the returned payment from the account Example: [{\"amount\":484.48,\"receiver\":\"XYZ LTD STI\",\"iban\":\"TRXXXXXXXXXXXXXXXXXX\",\"result\":\"success\"}]
success_total Number of successfully transferred transactions (in processed_result,number of result:success) Example: 1
failed_total Number of processes that receive an error (in processed_result,number of result:failed) Example: 0
transfer_total Total amount of successfully transferred transactions Example: 484.48
account_balance Your remaining sub-account balance after transfers Example: 75

The RESPONSE that the Callback URL gives to the PayTR system should be plain text OK.

Example (PHP): echo "OK";
Example (.NET): Response.Write("OK");


  1. You should not restrict access to your Callback URL by any means such as session control, etc. This is vital for the PayTR system to reach the page.

  2. ou should not display HTML or any other content before or after the “OK” response.

  3. Callback URL is not a page which users see during payment process, thus there will be no user SESSION at this page and no SESSION values can be used. PayTR system submits a POST which contains relevant information such as “merchant_oid”

  4. It is crucial for security reasons to check that the hash value in POST is the same as the hash value that will be created using the related values in POST. This is necessary to ensure that the POST request comes from the PayTR system and the values do not change during transport. Be warned that if you do not check hash value, you may face financial losses.


    $post = $_POST;

    $merchant_key   = 'YYYYYYYYYYYYYY';
    $merchant_salt  = 'ZZZZZZZZZZZZZZ';

    $hash = base64_encode( hash_hmac('sha256', $post['merchant_id'].$post['trans_id'].$merchant_salt, $merchant_key, true) );

    if( $hash != $post['hash'] )
        die('PAYTR notification failed: bad hash');

    $processed_result = json_decode($post['processed_result'],1);
    foreach($processed_result as $trans)


    echo "OK";

Returning payments callback sample codes click to download