Link API Delete

You can delete the payment links you have created before by using the Link Delete Service.

1- The token data is generated with the information below that must be sent.
2- A request is made to the create service https://www.paytr.com/odeme/api/link/delete along with the generated token and the fields that must be sent.

Required parameters for token creation

Field name / Type Description Mandatory Limitations
id (integer) Link API Returned value from Create method Yes -
merchant_id(integer) A value specific to your store, which you can access through the PayTR Merchant Panel > Information page. 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 content

Field name / Type Description Mandatory Limitations
merchant_id (integer) Merchant number: Merchant number given to you by PayTR Yes -
id (integer) ID: It is the value returned in the create method. Yes -
debug_on(int) Error message (Send as 1 for integration and test errors) No 0(closed) or 1(open
paytr_token(string) paytr_token: This value is the one you need to create to make sure the request is coming from you and that the values it contains have not changed Yes Please check the sample codes for calculation



2) RESPONS

Description Field name / Type Values
Response status (string) success, error or failed
Request description (in case of error) reason (string) Example: Invalid id or link has already been deleted


<?php

    $merchant_id    = 'AAAAAA';
    $merchant_key   = 'XXXXXXXXXXXXXXXX';
    $merchant_salt  = 'XXXXXXXXXXXXXXXX';

    $id             = "YYYXXX";    
    $debug_on       = 1;           

    $paytr_token=base64_encode(hash_hmac('sha256', $id.$merchant_id.$merchant_salt, $merchant_key, true));
    $post_vals=array(
        'merchant_id'       => $merchant_id,
        'id'                => $id,
        'debug_on'          => $debug_on,
        'paytr_token'       => $paytr_token
    );

    $ch=curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/odeme/api/link/delete");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1) ;
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
    $result = @curl_exec($ch);

    if(curl_errno($ch))
        die("PAYTR LINK DELETE API request timeout. err:".curl_error($ch));

    curl_close($ch);

    $result=json_decode($result,1);

    if($result['status']=='error')
        die($result['err_msg']);
    elseif($result['status']=='failed')
        print_r($result);
    else
        print_r($result);

For Link API Delete service sample codes Click to download.