The merchant sends the following information to the Platform Transfer API.
Required parameters for token creation
Field Name / Type | Description | Mandatory | Limitations |
---|---|---|---|
merchant_id | Merchant number: Merchant number given to you by PayTR | Yes | |
merchant_oid (string) | Merchant order number: Your unique order number that you submitted during the sales process | Yes | 64 characters, Alphanumeric |
trans_id (string) | Unique tracking number for tracking this payment to the seller | Yes | Alphanumeric - Up to 60 characters |
submerchant_amount (integer) | The amount to be paid to the seller: The amount to be paid to the seller for the order multiplied by 100. | Yes | For example, 3456 should be sent for 34.56 TL(34.56 * 100 = 3456) |
total_amount (integer) | Total payment amount: The total payment amount of the order multiplied by 100 | Yes | For example, 9456 should be sent for 94.56 TL (94.56 * 100 = 9456) |
transfer_name (string) | Name, surname / title for the seller's bank account | Yes | Example: Ragıp Adıgüzel |
transfer_iban(int) | Seller's IBAN bank account number. | Yes | Example: TRXX XXXX XXXX XXXX XXXX XXXX XX (26 characters) |
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 |
Field Name / Type | Mandatory | Token | Description | Limitations |
---|---|---|---|---|
merchant_id(integer) | Yes | Yes | Merchant number: Merchant number given to you by PayTR | |
merchant_oid (string) | Yes | Yes | Merchant order number: Your unique order number that you submitted during the sales process | 64 characters, Alphanumeric |
trans_id | Yes | Yes | Unique tracking number for tracking this payment to the seller | Alphanumeric - Up to 60 characters |
submerchant_amount(integer) | Yes | Yes | The amount to be paid to the seller: The amount to be paid to the seller for the order multiplied by 100. | For example, 3456 should be sent for 34.56 TL (34.56 * 100 = 3456) |
total_amount(integer) | Yes | Yes | Total payment amount: The total payment amount of the order multiplied by 100 | For example, 9456 should be sent for 94.56 TL (94.56 * 100 = 9456 |
transfer_name (string) | Yes | Yes | Name, surname / title for the seller's bank account | Example: Ragıp Adıgüzel |
transfer_iban | Yes | Yes | Seller's IBAN bank account number | Ex: TRXX XXXX XXXX XXXX XXXX XXXX XX (26 Karakter) |
paytr_token (string) | Yes | No | paytr_token: The value you create to make sure the request came from you and the content has not changed | Please check the sample codes for calculation |
IMPORTANT NOTES: 1- The merchant must send the request via the Transfer API until 10:00 at the latest on the date of payment. Requests sent later will be processed the next day.
2- You cannot create a transfer request on the same day as the order payment. You should create your request on the first day after the payment.
TRANSFERS EXAMPLE (Values are not real. They are just examples.)
EXAMPLE 1: IF THERE IS SINGLE SUB-SELLER IN THE PAYMENT
• Merchant Number (merchant_id): 100001
• Order Amount: 100 TL
• Order Number (merchant_oid): 123ABCD
• Tracking Number (trans_id): 45ABT34
• The money to be transferred to the seller according to the commission rate with the seller (Example: 8%) (submerchant_amount): 92 TL
• The amount of the transaction to be paid (total_amount): 100 TL When you give payment order with these transactions;
• 92 TL is paid to the seller,
• From the remaining 8 TL, your commission rate with PayTR (Example: 3%) is deducted and the remaining amount (5 TL according to the example) is transferred to your company's account. The deduction made will be billed to you..
EXAMPLE 2: THERE IS MORE THAN ONE SUB-SELLER IN THE PAYMENT
Order payment can cover multiple sellers. For example; The cardholder may be purchasing products / services from more than one seller in the shopping cart.
Let's assume the total price of the order is 300 TL. In this case,
• Merchant Number (merchant_id): 100001
• Order Amount: 300 TL
• Order Number (merchant_oid): 123ABCDE
• Tracking Number (trans_id): 75ZTY39
• The money to be transferred to the seller according to the commission rate with the seller (Example: 8%) (submerchant_amount): 92 TL
• The amount of the transaction to be paid (total_amount): 100 TL
• Merchant Number (merchant_id): 100001
• Order Amount: 300 TL
• Order Number (merchant_oid): 123ABCDE
• Tracking Number (trans_id): DF43DFC
• The money to be transferred to the seller according to the commission rate with the seller (Example: 5%) (submerchant_amount): 47,5 TL
• The amount of the transaction to be paid (total_amount): 50 TL
• Merchant Number (merchant_id): 100001
• Order Amount: 300 TL
• Order Number (merchant_oid): 123ABCDE
• Tracking Number (trans_id): 98DFVXS
• The money to be transferred to the seller according to the commission rate with the seller (Example:10%) (submerchant_amount): 135 TL
• The amount of the transaction to be paid (total_amount): 150 TL You can give more than one payment order.
EXAMPLE 3: THE PAYMENT IS NOT FOR THE SUB-SELLER
For other payments made through your software, if you want to take the entire amount into your company's account,
• Merchant Number (merchant_id): 100001
• Order Amount: 50 TL
• Order Number (merchant_oid): 1881ABCD
• Tracking Number (trans_id): 18ATT81
• The money to be transferred to the seller according to the commission rate with the seller (Example: 0% ) (submerchant_amount): 0 TL
• The amount of the transaction to be paid (total_amount): 50 TL In case of creating a request, the entire amount will be transferred to your company's account.
The response to the request (RESPONSE) is in JSON format. You can check the sample codes for more.
<?php
$merchant_id = 'MAGAZA_NO';
$merchant_key = 'XXXXXXXXXXX';
$merchant_salt = 'YYYYYYYYYYY';
$merchant_oid = "";
$trans_id = time();
$submerchant_amount = "";
$total_amount = "";
$transfer_name = "";
$transfer_iban = "";
$hash_str = $merchant_id . $merchant_oid . $trans_id . $submerchant_amount . $total_amount . $transfer_name . $transfer_iban;
$token = base64_encode(hash_hmac('sha256',$hash_str.$merchant_salt,$merchant_key,true));
$post_vals=array(
'merchant_id'=>$merchant_id,
'merchant_oid'=>$merchant_oid,
'trans_id'=>$trans_id,
'submerchant_amount'=>$submerchant_amount,
'total_amount'=>$total_amount,
'transfer_name'=>$transfer_name,
'transfer_iban'=>$transfer_iban,
'paytr_token'=>$token
);
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/odeme/platform/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, 20);
$result = @curl_exec($ch);
if(curl_errno($ch))
die("PAYTR platform transfer request connection error. err:".curl_error($ch));
curl_close($ch);
$result=json_decode($result,1);
if($result['status']=='success')
{
}
else
{
echo $result['err_no']." - ".$result['err_msg'];
}
?>
Transfer instructions sample codes Click to download.