Arama Yap Mesaj Gönder
Biz Sizi Arayalım
+90
X
X
X
X

Knowledge Base

Homepage Knowledge Base General PayTR Link API SMS and Email Servic...

Bize Ulaşın

Konum Halkalı merkez mahallesi fatih cd ozgur apt no 46 , Küçükçekmece , İstanbul , 34303 , TR

PayTR Link API SMS and Email Service: Payment Link Sending Guide

PayTR Link API not only creates payment links but also allows you to deliver these links to your customers via SMS or Email. This article explains the PayTR Link API SMS and Email sending services in detail, supported by sample codes. We also teach correct integration and common mistakes.

Related Guides:


1) PayTR Link API SMS Service

You can send payment link SMS directly to your customers via their mobile phone number.

Required Fields for Token Generation:

  • id: The ID you created the link with

  • merchant_id: Your Merchant ID

  • cell_phone: 11-digit number starting with 05

  • merchant_salt & merchant_key: From your merchant panel

Token Calculation (PHP Example):

$paytr_token = base64_encode(hash_hmac('sha256', $id.$merchant_id.$cell_phone.$merchant_salt, $merchant_key, true));

POST Request Output:

$post_vals = array(
    'merchant_id' => $merchant_id,
    'id' => $id,
    'cell_phone' => $cell_phone,
    'debug_on' => 1,
    'paytr_token' => $paytr_token
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/odeme/api/link/send-sms");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals);
$result = curl_exec($ch);
curl_close($ch);

print_r(json_decode($result, true));

Returned Values:

  • status: success / error / failed

  • reason: Error message (if any)


2) PayTR Link API Email Service

You can also send the payment link to your customers via Email instead of SMS.

Required Fields for Token Generation:

  • id: Link ID

  • merchant_id: Your Merchant ID

  • email: Recipient email address (max 100 characters)

  • merchant_salt & merchant_key

Token Calculation (PHP Example):

$paytr_token = base64_encode(hash_hmac('sha256', $id.$merchant_id.$email.$merchant_salt, $merchant_key, true));

POST Request Output:

$post_vals = array(
    'merchant_id' => $merchant_id,
    'id' => $id,
    'email' => $email,
    'debug_on' => 1,
    'paytr_token' => $paytr_token
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/odeme/api/link/send-email");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals);
$result = curl_exec($ch);
curl_close($ch);

print_r(json_decode($result, true));

3) Common Mistakes and Solutions

Error Status Reason Solutions
status: error Incorrect token calculation Check the hash generation formula
SMS not sending Phone number does not start with 05 or is not 11 digits Pay attention to the format
Email not sending Email address is incorrect or character limit exceeded Verify the email address
CURL timeout Server firewall or SSL settings are blocking Check SSL settings

4) Sample Successful Responses

For SMS:

{
  "status":"success"
}

For Email:

{
  "status":"success"
}

5) Recommendations

  • Add double-click control for SMS sending (to prevent multiple sends to one number).

  • Perform MX record and blacklist checks for email sending.

  • Always verify the incoming JSON data with the "status" and "reason" fields.

  • Use "debug_on" = 1 in test mode while developing the integration.


Conclusion: Increase Your Sales with PayTR Link API SMS and Email Sending

PayTR Link API SMS and Email services offer your customers an easy, fast, and direct way to make payments. With regular use, you can increase your collections by up to 30%.

Related Resources:

 

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(3988 times viewed / 111 people found it helpful)

Call now to get more detailed information about our products and services.

Top