When making direct API integration, the installment rates query API is used to pull the installment rates.Rates can vary daily. For this reason, you can pull these rates daily through the installment rates query API, save them in the database and update them.. You can apply these rates according to the product price in installment transactions. In the tables below, the values returned in the result variable are described in detail.
Required parameters for token creation
Field name / Type | Explanation | Compulsory | Limitations |
---|---|---|---|
merchant_id | Merchant Number: Merchant number given to you by PayTR | Yes | - |
request_id | Request ID: With a maximum of 32 characters. | 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 | Explanation |
---|---|
merchant_id | Merchant Number: Merchant number given to you by PayTR |
merchant_key | Merchant password |
merchant_salt | Merchant secret key |
single_ratio | 1 or 0 (Merchant should be sent 1 for single shot rate) |
abroad_ratio | 1 or 0 (Merchant should be sent 1 for overseas single shot rate) |
Returned values in the result variable:
Field name / Type | Explanation |
---|---|
status | Database operations are performed if it returns Success |
request_id | Request ID of up to 32 characters (string). Returns in response |
err_msg | Returns an error message (Example: "Required field value is invalid or not sent:") |
max_inst_non_bus | Maximum number of installments defined in your store |
rates | Rates of the number of installments defined in your store are returned in array format according to card type (axess, world, maximum, cardfinans, paraf, advantage, combo, bonus) |
Installment inquiry sample codes: How to do it is explained in detail in the sample codes.
<?php
$merchant_id='XXXXXX';
$merchant_key='YYYYYYYYYYYYYY';
$merchant_salt='ZZZZZZZZZZZZZZ';
$request_id=time();
$paytr_token=base64_encode(hash_hmac('sha256',$merchant_id.$request_id.$merchant_salt,$merchant_key,true));
$post_vals=array(
'merchant_id'=>$merchant_id,
'request_id'=>$request_id,
'paytr_token'=>$paytr_token
);
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/odeme/taksit-oranlari");
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')
{
//VT işlemleri vs.
print_r($result);
}
else //Örn. $result -> array('status'=>'error', "err_msg" => "Zorunlu alan degeri gecersiz veya gonderilmedi: "
{
echo $result[err_msg];
}
Installment service sample codes Click to download