نمونه کد و مستندات فنی

کتابخانه‌های اختصاصی زبان‌های برنامه‌نویسی مختلف را آماده کردیم. اگر کد مورد نظرتان را نیافتید، از ما بخواهید-

مفاهیم اولیه

مفاهیم اولیه

به بخش مستندات فنی وندار خوش آمدید. برای استفاده از مستندات فنی درگاه و درگاه دومرحله‌ای لازم است از API key ارائه شده در صفحه‌ی درگاه پرداخت میز کار استفاده کنید. برای استفاده از سایر APIها باید با فراخوانی API احراز هویت توکن مورد نظر را دریافت کنید.
در استفاده از مستندات زیر به سطح دسترسی کاربران کسب‌وکار توجه کنید، ممکن است بعضی از APIها برای بعضی از کاربران قابل دسترسی نباشد.
وب‌سرویس‌های وندار به صورت REST در اختیار کاربران و همکاران تجاری ما قرار گرفته است.
لطفا به آدرس پایه سرویس‌ها و نکات زیر توجه کنید:
دانلود مجموعه سرویس‌های وندار برای Postman

مدت زمان اعتبار توکن‌ها ۵ روز است
همواره به جای {business} نام انگلیسی کسب‌وکار جایگذاری شود.

درگاه پرداخت

مقدمه

برای فروشـگاه‌های اینترنتی که خدمات یا محصولاتی را در وب‌سـایت خود ارائه می‌کنـند، از درگاه پرداخت وندار استفاده کنید.



ارسال اطلاعات

در مرحله اول باید پارامترهای موجود در جدول زیر را با متد POST به آدرسی که مشخص شده ارسال کنید. به نوع داده‌ها و نام فیلد توجه کنید. اگر برای فیلد شماره موبایل، شماره موبایل کاربر را به درگاه ارسال نمایید، کاربر به صورت خودکار به صفحه پرداخت درگاه موبایلی هدایت می‌شود، به این معنی که در صفحه‌ی درگاه پرداخت بر مبنای شماره موبایل کاربر فهرست کارت‌های ذخیره شده‌اش در PSP نمایش داده می‌شود.


آدرس تست درگاه


پارامترهای ورودی

Parameter Type Status Description
api_key string required

دریافتی از پنل کاربری شما که بعد از تایید درخواست درگاه صادر میشه API Key
test تست برابر است با API Key

amount Integer required مبلغ تراکنش به صورت ریالی و بزرگتر یا مساوی 1000
callback_url String required باید با آدرس درگاه پرداخت تایید شده در وندار بر روی یک دامنه باشد
mobile_number String optional شماره موبایل (اختیاری، جهت نمایش کارت های خریدار به ایشان و نمایش درگاه موبایلی )
factorNumber String optional شماره فاکتور شما (اختیاری)
description String optional توضیحات (اختیاری، حداکثر 255 کاراکتر)

Example request:

curl --request POST \
  --url https://vandar.io/api/ipg/send \
  --form 'api_key=API_KEY
' \
  --form amount=10000 \
  --form callback_url=http://localhost/ \
  --form mobile_number= \
  --form factorNumber= \
  --form description=
var client = new RestClient("https://vandar.io/api/ipg/send");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://vandar.io/api/ipg/send"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "multipart/form-data")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r");
Request request = new Request.Builder()
  .url("https://vandar.io/api/ipg/send")
  .post(body)
  .addHeader("content-type", "multipart/form-data")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "vandar.io",
  "port": null,
  "path": "/api/ipg/send",
  "headers": {
    "content-length": "0",
    "content-type": "multipart/form-data"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://vandar.io/api/ipg/send",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r",
  CURLOPT_HTTPHEADER => array(
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("vandar.io")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r"

headers = {
    'content-type': "multipart/form-data"
    }

conn.request("POST", "/api/ipg/send", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://vandar.io/api/ipg/send")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r"

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "token": "Payment Token"
}

Example response (400):

{
  "status": 0,
  "errors": [
    "وارد کردن api key الزامی است",
    "api_key معتبر نیست",
    "IP پذیرنده معتبر نیست",
    "وارد کردن callback_url الزامی است",
    "callback_url معتبر نیست",
    "وارد کردن amount الزامی است",
    "amount نباید کوچکتر از 1000 باشد",
    "amount باید عدد یا رشته‌ای از اعداد باشد"
  ]
}


انتقال

اگر در مرحله ارسال اطلاعات، اطلاعات ارسالی صحیح باشد و دو مقدار status و token را دریافت کرده باشید. باید کاربر را به شیوه‌ی زیر به درگاه redirect کنید. برای این کار باید عددی که در مرحله اول در متغیر {token} دریافت کردید را در آخر آدرس قرار دهید و کاربر را به URL ایجاد شده redirect کنید تا بلافاصله کاربر به درگاه پرداخت هدایت شده و سپس مرحله سوم را انجام دهید.


آدرس تست درگاه

Example request:

url="https://vandar.io/ipg/$token"
redirect_url=$(curl -Ls -o /dev/null -w %{url_effective} http://vandar.ir/ipg/iwjeoirjweiroj)
[Route("Vandar")]
    public class TestControllers:ControllerBase
    {
        [HttpGet()]
        public ActionResult GetAll(int bid){
               StringBuilder stringBuilder =new StringBuilder();
               stringBuilder.Append("https://vandar.io/ipg/");
               stringBuilder.Append("token");
               string link =stringBuilder.ToString();
               return this.Redirect(link);
        }
redirectUrl = "https://vandar.io/ipg/:token";
import (
    "net/http"
)
func redirect(w http.ResponseWriter, r *http.Request) {
    http.Redirect(w, r, redirectUrl , 301)
}
string go = "https://vandar.io/ipg/{token}";
response.sendRedirect(go);
var go = "https://vandar.io/ipg/{token}";
res.writeHead(301, { "Location": go });
$go = "https://vandar.io/ipg/{token}";
header("Location: $go");
import requests
token = "TOKEN"
redirect_url = f"https://vandar.io/ipg/{token}"
requests.get(redirect_url, allow_redirects=True)

//for versions earlier than 3.6 make this:

import requests
token = "TOKEN"
redirect_url = "https://vandar.io/ipg/{token}".format(token=token)
requests.get(redirect_url, allow_redirects=True)
url = "https://vandar.io/ipg/:token" ;
redirect_to url;



بازگشت

مرحله سوم زمانی انجام می‌شود که کاربر از درگاه پرداخت برمی‌گردد. در این مرحله با توجه به نتیجه تراکنش و وضعیت آن، ما کاربر را به callback URL شما که در مرحله اول با پارامتر redirect ارسال کرده بودید هدایت می‌کنیم.

Example request:

token="$(echo $redirect_url | cut -d/ -f5-6)"


verify() {
    api_key=$1
    token=$2
    curl --header "Content-Type: application/json" \
    --request POST \
    --data '{"api_key":"$api_key","token":"$token"}' \
    'https://vandar.io/api/ipg/verify',
  }
namespace modam.api.Controllers
{
    [Route("Vandar")]

    public class TestControllers:ControllerBase
    {

        [HttpGet("{token}")]
        public ActionResult GetAll(string token){
               StringBuilder stringBuilder =new StringBuilder();
               stringBuilder.Append("http://example.com");
               stringBuilder.Append(token);
               string link =stringBuilder.ToString();
               return this.Redirect(link);
        }

//call verify method


    }
}
func handler(w http.ResponseWriter, r *http.Request) {
    theToken, ok := r.URL.Query()["token"]
    token := theToken[0]
}
//call verify method
token = URLDecoder.decode(uri.getQueryParameter(token), "UTF-8");
// Call Verify method
let requestSegments = req.path.split('/');
requestSegments.slice(-1)[0]

//call verify method 
$token = $_GET['token'];
//call verify method ;
import requests
try:
    from urllib.parse import urlparse
except ImportError:
    from urlparse import urlparse
res = requests.get("https://vandar.io/ipg/token")
parsed_url = urlparse(res.url)
url_path = parsed_url.path
# remove empty string for prevent APPEND_SLASH return
splitted_url = list(filter(None, url_path.split("/")))
token = splitted_url[-1]
params[:token];
//
call verify method


تایید

مهم: در صورت موفقیت‌آمیز بودن تراکنش، با فراخوانی متد verify، هر بار پیام verify تراکنش اعلام می‌شود. برای پیشگیری از بروز تقلب، پذیرنده باید قبل از ارائه محصول و خدمات با استفاده از شماره تراکنش شبکه پرداخت وندار (همان transId) از نبود شماره تراکنش در بانک اطلاعاتی خود اطمینان حاصل کند سپس خدمات را به مشتری ارائه نماید.


آدرس تست درگاه

برای تست درگاه در این بخش کافیست که api_key را برابر با test قرار دهید و توکن دریافتی تستی در مرحله‌ی ارسال دیتا را به عنوان توکن ارسال کنید.

Example request:

curl --request POST \
  --url https://vandar.io/api/ipg/verify \
  --form api_key=API_KEY \
  --form token=TOKEN
var client = new RestClient("https://vandar.io/api/ipg/verify");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://vandar.io/api/ipg/verify"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "multipart/form-data")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY");
Request request = new Request.Builder()
  .url("https://vandar.io/api/ipg/verify")
  .post(body)
  .addHeader("content-type", "multipart/form-data")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "vandar.io",
  "port": null,
  "path": "/api/ipg/verify",
  "headers": {
    "content-length": "0",
    "content-type": "multipart/form-data"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://vandar.io/api/ipg/verify",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY",
  CURLOPT_HTTPHEADER => array(
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);


curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("vandar.io")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY"

headers = {
    'content-type': "multipart/form-data"
    }

conn.request("POST", "/api/ipg/verify", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://vandar.io/api/ipg/verify")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "amount": "1000.00",
    "realAmount": 500,
    "wage": "500",
    "transId": 159178352177,
    "factorNumber": "12345",
    "mobile": "09123456789",
    "description": "description",
    "cardNumber": "603799******7999",
    "paymentDate": "2020-06-10 14:36:30",
    "cid": null,
    "message": "ok"
  }

Example response (400):

{
  "status": 0,
  "errors": [
    "وارد کردن api key الزامی است",
    "api_key معتبر نیست",
    "IP پذیرنده معتبر نیست",
    "وارد کردن token الزامی است",
    "token معتبر نیست",
    "نتیجه تراکنش قبلا از طرف وندار اعلام گردیده",
    "تراکنش با خطا مواجه شده است"
  ]
}


لیست درگاه‌های پرداخت

Example request:

curl --request GET \
--url https://basic_url/v2/business/{business}ipg/show \
--header 'authorization: Bearer [TOKEN]'
var client = new RestClient("https://basic_url/v2/business/{business}ipg/show");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Bearer [TOKEN]");
IRestResponse response = client.Execute(request);
package main

import (
"fmt"
"net/http"
"io/ioutil"
)

func main() {

url := "https://basic_url/v2/business/{business}ipg/show"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("authorization", "Bearer [TOKEN]")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}
var http = require("https");

var options = {
"method": "GET",
"hostname": "basic_url",
"port": null,
"path": "/v2/business/{business}ipg/show",
"headers": {
"content-length": "0",
"authorization": "Bearer [TOKEN]"
}
};

var req = http.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});

req.end();
curl --request GET \
--url https://basic_url/v2/business/{business}/iban \
--header 'accept: application/json' \
--header 'authorization: Bearer [TOKEN]'
curl --request GET \
--url https://basic_url/v2/business/{business}/iban \
--header 'accept: application/json' \
--header 'authorization: Bearer [TOKEN]'
import http.client

conn = http.client.HTTPSConnection("basic_url")

payload = ""

headers = { 'authorization': "Bearer [TOKEN]" }

conn.request("GET", "/v2/business/{business}ipg/show", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://basic_url/v2/business/{business}ipg/show")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Bearer [TOKEN]'

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "data": {
    "ipg": {
      "urls": [
        "https:\/\/test1.ui",
        "https:\/\/test2.market",
        "https:\/\/google.ws",
        "https:\/\/jesica.tv",
        "https:\/\/api.jesica.tv",
        "https:\/\/test.google.market"
      ],
      "ips": [
        "135.242.0.125"
      ],
      "api_key": "714e6f**************a9a2273243",
      "wage": false,
      "vip": true,
      "payment": false,
      "status": 1,
      "transactions_count": 23,
      "transactions_sum": 2604
    }
  }
}

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


درگاه پرداخت دومرحله‌ای

مقدمه

برای فروشـگاه‌های اینترنتی که خدمات یا محصولاتی را در وب‌سـایت خود ارائه می‌کنـند، از درگاه پرداخت وندار استفاده کنید.



ارسال اطلاعات

در مرحله اول باید پارامترهای موجود در جدول زیر را با متد POST به آدرسی که مشخص شده ارسال کنید. به نوع داده‌ها و نام فیلد توجه کنید. اگر برای فیلد شماره موبایل، شماره موبایل کاربر را به درگاه ارسال نمایید، لیست شماره کارت‌های ثبت شده برای این شماره موبایل در صفحه پرداخت نمایش داده می‌شود. نکته: تمامی داده‌های برگشتی از وندار به صورت json خواهد بود


پارامترهای ورودی

Parameter Type Status Description
api_key string required

دریافتی از پنل کاربری شما که بعد از تایید درخواست درگاه صادر میشه API Key

amount Integer required مبلغ تراکنش به صورت ریالی و بزرگتر یا مساوی 1000
callback_url String required باید با آدرس درگاه پرداخت تایید شده در وندار بر روی یک دامنه باشد
mobile_number String optional شماره موبایل (اختیاری، جهت نمایش کارت های خریدار به ایشان و نمایش درگاه موبایلی )
factorNumber String optional شماره فاکتور شما (اختیاری)
description String optional توضیحات (اختیاری، حداکثر 255 کاراکتر)

Example request:

curl --request POST \
--url https://vandar.io/api/ipg/2step/send \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--form api_key=API_KEY \
--form amount=10000 \
--form callback_url=https://dash.paperpiano.ir/callback \
--form mobile_number= \
--form factorNumber= \
--form description=
var client = new RestClient("https://vandar.io/api/ipg/2step/send");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n10000\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"callback_url\"\r\n\r\nhttps://dash.paperpiano.ir/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobile_number\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"factorNumber\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://vandar.io/api/ipg/2step/send"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n10000\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"callback_url\"\r\n\r\nhttps://dash.paperpiano.ir/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobile_number\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"factorNumber\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("content-type", "multipart/form-data")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))

}
HttpResponse response = Unirest.post("https://vandar.io/api/ipg/2step/send")
	.header("content-type", "multipart/form-data")
	.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n10000\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"callback_url\"\r\n\r\nhttps://dash.paperpiano.ir/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobile_number\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"factorNumber\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
	.asString();
var http = require("https");

var options = {
"method": "POST",
"hostname": "vandar.io",
"port": null,
"path": "/api/ipg/2step/send",
"headers": {
"content-type": "multipart/form-data",
"content-length": "0"
}
};

var req = http.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n10000\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"callback_url\"\r\n\r\nhttps://dash.paperpiano.ir/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobile_number\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"factorNumber\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://vandar.io/api/ipg/send/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n10000\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"callback_url\"\r\n\r\nhttps://dash.paperpiano.ir/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobile_number\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"factorNumber\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => array(
"content-type: multipart/form-data"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import http.client

conn = http.client.HTTPSConnection("vandar.io")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n10000\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"callback_url\"\r\n\r\nhttps://dash.paperpiano.ir/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobile_number\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"factorNumber\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

headers = {
'content-type': "multipart/form-data"
}

conn.request("POST", "/api/ipg/2step/send", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://vandar.io/api/ipg/2step/send")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\nAPI_KEY\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"amount\"\r\n\r\n10000\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"callback_url\"\r\n\r\nhttps://dash.paperpiano.ir/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mobile_number\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"factorNumber\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "token": "Payment Token"
}

Example response (400):

{
  "status": 0,
  "errors": [
    "وارد کردن api key الزامی است",
    "api_key معتبر نیست",
    "IP پذیرنده معتبر نیست",
    "وارد کردن callback_url الزامی است",
    "callback_url معتبر نیست",
    "وارد کردن amount الزامی است",
    "amount نباید کوچکتر از 1000 باشد",
    "amount باید عدد یا رشته‌ای از اعداد باشد"
  ]
}


انتقال

اگر در مرحله ارسال اطلاعات، اطلاعات ارسالی صحیح باشد و دو مقدار status و token را دریافت کرده باشید. باید کاربر را به شیوه‌ی زیر به درگاه redirect کنید. برای این کار باید عددی که در مرحله اول در متغیر {token} دریافت کردید را در آخر آدرس قرار دهید و کاربر را به URL ایجاد شده redirect کنید تا بلافاصله کاربر به درگاه پرداخت هدایت شده و سپس مرحله سوم را انجام دهید.


Example request:

url="https://vandar.io/ipg/2step//$token"
redirect_url=$(curl -Ls -o /dev/null -w %{url_effective} http://vandar.ir/ipg/iwjeoirjweiroj)
[Route("Vandar")]
    public class TestControllers:ControllerBase
    {
        [HttpGet()]
        public ActionResult GetAll(int bid){
               StringBuilder stringBuilder =new StringBuilder();
               stringBuilder.Append("https://vandar.io/ipg/2step/");
               stringBuilder.Append("token");
               string link =stringBuilder.ToString();
               return this.Redirect(link);
        }
redirectUrl = "https://vandar.io/ipg/2step/:token";
import (
    "net/http"
)
func redirect(w http.ResponseWriter, r *http.Request) {
    http.Redirect(w, r, redirectUrl , 301)
}
string go = "https://vandar.io/ipg/2step/{token}";
response.sendRedirect(go);
var go = "https://vandar.io/ipg/2step/{token}";
res.writeHead(301, { "Location": go });
$go = "https://vandar.io/ipg/2step/$result->token";
	header("Location: $go");
import requests
token = "TOKEN"
redirect_url = f"https://vandar.io/ipg/{token}"
requests.get(redirect_url, allow_redirects=True)

//for versions earlier than 3.6 make this:

import requests
token = "TOKEN"
redirect_url = "https://vandar.io/ipg/2step/{token}".format(token=token)
requests.get(redirect_url, allow_redirects=True)
url = "https://vandar.io/ipg/2step/:token" ;
redirect_to url;


بازگشت

مرحله سوم زمانی انجام می‌شود که کاربر از درگاه پرداخت برمی‌گردد. در این مرحله با توجه به نتیجه تراکنش و وضعیت آن، ما کاربر را به callback URL شما که در مرحله اول با پارامتر redirect ارسال کرده بودید هدایت می‌کنیم. توکنی که در مرحله اول صادر شده به صورت GET در آدرس بازگشتی و داده‌های تراکنش به صورت POST قابل دریافت است. نکته: برای دریافت اطلاعات تراکنش توصیه می‌شود از API دریافت اطلاعات تراکنش استفاده کنید.

Example request:

token="$(echo $redirect_url | cut -d/ -f5-6)"


verify() {
    api_key=$1
    token=$2
    curl --header "Content-Type: application/json" \
    --request POST \
    --data '{"api_key":"$api_key","token":"$token"}' \
    'https://vandar.io/api/ipg/verify',
  }
namespace modam.api.Controllers
{
    [Route("Vandar")]

    public class TestControllers:ControllerBase
    {

        [HttpGet("{token}")]
        public ActionResult GetAll(string token){
               StringBuilder stringBuilder =new StringBuilder();
               stringBuilder.Append("http://google.com/");
               stringBuilder.Append(token);
               string link =stringBuilder.ToString();
               return this.Redirect(link);
        }

//call verify method


    }
}
func handler(w http.ResponseWriter, r *http.Request) {
    theToken, ok := r.URL.Query()["token"]
    token := theToken[0]
}
//call verify method
token = URLDecoder.decode(uri.getQueryParameter(token), "UTF-8");
// Call Verify method
let requestSegments = req.path.split('/');
requestSegments.slice(-1)[0]

//call verify method 
$token = $_GET['token'];
//call verify method ;
import requests
try:
    from urllib.parse import urlparse
except ImportError:
    from urlparse import urlparse
res = requests.get("https://vandar.io/ipg/token")
parsed_url = urlparse(res.url)
url_path = parsed_url.path
# remove empty string for prevent APPEND_SLASH return
splitted_url = list(filter(None, url_path.split("/")))
token = splitted_url[-1]
params[:token];
//
call verify method

Example response (200):

{
  "status": 1,
  "amount": "10000",
  "transId": 155058785697,
  "refnumber": "GmshtyjwKSuZXT81+6o9nKIkOcW*****PY05opjBoF",
  "trackingCode": "23***6",
  "factorNumber": null,
  "mobile": null,
  "description": "description",
  "cardNumber": "603799******6299",
  "CID": "ECC1F6931DDC1B8A0892293774836F3FFAC4A3C9D34997405F340FCC1BDDED82",
  "paymentDate": "2019-02-19 18:21:50",
  "message": "Confirm requierd"
}

Example response (400):

{
  "status": 0,
  "errors": [
    "وارد کردن api key الزامی است",
    "api_key معتبر نیست",
    "IP پذیرنده معتبر نیست",
    "وارد کردن token الزامی است",
    "token معتبر نیست",
    "تراکنش با خطا مواجه شده است"
  ]
}


اطلاعات تراکنش

برای دریافت اطلاعات تراکنش از طریق API نکته: این روش برای دریافت اطلاعات تراکنش روش بسیار امن‌تری است.

Example request:

curl --request POST \
  --url https://vandar.io/api/ipg/2step/transaction \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
	"api_key" : "API_KEY",
	"token"	:	"TOKEN"
}'
var client = new RestClient("https://vandar.io/api/ipg/2step/transaction");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("accept", "application/json");
request.AddParameter("application/json", "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://vandar.io/api/ipg/2step/transaction"

	payload := strings.NewReader("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/octet-stream");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}");
Request request = new Request.Builder()
  .url("https://vandar.io/api/ipg/2step/transaction")
  .post(body)
  .addHeader("content-type", "application/json")
  .addHeader("accept", "application/json")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "vandar.io",
  "port": null,
  "path": "/api/ipg/2step/transaction",
  "headers": {
    "content-length": "89",
    "content-type": "application/json",
    "accept": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://vandar.io/api/ipg/2step/transaction",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("vandar.io")

payload = "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}"

headers = {
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("POST", "/api/ipg/2step/transaction", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://vandar.io/api/ipg/2step/transaction")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}"

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "amount": "10000",
  "transId": 155058785697,
  "refnumber": "GmshtyjwKSuZXT81+6o9nKIkOcW*****PY05opjBoF",
  "trackingCode": "23***6",
  "factorNumber": null,
  "mobile": null,
  "description": "description",
  "cardNumber": "603799******6299",
  "CID": "ECC1F6931DDC1B8A0892293774836F3FFAC4A3C9D34997405F340FCC1BDDED82",
  "paymentDate": "2019-02-19 18:21:50",
  "message": "Confirm requierd"
}

Example response (400):

{
  "status": 0,
  "errors": [
    "وارد کردن api key الزامی است",
    "api_key معتبر نیست",
    "IP پذیرنده معتبر نیست",
    "وارد کردن token الزامی است",
    "token معتبر نیست",
    "تراکنش با خطا مواجه شده است"
  ]
}


کانفرم

برای دریافت اطلاعات تراکنش از طریق API نکته: این روش برای دریافت اطلاعات تراکنش روش بسیار امن‌تری است.

Example request:

curl --request POST \
  --url https://vandar.io/api/ipg/2step/confirm \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
	"api_key" : "API_KEY",
	"token"	:	"TOKEN",
	"confirm" : 1
}'
var client = new RestClient("https://vandar.io/api/ipg/2step/confirm");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("accept", "application/json");
request.AddParameter("application/json", "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\",\n\t\"confirm\" : 1\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://vandar.io/api/ipg/2step/confirm"

	payload := strings.NewReader("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\",\n\t\"confirm\" : 1\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
HttpResponse response = Unirest.post("https://vandar.io/api/ipg/2step/confirm")
    .header("content-type", "application/json")
    .header("accept", "application/json")
    .body("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\",\n\t\"confirm\" : 1\n}")
    .asString();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "vandar.io",
  "port": null,
  "path": "/api/ipg/2step/confirm",
  "headers": {
    "content-length": "105",
    "content-type": "application/json",
    "accept": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\",\n\t\"confirm\" : 1\n}");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://vandar.io/api/ipg/2step/confirm",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\",\n\t\"confirm\" : 1\n}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("vandar.io")

payload = "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\",\n\t\"confirm\" : 1\n}"

headers = {
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("POST", "/api/ipg/2step/confirm", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://vandar.io/api/ipg/2step/confirm")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\",\n\t\"confirm\" : 1\n}"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "message": "تراکنش تایید شد"
  }

Example response (400):

{
  "status": 0,
  "errors": [
    "وارد کردن api key الزامی است",
    "api_key معتبر نیست",
    "IP پذیرنده معتبر نیست",
    "وارد کردن token الزامی است",
    "token معتبر نیست",
    "نتیجه تراکنش قبلا از طرف وندار اعلام گردیده",
    "تراکنش با خطا مواجه شده است"
  ]
}


تایید

مهم: در صورت موفقیت‌آمیز بودن تراکنش، با فراخوانی متد verify، هر بار پیام verify تراکنش اعلام می‌شود. برای پیشگیری از بروز تقلب، پذیرنده باید قبل از ارائه محصول و خدمات با استفاده از شماره تراکنش شبکه پرداخت وندار (همان transId) از نبود شماره تراکنش در بانک اطلاعاتی خود اطمینان حاصل کند سپس خدمات را به مشتری ارائه نماید.

Example request:

curl --request POST \
  --url https://vandar.io/api/ipg/2step/verify \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{
	"api_key" : "API_KEY",
	"token"	:	"TOKEN"
}'
var client = new RestClient("https://vandar.io/api/ipg/2step/verify");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("accept", "application/json");
request.AddParameter("application/json", "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN+\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://vandar.io/api/ipg/2step/verify"

	payload := strings.NewReader("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN+\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
HttpResponse response = Unirest.post("https://vandar.io/api/ipg/2step/verify")
    .header("content-type", "application/json")
    .header("accept", "application/json")
    .body("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN+\"\n}")
    .asString();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "vandar.io",
  "port": null,
  "path": "/api/ipg/2step/verify",
  "headers": {
    "content-length": "90",
    "content-type": "application/json",
    "accept": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN+\"\n}");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://vandar.io/api/ipg/2step/verify",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN+\"\n}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("vandar.io")

payload = "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN\"\n}"

headers = {
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("POST", "/api/ipg/2step/verify", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://vandar.io/api/ipg/2step/verify")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\n\t\"api_key\" : \"API_KEY\",\n\t\"token\"\t:\t\"TOKEN+\"\n}"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "amount": "10000.00",
    "realAmount": 9500,
    "wage": "500",
    "transId": 159179532150,
    "factorNumber": "123",
    "mobile": "09123456789",
    "description": "تست",
    "cardNumber": "603799******7999",
    "paymentDate": "2020-06-10 17:53:43",
    "cid": "70250814486C876B51E11A74EBB5B31F8547B049DCC292BFF4F2C11906C7EED9",
    "message": "ok"
  }

Example response (400):

{
  "status": 0,
  "errors": [
    "وارد کردن api key الزامی است",
    "api_key معتبر نیست",
    "IP پذیرنده معتبر نیست",
    "وارد کردن token الزامی است",
    "token معتبر نیست",
    "نتیجه تراکنش قبلا از طرف وندار اعلام گردیده",
    "تراکنش با خطا مواجه شده است"
  ]
}


احراز هویت

دریافت توکن

برای فراخوانی دیگر متدهای وندار نیاز است که اولین بار ابتدا دریافت توکن فراخوانی شود، همچنین با توجه به عمر پنج روزه‌ی هر توکن توصیه می‌شود هر چهار روز یک بار دریافت توکن مجددا فراخوانی گردد. با فراخوانی این سرویس اطلاعات کاربری و توکن مورد نیاز برای استفاده در هدر دیگر سرویس‌ها، بازگردانده می‌شود.

پارامترهای ورودی

Parameter Type Status Description
mobile string required شماره موبایل ثبت شده در وندار
password string required رمز عبور حساب کاربری وندار

Example request:

POST /v2/login HTTP/1.1
Host: api.vandar.io
Accept: application/json

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="mobile"

09123456789
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="password"

PASSWORD
----WebKitFormBoundary7MA4YWxkTrZu0gW
var client = new RestClient("https://api.vandar.io/v2/login");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AlwaysMultipartFormData = true;
request.AddParameter("mobile", "09123456789");
request.AddParameter("password", "PASSWORD");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2/login"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  _ = writer.WriteField("mobile", "09123456789")
  _ = writer.WriteField("password", "PASSWORD")
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
  }
  req.Header.Add("Accept", "application/json")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  defer res.Body.Close()
  body, err := ioutil.ReadAll(res.Body)

  fmt.Println(string(body))
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("mobile", "09123456789")
  .addFormDataPart("password", "PASSWORD")
  .build();
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2/login")
  .method("POST", body)
  .build();
Response response = client.newCall(request).execute();
var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'api.vandar.io',
  'path': '/v2/login',
  'headers': {
    'Cookie': '__cfduid=d6d9fb9975fca890bf0befd2032fe0ca91589005944'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"mobile\"\r\n\r\n09123456789\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"password\"\r\n\r\nPASSWORD\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";

req.setHeader('content-type', 'multipart/form-data');

req.write(postData);

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2/login",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('mobile' => '09123456789','password' => 'PASSWORD'),
  CURLOPT_HTTPHEADER => array(
    "Cookie: COOKIE"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import requests

url = "https://api.vandar.io/v2/login"

payload = {'mobile': '09123456789',
'password': 'PASSWORD'}
files = [

]
headers = {
  'Cookie': 'COOKIE'
}

response = requests.request("POST", url, headers=headers, data = payload, files = files)

print(response.text.encode('utf8'))
require "uri"
require "net/http"

url = URI("https://api.vandar.io/v2/login")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Post.new(url)
form_data = [['mobile', '09123456789'],['password', 'PASSWORD']]
request.set_form form_data, 'multipart/form-data'
response = https.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
        "token": "token",
        "user": {
            "name": "مریم نبیان",
            "fname": "مریم",
            "lname": "نبیان",
            "email": "maryam@example.com",
            "national_code": "0123456789",
            "mobile": "0123456789",
            "avatar": null,
            "address": null,
            "postal_code": "0123456789",
            "phone_number": null,
            "wallet": 0,
            "blocked_amount": 0,
            "deductible_amount": 0,
            "birthdate": "1372/7/8",
            "birthdate_year": 1372,
            "birthdate_month": 7,
            "birthdate_day": 8,
            "telegram_chat_id": 0,
            "meta": {
                "onboarding": false,
                "notification": {
                    "transaction": {
                        "sms": true,
                        "email": true,
                        "telegram": false,
                        "notif": true
                    },
                    "settlement": {
                        "sms": true,
                        "email": true,
                        "telegram": false,
                        "notif": true
                    },
                    "ticket": {
                        "sms": true,
                        "email": true,
                        "telegram": false,
                        "notif": true
                    },
                    "auth": {
                        "sms": true,
                        "email": true,
                        "telegram": false,
                        "notif": true
                    }
                }
            },
            "statusBox": {
                "kyc": true,
                "shahkar": false,
                "mobile": "accepted",
                "email": "accepted",
                "personal_information": "accepted",
                "mobile_owner_national_card": false
            },
            "invitation": null,
            "status": 1,
            "notification_count": 6,
            "is_whats_new_exists": false,
            "tools": {
                "requestMoney": {
                    "is_enabled": true,
                    "is_created": false
                }
            },
            "business_count": 1,
            "created_at": {
                "date": "2020-05-10 11:59:43.000000",
                "timezone_type": 3,
                "timezone": "Asia/Tehran"
            },
            "updated_at": {
                "date": "2020-05-10 12:12:08.000000",
                "timezone_type": 3,
                "timezone": "Asia/Tehran"
            }
        }
    }
}

Example response (400):

{
    "status": 0,
    "error": "نام کاربری یا رمز عبور اشتباه وارد شده است"
}

کسب و کارها

لیست

با استفاده از این متد می‌توانید اطلاعات یک کسب‌وکار و لیستی از کسب‌وکارها وهمچنین لیست کاربران کسب‌وکار را مشاهده کنید.

Example request:

curl --request GET \
  --url https://api.vandar.io/v2/business \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
var client = new RestClient("https://api.vandar.io/v2/business");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.vandar.io/v2/business"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
	req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.vandar.io/v2/business")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2/business",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2/business",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2/business", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2/business")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": [
        {
            "id": null,
            "business_name": "personal",
            "business_name_fa": "حساب شخصی",
            "national_code": "00******35",
            "business_type": "personal",
            "phone_number": null,
            "postal_code": "0123456789",
            "address": null,
            "wallet": 0,
            "avatar": "users/default.png",
            "city_id": null,
            "mcc_code": null,
            "national_id": null,
            "legal_business_name": null,
            "today_transactions": 0,
            "today_settlements": 0,
            "statusBox": {
                "kyc": true,
                "shahkar": false,
                "mobile": "accepted",
                "email": "accepted",
                "personal_information": "accepted",
                "mobile_owner_national_card": false
            }
        },
        {
            "id": 662,
            "active": 1,
            "business_name": "your business name",
            "business_name_fa": "مریم",
            "legal_business_name": null,
            "national_id": null,
            "business_type": "personal",
            "phone_number": "88****22",
            "postal_code": "0123456789",
            "city_id": "8-6",
            "mcc_code": "15200002",
            "address": "تهران میدان آزادی",
            "wallet": 1050,
            "deductible_amount": "10500",
            "blocked_amount": 0,
            "avatar": "businesses/avatars/iz3giCpBWyoj7CYoalqulFX3RyQ63CMkbxFvQ5Zn.png",
            "statusBox": {
                "payment_required": false,
                "national_card_photo": "accepted",
                "official_Newspaper": "accepted",
                "introduction_letter": "accepted"
            },
            "status": 1,
            "today_transactions": 0,
            "today_settlements": 0,
            "role_name": "مالک",
            "role": "owner",
            "permissions": [
                "business_setting",
                "add_iban",
                "remove_iban",
                "view_dashboard",
                "create_request_forms",
                "view_gateway_ipgs",
                "create_gateway_ipgs",
                "edit_gateway_ipgs",
                "view_transactions_report",
                "view_settlements",
                "add_settlements",
                "edit_settlements",
                "view_request_forms"
            ],
            "tools": {
                "ipg": {
                    "is_enabled": true,
                    "is_created": true
                },
                "subscription": {
                    "is_enabled": false,
                    "is_created": null
                },
                "requestMoney": {
                    "is_enabled": true,
                    "is_created": false
                },
                "api": {
                    "is_enabled": false,
                    "is_created": null
                },
                "customer": {
                    "is_enabled": false,
                    "is_created": null
                },
                "log": {
                    "is_enabled": true,
                    "is_created": null
                }
            }
        }
    ]
}

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


اطلاعات

با استفاده از این متد می‌توانید اطلاعات یک کسب‌وکار و لیستی از کسب‌وکارها وهمچنین لیست کاربران کسب‌وکار را مشاهده کنید. نکته: به جای {business} نام کسب‌وکار ثبت شده خود در وندار را بنویسید.

Example request:

curl --request GET \
  --url https://api.vandar.io/v2/business/{your business name} \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token} \
var client = new RestClient("https://api.vandar.io/v2/business/{your business name}");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data);
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.vandar.io/v2/business/{your business name}"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.vandar.io/v2/business/{your business name}")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2/business/{your business name}",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2/business/{your business name}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2/business/{your business name}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2/business/{your business name}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "id": 662,
      "active": 1,
      "business_name": "your business name",
      "business_name_fa": "مریم",
      "legal_business_name": null,
      "national_id": 14******36,
      "business_type": "personal",
      "phone_number": "88****22",
      "postal_code": "01******89",
      "city_id": "8-6",
      "mcc_code": "15200002",
      "address": "تهران میدان آزادی",
      "wallet": 1050,
      "deductible_amount": "10500",
      "blocked_amount": 0,
      "avatar": "businesses\/avatars\/iz3giCpBWyoj7CYoalqulFX3RyQ63CMkbxFvQ5Zn.png",
      "statusBox": {
        "payment_required": false,
        "national_card_photo": "accepted",
        "official_Newspaper": "accepted",
        "introduction_letter": "accepted"
      },
      "status": 1,
      "today_transactions": 0,
      "today_settlements": 0,
      "role_name": "برنامه نویس",
      "role": "owner",
      "permissions": [
        "business_setting",
        "add_iban",
        "remove_iban",
        "view_dashboard",
        "create_request_forms",
        "view_gateway_ipgs",
        "create_gateway_ipgs",
        "edit_gateway_ipgs",
        "view_transactions_report",
        "view_settlements",
        "add_settlements",
        "edit_settlements",
        "view_request_forms"
      ],
      "tools": {
        "ipg": {
          "is_enabled": true,
          "is_created": true
        },
        "subscription": {
          "is_enabled": false,
          "is_created": null
        },
        "requestMoney": {
          "is_enabled": true,
          "is_created": false
        },
        "api": {
          "is_enabled": false,
          "is_created": null
        },
        "customer": {
          "is_enabled": false,
          "is_created": null
        },
        "log": {
          "is_enabled": true,
          "is_created": null
        }
      }
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


کاربران

Example request:

curl --request GET \
  --url https://api.vandar.io/v2/business/{your business name}/iam \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
var client = new RestClient("https://api.vandar.io/v2/business/{your business name}/iam");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.vandar.io/v2/business/{your business name}/iam"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.vandar.io/v2/business/{your business name}/iam")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2/business/{your business name}/iam",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2/business/{your business name}/iam",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2/business/{your business name}/iam", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2/business/{your business name}/iam")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "users": [
        {
          "name": "مریم نبیان",
          "avatar": "https://vandar.io/storage/users/default.png",
          "role": "مالک کسب و کار",
          "status": 1,
          "role_id": 0,
          "id": null
        }
      ]
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}

شماره شبا

لیست

Example request:

curl --request GET \
  --url https://api.vandar.io/v2.1/business/{your business name}/iban \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/iban");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/iban"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006");
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}")
  .delete(body)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/iban",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/iban",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2.1/business/{your business name}/iban", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/iban")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "data": [
        {
          "account_number": "0302331963008",
          "account_description": "حساب فعال است",
          "id": "5f028240-9297-11ea-b042-37166adc2fe7",
          "IBAN": "IR610620000000302331963008",
          "account_owner": [
            {
              "firstName": "رضا",
              "lastName": "عباسی"
            }
          ],
          "bank_name": "آینده"
        }
      ],
      "links": {
        "first": "https://api.vandar.io/v2.1/business/{your business name}/iban?page=1",
        "last": "https://api.vandar.io/v2.1/business/{your business name}/iban?page=1",
        "prev": null,
        "next": null
      },
      "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://api.vandar.io/v2.1/business/{your business name}/iban",
        "per_page": 20,
        "to": 1,
        "total": 1
      }
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


ذخیره

پارامترهای ورودی

Parameter Type Status Description
IBAN string required شماره شبا جدید

Example request:

curl --request POST \
  --url https://api.vandar.io/v2.1/business/{your business name}/iban/store \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
  --cookie __cfduid=d59bce9bad3db5171daea67d5f088a1f01561364362 \
  --form IBAN=IR060620000000******024006 \
  --form =
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006")

	req, _ := http.NewRequest("DELETE", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006");
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}")
  .delete(body)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{youe business name}/iban/store",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/iban/store",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006"

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("POST", "/v2.1/business/{your business name}/iban/store", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/iban/store")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "iban": {
        "id": "4a878700-a275-11ea-a62f-5727e08e281a",
        "account_number": "0201209024006",
        "account_description": "حساب فعال است",
        "IBAN": "IR060620000000201209024006",
        "account_owner": [
          {
            "firstName": "مرجان",
            "lastName": "آشفته"
          }
        ],
        "bank_name": "آینده"
      }
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


حذف

Example request:

curl --request DELETE \
  --url https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid} \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
  --form IBAN=IR060620000000******024006
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006")

	req, _ := http.NewRequest("DELETE", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006");
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}")
  .delete(body)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "DELETE",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/iban/{uuid}",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006"

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("DELETE", "/v2.1/business/{your business name}/iban/{uuid}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/iban/{uuid}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"IBAN\"\r\n\r\nIR060620000000201209024006"

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "message": "شماره شبا با موفقیت حذف شد."
}

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


صورت‌حساب

موجودی

Example request:

curl --request GET \
  --url https://api.vandar.io/v2/business/{your business name}/balance \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
var client = new RestClient("https://api.vandar.io/v2/business/{your business name}/balance");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2/business/{your business name}/balance"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.vandar.io/v2/business/{your business name}/balance")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2/business/{your business name}/balance",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2/business/{your business name}/balance",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2/business/{your business name}/balance", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2/business/{your business name}/balance")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "data": {
    "wallet": 2994800,
    "currency": "Toman"
  }
}

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


گزارش صورت‌حساب

پارامترهای ورودی

Parameter Status Description
fromDate optional شروع بازه زمانی
toDate optional پایان بازه زمانی
statusKind optional transactions or settlement
status optional succeed, failed, pending or canceled.
channel optional ipg, form.
ref_id optional search by ref id.
tracking_code optional search by tracking code.
per_page optional تعداد بازگشتی تراکنش ها در هر صفحه

Example request:

curl --request GET \
  --url https://api.vandar.io/v2/business/{your business name}/transaction \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
var client = new RestClient("https://api.vandar.io/v2/business/{your business name}/transaction");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2/business/{your business name}/transaction"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.vandar.io/v2/business/{your business name}/transaction")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2/business/{your business name}/transaction",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2/business/{your business name}/transaction",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPSConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2/business/{your business name}/transaction", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2/business/{your business name}/transaction")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer token'

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "current_page": 1,
      "data": [
        {
          "id": 159076258459,
          "amount": 1100,
          "wage": 50,
          "status": 1,
          "ref_id": "GmshtyjwKSsLw1ssW/7Ao12oqM/xka0FoeCAztK1D6",
          "tracking_code": "23986",
          "card_number": "603799******7999",
          "cid": "70250814486C876B51E11A74EBB5B31F8547B049DCC292BFF4F2C11906C7EED9",
          "verified": 1,
          "channel": "پرداخت اینترنتی",
          "payment_date": "19:00:39 - 1399/3/9",
          "created_at": "18:59:44 - 1399/3/9",
          "wallet": 1050,
          "result": "تراکنش موفق",
          "description": "خرید به شماره سفارش : 95 | خریدار : sdd dsd | محصولات : کفش (1)",
          "factorNumber": null,
          "mobile": null,
          "callback_url": "http://localhost/madule/wc-api/WC_Vandar/?wc_order=95",
          "form_title": null,
          "settlement": null,
          "payer": {
            "ip": "2.176.11.126",
            "name": null,
            "email": null,
            "phone": null,
            "address": null,
            "mobile": null,
            "description": "خرید به شماره سفارش : 95 | خریدار : sdd dsd | محصولات : کفش (1)"
          },
          "receiver": {
            "name": null,
            "iban": null,
            "bank_name": null
          }
        },

      ],
      "first_page_url": "https://api.vandar.io/v2/business/{your business name}/transaction?page=1",
      "from": 1,
      "last_page": 19,
      "last_page_url": "https://api.vandar.io/v2/business/{your business name}/transaction?page=19",
      "next_page_url": "https://api.vandar.io/v2/business/{your business name}/transaction?page=2",
      "path": "https://api.vandar.io/v2/business/{your business name}/transaction",
      "per_page": 10,
      "prev_page_url": null,
      "to": 10,
      "total": 186
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


تسویه با آیدی شبا

لیست

Example request:

curl --request GET \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'
var client = new RestClient("https://api.vandar.io/v2.1/business/your business name/settlement");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/settlement"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/settlement")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/settlement",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2.1/business/{your business name}/settlement", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "wallet": 26099,
      "blocked_amount": 0,
      "deductible_amount": 26099,
      "currency": "Toman",
      "settlements": {
        "data": [
          {
            "id": "8edaa0a0-a33f-11ea-838d-676dce32760e",
            "iban_id": 22822,
            "gateway_transaction_id": 159024236678,
            "amount": 100000,
            "payment_number": null,
            "status": "CANCELED",
            "wallet": 160985,
            "settlement_date": "2020-05-31"
          },
          {
            "id": "807003f0-8398-11ea-a42b-ede62b9de0c1",
            "iban_id": 902,
            "gateway_transaction_id": 158745010355,
            "amount": 50000,
            "payment_number": null,
            "status": "DONE",
            "wallet": 99485,
            "settlement_date": "2020-04-21"
          },
          {
            "id": "010a7850-82ff-11ea-85bd-49ef214903e3",
            "iban_id": 902,
            "gateway_transaction_id": 158738422601,
            "amount": 68000000,
            "payment_number": null,
            "status": "DONE",
            "wallet": 126485,
            "settlement_date": "2020-04-21"
          },
          {
            "id": "53665740-82cf-11ea-baf3-95ebee6a9eca",
            "iban_id": 26,
            "gateway_transaction_id": 158736374134,
            "amount": 15000000,
            "payment_number": null,
            "status": "CANCELED",
            "wallet": 43126485,
            "settlement_date": "2020-04-21"
          },
          {
            "id": "456afdb0-82cf-11ea-8e13-3183b5b1630b",
            "iban_id": 7215,
            "gateway_transaction_id": 158736367341,
            "amount": 5000000,
            "payment_number": null,
            "status": "CANCELED",
            "wallet": 58126485,
            "settlement_date": "2020-04-21"
          }
        ],
        "first": "https:\/\/api.settlement.vandar.io\/v1\/settlements?page=1",
        "last": "https:\/\/api.settlement.vandar.io\/v1\/settlements?page=19",
        "prev": null,
        "next": "https:\/\/api.settlement.vandar.io\/v1\/settlements?page=2",
        "current_page": 1,
        "from": 1,
        "last_page": 19,
        "path": "https:\/\/api.settlement.vandar.io\/v1\/settlements",
        "per_page": 5,
        "to": 5,
        "total": 93
      }
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


ذخیره

پارامترهای ورودی

Parameter Type Status Description
amount integer required مبلع (تومان)
iban_id integer required شناسه شماره شبا
payment_number integer optional شناسه واریز

Example request:

curl --request POST \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement/store \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
  --header 'content-type: application/json' \
  --data '{
	"iban" : "IR060620000000******024006",
	"amount" : 5000
}'
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/settlement/store");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer {token}");
request.AddParameter("application/json", "{\n\t\"iban\" : \"IR060620000000******024006\",\n\t\"amount\" : 5000\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/settlement/store"

	payload := strings.NewReader("{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}");
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/settlement/store")
  .post(body)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/settlement/store",
  "headers": {
    "content-length": "60",
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ iban: 'IR060620000000******024006', amount: 5000 }));
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement/store",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"iban\" : \"IR060620000000******024006\",\n\t\"amount\" : 5000\n}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = "{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}"

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'authorization': "Bearer {token}"
    }

conn.request("POST", "/v2.1/business/{your business name}/settlement/store", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement/store")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer {token}'
request.body = "{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "settlement": [
        {
          "id": "b6c72d20-a4ba-11ea-8a6c-9dc8b4b708ac",
          "iban_id": "b6b5c440-a4ba-11ea-837b-bf6e427ec6d0",
          "transaction_id": 159100434426,
          "amount": 50000,
          "payment_number": null,
          "status": "PENDING",
          "wallet": 60985,
          "settlement_date": "2020-06-02",
          "settlement_date_jalali": "1399\/03\/13"
        }
      ]
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


نمایش

Example request:

curl --request GET \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
  --form =
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddHeader("authorization", "Bearer {token}");
request.AddParameter("multipart/form-data", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{yourbusiness name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n");
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/settlement/{id}")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
<
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2/business/{your business name}/settlement/{id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement/{id}")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "settlement": {
        "id": "8edaa0a0-a33f-11ea-838d-676dce32760e",
        "iban_id": 22822,
        "gateway_transaction_id": 159024236678,
        "amount": 100000,
        "payment_number": null,
        "status": "CANCELED",
        "wallet": 160985,
        "settlement_date": "2020-05-31"
      }
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


حذف

Example request:

curl --request DELETE \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement/159024236678 \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/settlement/{transaction_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/settlement/159024236678"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{base_url}/v2.1/business/{your business name}/settlement/{transaction_id}")
  .delete(null)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "DELETE",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/settlement/{transaction_id}",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer token"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement/{transaction_id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("DELETE", "/v2.1/business/{your business name}/settlement/{transaction_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement/159024236678")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "message": "درخواست تسویه شما از دستور پرداخت خارج شد و وجه تسویه به حساب شما برگشت داده شد"
}

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


تسویه با شماره شبا

لیست

نکته : پارامتر deductible_amount نشان دهنده مبلغ قابل برداشت می باشد. و پارامتر blocked_amount نشان دهنده مبلغ مسدود شده در حساب می باشد.

Example request:

curl --request GET \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'
var client = new RestClient("https://api.vandar.io/v2.1/business/your business name/settlement");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/settlement"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/settlement")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/settlement",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2.1/business/{your business name}/settlement", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "wallet": 26099,
      "blocked_amount": 0,
      "deductible_amount": 26099,
      "currency": "Toman",
      "settlements": {
        "data": [
          {
            "id": "8edaa0a0-a33f-11ea-838d-676dce32760e",
            "iban_id": 22822,
            "gateway_transaction_id": 159024236678,
            "amount": 100000,
            "payment_number": null,
            "status": "CANCELED",
            "wallet": 160985,
            "settlement_date": "2020-05-31"
          },
          {
            "id": "807003f0-8398-11ea-a42b-ede62b9de0c1",
            "iban_id": 902,
            "gateway_transaction_id": 158745010355,
            "amount": 50000,
            "payment_number": null,
            "status": "DONE",
            "wallet": 99485,
            "settlement_date": "2020-04-21"
          },
          {
            "id": "010a7850-82ff-11ea-85bd-49ef214903e3",
            "iban_id": 902,
            "gateway_transaction_id": 158738422601,
            "amount": 68000000,
            "payment_number": null,
            "status": "DONE",
            "wallet": 126485,
            "settlement_date": "2020-04-21"
          },
          {
            "id": "53665740-82cf-11ea-baf3-95ebee6a9eca",
            "iban_id": 26,
            "gateway_transaction_id": 158736374134,
            "amount": 15000000,
            "payment_number": null,
            "status": "CANCELED",
            "wallet": 43126485,
            "settlement_date": "2020-04-21"
          },
          {
            "id": "456afdb0-82cf-11ea-8e13-3183b5b1630b",
            "iban_id": 7215,
            "gateway_transaction_id": 158736367341,
            "amount": 5000000,
            "payment_number": null,
            "status": "CANCELED",
            "wallet": 58126485,
            "settlement_date": "2020-04-21"
          }
        ],
        "first": "https:\/\/api.settlement.vandar.io\/v1\/settlements?page=1",
        "last": "https:\/\/api.settlement.vandar.io\/v1\/settlements?page=19",
        "prev": null,
        "next": "https:\/\/api.settlement.vandar.io\/v1\/settlements?page=2",
        "current_page": 1,
        "from": 1,
        "last_page": 19,
        "path": "https:\/\/api.settlement.vandar.io\/v1\/settlements",
        "per_page": 5,
        "to": 5,
        "total": 93
      }
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


ذخیره

پارامترهای ورودی

Parameter Type Status Description
amount integer required مبلع (تومان)
iban string required شماره شبا
payment_number integer optional شناسه واریز

Example request:

curl --request POST \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement/store \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
  --header 'content-type: application/json' \
  --data '{
	"iban" : "IR060620000000******024006",
	"amount" : 5000
}'
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/settlement/store");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer {token}");
request.AddParameter("application/json", "{\n\t\"iban\" : \"IR060620000000******024006\",\n\t\"amount\" : 5000\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/settlement/store"

	payload := strings.NewReader("{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}");
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/settlement/store")
  .post(body)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/settlement/store",
  "headers": {
    "content-length": "60",
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ iban: 'IR060620000000******024006', amount: 5000 }));
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement/store",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"iban\" : \"IR060620000000******024006\",\n\t\"amount\" : 5000\n}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = "{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}"

headers = {
    'accept': "application/json",
    'content-type': "application/json",
    'authorization': "Bearer {token}"
    }

conn.request("POST", "/v2.1/business/{your business name}/settlement/store", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement/store")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer {token}'
request.body = "{\n\t\"iban\" : \"IR060620000000201209024006\",\n\t\"amount\" : 5000\n}"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "settlement": [
        {
          "id": "b6c72d20-a4ba-11ea-8a6c-9dc8b4b708ac",
          "iban_id": "b6b5c440-a4ba-11ea-837b-bf6e427ec6d0",
          "transaction_id": 159100434426,
          "amount": 50000,
          "payment_number": null,
          "status": "PENDING",
          "wallet": 60985,
          "settlement_date": "2020-06-02",
          "settlement_date_jalali": "1399\/03\/13"
        }
      ]
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


نمایش

Example request:

curl --request GET \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}' \
  --form =
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddHeader("authorization", "Bearer {token}");
request.AddParameter("multipart/form-data", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{yourbusiness name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n");
Request request = new Request.Builder()
  .url("https://api.vandar.io/v2.1/business/{your business name}/settlement/{id}")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/settlement/{id}",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer {token}"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n");
req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement/8edaa0a0-a33f-11ea-838d-676dce32760e",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("GET", "/v2/business/{your business name}/settlement/{id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement/{id}")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n"

response = http.request(request)
puts response.read_body

Example response (200):

{
    "status": 1,
    "data": {
      "settlement": {
        "id": "8edaa0a0-a33f-11ea-838d-676dce32760e",
        "iban_id": 22822,
        "gateway_transaction_id": 159024236678,
        "amount": 100000,
        "payment_number": null,
        "status": "CANCELED",
        "wallet": 160985,
        "settlement_date": "2020-05-31"
      }
    }
  }

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


حذف

Example request:

curl --request DELETE \
  --url https://api.vandar.io/v2.1/business/{your business name}/settlement/159024236678 \
  --header 'accept: application/json' \
  --header 'authorization: Bearer {token}'
var client = new RestClient("https://api.vandar.io/v2.1/business/{your business name}/settlement/{transaction_id}");
var request = new RestRequest(Method.DELETE);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "multipart/form-data");
request.AddHeader("authorization", "Bearer {token}");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

  url := "https://api.vandar.io/v2.1/business/{your business name}/settlement/159024236678"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "multipart/form-data")
  req.Header.Add("authorization", "Bearer {token}")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("{base_url}/v2.1/business/{your business name}/settlement/{transaction_id}")
  .delete(null)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "multipart/form-data")
  .addHeader("authorization", "Bearer {token}")
  .build();

Response response = client.newCall(request).execute();
var http = require("https");

var options = {
  "method": "DELETE",
  "hostname": "api.vandar.io",
  "port": null,
  "path": "/v2.1/business/{your business name}/settlement/{transaction_id}",
  "headers": {
    "content-length": "0",
    "accept": "application/json",
    "content-type": "multipart/form-data",
    "authorization": "Bearer token"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.vandar.io/v2.1/business/{your business name}/settlement/{transaction_id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer {token}",
    "content-type: multipart/form-data"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import http.client

conn = http.client.HTTPConnection("api.vandar.io")

payload = ""

headers = {
    'accept': "application/json",
    'content-type': "multipart/form-data",
    'authorization': "Bearer {token}"
    }

conn.request("DELETE", "/v2.1/business/{your business name}/settlement/{transaction_id}", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.vandar.io/v2.1/business/{your business name}/settlement/159024236678")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'multipart/form-data'
request["authorization"] = 'Bearer {token}'

response = http.request(request)
puts response.read_body

Example response (200):

{
  "status": 1,
  "message": "درخواست تسویه شما از دستور پرداخت خارج شد و وجه تسویه به حساب شما برگشت داده شد"
}

Example response (401):

{
  "status": 0,
  "error": "Unauthenticated"
}


خطاها

The Vandar API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request sucks
401 Unauthorized -- Your token is wrong
403 Forbidden -- The kitten requested is hidden for administrators only
404 Not Found -- The specified kitten could not be found
405 Method Not Allowed -- You tried to access a kitten with an invalid method
406 Not Acceptable -- You requested a format that isn't json
410 Gone -- The kitten requested has been removed from our servers
418 I'm a teapot
422 Bad Request -- Your request sucks
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarially offline for maintanance. Please try again later.