Overview
The Card to IBAN API converts an Iranian debit card number into the corresponding IBAN using Sepal Yar. Use it to validate payout details before transferring funds.
این API شماره کارت بانکی را دریافت کرده و شماره شبا متناظر را از سرویس سپالیار برمیگرداند. در صورت موفقیت هزینه سرویس از کیفپول کسر شده و درخواست در سیستم ثبت میشود.
/api/services/card-to-iban/
The Card to IBAN API converts an Iranian debit card number into the corresponding IBAN using Sepal Yar. Use it to validate payout details before transferring funds.
Send both headers in every request:
Authorization: Token YOUR_AUTH_TOKEN
X-Unique-Code: YOUR_UNIQUE_CODEMissing headers result in HTTP 401.
Send a POST request with JSON body:
{
"pan": "6037997139718010"
}The card number must be 16 digits and pass the Luhn algorithm.
Successful responses include the generated IBAN, bank metadata, and tracking references. Wallet deductions and request references are also included for auditing.
Common errors:
| پارامتر | نوع | اجباری | توضیحات | مثال |
|---|---|---|---|---|
pan
|
String | اجباری |
شماره کارت بانکی (PAN) با طول ۱۶ رقم. فقط اعداد مجاز است و از الگوریتم Luhn برای اعتبارسنجی استفاده میشود.
اعتبارسنجی: طول ۱۶ رقم، فقط اعداد، عبور از الگوریتم Luhn. |
6037997139718010
|
Example using Python requests library.
import requests
url = "https://inquiry.sepal.ir/api/services/card-to-iban/"
headers = {
"Authorization": "Token YOUR_AUTH_TOKEN",
"X-Unique-Code": "YOUR_UNIQUE_CODE",
"Content-Type": "application/json",
}
payload = {
"pan": "6037997139718010"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
Example using C# HttpClient.
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Token YOUR_AUTH_TOKEN");
client.DefaultRequestHeaders.Add("X-Unique-Code", "YOUR_UNIQUE_CODE");
var payload = new
{
pan = "6037997139718010"
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://inquiry.sepal.ir/api/services/card-to-iban/",
content
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
Example using PHP cURL.
<?php
$url = "https://inquiry.sepal.ir/api/services/card-to-iban/";
$payload = [
"pan" => "6037997139718010"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Token YOUR_AUTH_TOKEN",
"X-Unique-Code: YOUR_UNIQUE_CODE",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Command-line cURL example.
curl -X POST "https://inquiry.sepal.ir/api/services/card-to-iban/" \
-H "Authorization: Token YOUR_AUTH_TOKEN" \
-H "X-Unique-Code: YOUR_UNIQUE_CODE" \
-H "Content-Type: application/json" \
-d '{
"pan": "6037997139718010"
}'
پاسخ موفق شامل شماره شبا، اطلاعات بانک و مرجع پاسخ.
{
"amount": "integer",
"success": "boolean",
"request_ref": "string",
"error_message": "null",
"response_data": {
"ref_id": "string",
"Bank-Id": "string",
"deposits": "string",
"last_name": "string",
"first_name": "string",
"iban_number": "string",
"operation_time": "integer (epoch milliseconds)"
},
"response_time_ms": "integer"
}
{
"amount": 12000,
"success": true,
"request_ref": "4QL47QXABF07DHW7XHGBN3MNY6VY7NLC",
"error_message": null,
"response_data": {
"ref_id": "bae5ef76-ee7e-4aa0-b2ed-696f7d609714",
"Bank-Id": "MELIIR",
"deposits": "0219950976002",
"last_name": "علایی",
"first_name": "رامین",
"iban_number": "IR110170000000219950976002",
"operation_time": 1762672009321
},
"response_time_ms": 210
}
پارامتر ورودی نامعتبر است (شماره کارت اشتباه).
{
"error": {
"errors": "list",
"ref_id": "string",
"operation_time": "integer (epoch milliseconds)"
},
"success": "boolean"
}
{
"error": {
"errors": [
{
"code": "1009",
"message": "برنامه به سرویس مورد نظر دسترسی نداشته و یا شما دسترسی آن را تایید ننموده اید"
}
],
"ref_id": "0cf63224-c849-4061-a018-47f7d1443243",
"operation_time": 1762669536847
},
"success": false
}
توکن یا کد یکتا ارسال نشده است.
{
"error": {
"errors": "list",
"ref_id": "string",
"operation_time": "integer (epoch milliseconds)"
},
"success": "boolean"
}
{
"error": {
"code": "AUTHENTICATION_ERROR",
"message": "Authentication credentials were not provided."
},
"success": false
}
موجودی کیفپول کافی نیست.
{
"error": {
"errors": "list",
"ref_id": "string",
"operation_time": "integer (epoch milliseconds)"
},
"success": "boolean"
}
{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient wallet balance."
},
"success": false
}
خطای اعتبارسنجی در سرویس سپالیار (شماره کارت ناشناخته).
{
"error": {
"errors": "list",
"ref_id": "string",
"operation_time": "integer (epoch milliseconds)"
},
"success": "boolean"
}
{
"error": {
"message": "SERVICE_FAILURE"
},
"success": false
}