You can access the details of the sales and return transactions made within the date duration (3 days maximum) using that service
1- A request is made to transaction detail service https://www.paytr.com/rapor/islem-dokumu along with BIN number of the card(The first 6 digits of the card number) and the fields that must be sent.
Required parameters for token creation
Field name / Type | Explanation | Compulsory | Limitations |
---|---|---|---|
merchant_id(string) | Payment amount | Evet | Merchant Number: Merchant number given to you by PayTR |
start_date(string) | Start Date: Date Format: 2021-01-01 00:00:00 (YYYY-MM-DD hh:mm:ss) | Yes | - |
end_date | End Date: Date Format: 2021-01-01 23:59:59 (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 | Explanation | Compulsory | Limitations |
---|---|---|---|
merchant_id (string) | Merchant Number: Merchant number given to you by PayTR | Yes | - |
start_date (integer) | Start Date: Date Format: 2021-01-01 00:00:00 (YYYY-MM-DD hh:mm:ss) | Yes | - |
end_date(integer) | End Date: Date Format: 2021-01-01 23:59:59 (YYYY-MM-DD hh:mm:ss) | Yes | - |
dummy(int) | Demo Data, it is used to simulate the data returned from the service. The data are not real, it can only be used for testing | Yes | 0 or 1 |
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 |
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. Same values are returned in Sales and Returns transactions.
Explanation | Field name / Type | Values |
---|---|---|
Transaction Type: The type of the transaction | islem_tipi (string) | S (Sales) or I (Return) |
Net Amount: The amount after deduction. | net_tutar (string) | e.g. 9.76 |
Deduction Amount: The amount deducted for the transaction | kesinti_tutari (string) | e.g. 0.24 |
Deduction Rate: The deduction rate for the transaction | kesinti_orani (string) | e.g. 2.35 |
Transaction Amount: The amount of the transaction made | islem_tutari (string) | e.g. 10.00 |
Payment Amount: It is returned if there is a payment above the transaction amount | odeme_tutari (string) | e.g. 10.00 |
Transaction Date: The transaction was made | islem_tarihi (string) | e.g. 13.01.2021 |
Currency: Transaction currency | para_birimi (string) | TL, USD, EUR, GBP, RUB |
Installment : If the payment is made in installments, the number of installments will return | taksit (string) | 0,2,3,4,5,6,7,8,9,10,11,12 |
Card Brand: The brand of the card used in the transaction | kart_marka (string) | e.g. WORD, BONUS, vb. |
Card No: The masked credit card number that is processed | kart_no (string) | e.g. 455359AAA6747 |
Order Number: Order number of the transaction | siparis_no (string) | e.g. ABC123 |
Payment Type: The type of payment | odeme_tipi (string) | Card or EFT |
<?php
$merchant_id = 'XXXXXX';
$merchant_key = 'XXXXXXYYYYYY';
$merchant_salt = 'YYYYYYXXXXXX';
$start_date = "2020-06-02 00:00:00";
$end_date = "2020-06-04 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/rapor/islem-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);
$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];
}
Transaction detail sample codes Click to download.