Skip to content

Token

Açıklama:

API, üye iş yerini doğrulamak için diğer API'lerde kullanılacak bir token oluşturur. Ayrıca, üye işyeri için ayarlanan ödeme entegrasyon seçeneğini de döndürür. Yanıt anahtarı “is_3d” dir.

is_3d'nin olası değerleri:

  • 0 = Yalnızca whitelabel 2D
  • 1 = Whitelabel 2D veya 3D
  • 2 = Yalnızca whitelabel 3D
  • 3 = Markalı ödeme çözümü

Token API dönüşü 1 ise, üye işyeri web sitesinin kullanıcının 2D veya 3D'yi seçmesi için bir onay kutusu görüntülemesi gerekir.

Her token in geçerlilik süresi 2 saattir ve geçerliliğini koruyana kadar aynı token in kullanılması önem arz etmektedir. bu API 'yı çağırmaya gerek yoktur.

Aşağıdaki istek ve yanıt API örneğidir.

URL: /api/token

Test Sunucusu: https://test.vepara.com.tr/ccpayment/api/token

Canlı Sunucusu: https://app.vepara.com.tr/ccpayment/api/token

Method: POST

REQUEST BODY SCHEMA

json
{
  "type": "object",
  "properties": {
    "app_id": {
      "type": "string",
      "description": "app_id üye işyerine atanan benzersiz bir anahtardır."
    },
    "app_secret": {
      "type": "string",
      "description": "app_secret üye işyerine verilen benzersiz ve gizli bir anahtardır."
    }
  },
  "required": ["app_id"],
  "required" : ["app_secret"]
}

RESPONSE BODY

200 Başarılı Sonuç
json
{
  "status": "success",
  "message": "Token başarıyla alındı.",
  "data": {
    "token": "your generated token",
    "is_3d": 1,
    "expired_at": "2023-08-15 17:30:00"
  }
}
422 Başarısız Sonuç
json
{
  "message": "The app secret field must be a string. (and 1 more error)",
  "errors": {
    "app_secret": [
      "The app secret field must be a string.",
      "The app secret field is required."
    ]
  }
}

Kod Örnekleri

PHP Örneği
php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://test.vepara.com.tr/ccpayment/api/token',
  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 =>' {
 	"app_id":"20b619d1880b28f1780ae6c8a815343a",
 	"app_secret":"d35bfc94628963626f0f8958c95c4c10"
 }',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Accept: application/json',
    'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxNSIsImp0aSI6ImEyZTlkMzllYTcxMTRhMTE4ODY3NmQxNmNmMWZjYzNmYzcyYmJmYTBkYTRiNWZlMDRmZjFlNmY1ZmY4M2E4N2JiOTcyNzBlMWIyOTNhYjQ3IiwiaWF0IjoxNjkzMzExMjI5LjQ1ODcsIm5iZiI6MTY5MzMxMTIyOS40NTg3LCJleHAiOjE2OTMzMTg0MjkuNDUzMiwic3ViIjoiMzgyIiwic2NvcGVzIjpbXX0.GyabFvLN5JldPXpnX-q3bBUEcPWlVMxsoaGnB3-2Erxuk-aaezCCtbS6ccJpEgUF3TnWdLv3jCpRiFy0NvXpKVAfH5MCKGRoe1D6FDoa-aPHswqEd-avo5VfbT346S2nsHytYYWcFWGVuhrJ3ZprLP0GYdDCqMTJd4jV33_pyMET_J0VFuEdKNJ051F7JyhzSMysE5dsC-sdIRMENYtZzVnO41lr0FJmdLJjwiZSIBmf_0C3CRRwRD8qLkGnUITO13CJvLbx_Wgz4mrXe-CrlvuOtqybBqK24iiNDY2WIMjnRyYsi9QbMeenU46x4UlH9SSDVb0ypQRX5fI7oYx7v6yJE0kYmSX8SmOgFuTup-86Hmd52KfvRfn8lpV35Ul2tqWmhP5INhyP9klyuITmFyj4FjNkRBBFLJR-1jyCVdyL3XdwMNzxVcZA-QcHwOiaU1hBsuHlbWOY7E7SWt8nrn4Zz1OJVHuuiL5Fcrntik-r17pNIvmN7QZJl9hXcsM7hLNVZN79NnOiKhDx7Vn_q211YxVu-MEFG31o8-HEQ3XmGCqk2xydyuRKWE1jbl9CFsD1VYZ80Z1Xpb0AH2Wb3WbemQaWA0qlGTQo21vnVSTQK4KLwgzifdVl2aUQK0KqzCMph4TFaqv88Xvs46So0s1fazkLhysX1R6GYLfaQpU'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Ruby Örneği
ruby
require "uri"
require "json"
require "net/http"

url = URI("https://test.vepara.com.tr/ccpayment/api/token")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxNSIsImp0aSI6ImEyZTlkMzllYTcxMTRhMTE4ODY3NmQxNmNmMWZjYzNmYzcyYmJmYTBkYTRiNWZlMDRmZjFlNmY1ZmY4M2E4N2JiOTcyNzBlMWIyOTNhYjQ3IiwiaWF0IjoxNjkzMzExMjI5LjQ1ODcsIm5iZiI6MTY5MzMxMTIyOS40NTg3LCJleHAiOjE2OTMzMTg0MjkuNDUzMiwic3ViIjoiMzgyIiwic2NvcGVzIjpbXX0.GyabFvLN5JldPXpnX-q3bBUEcPWlVMxsoaGnB3-2Erxuk-aaezCCtbS6ccJpEgUF3TnWdLv3jCpRiFy0NvXpKVAfH5MCKGRoe1D6FDoa-aPHswqEd-avo5VfbT346S2nsHytYYWcFWGVuhrJ3ZprLP0GYdDCqMTJd4jV33_pyMET_J0VFuEdKNJ051F7JyhzSMysE5dsC-sdIRMENYtZzVnO41lr0FJmdLJjwiZSIBmf_0C3CRRwRD8qLkGnUITO13CJvLbx_Wgz4mrXe-CrlvuOtqybBqK24iiNDY2WIMjnRyYsi9QbMeenU46x4UlH9SSDVb0ypQRX5fI7oYx7v6yJE0kYmSX8SmOgFuTup-86Hmd52KfvRfn8lpV35Ul2tqWmhP5INhyP9klyuITmFyj4FjNkRBBFLJR-1jyCVdyL3XdwMNzxVcZA-QcHwOiaU1hBsuHlbWOY7E7SWt8nrn4Zz1OJVHuuiL5Fcrntik-r17pNIvmN7QZJl9hXcsM7hLNVZN79NnOiKhDx7Vn_q211YxVu-MEFG31o8-HEQ3XmGCqk2xydyuRKWE1jbl9CFsD1VYZ80Z1Xpb0AH2Wb3WbemQaWA0qlGTQo21vnVSTQK4KLwgzifdVl2aUQK0KqzCMph4TFaqv88Xvs46So0s1fazkLhysX1R6GYLfaQpU"
request.body = JSON.dump({
  "app_id": "20b619d1880b28f1780ae6c8a815343a",
  "app_secret": "d35bfc94628963626f0f8958c95c4c10"
})

response = https.request(request)
puts response.read_body
Python Örneği
python
import requests
import json

url = "https://test.vepara.com.tr/ccpayment/api/token"

payload = json.dumps({
  "app_id": "20b619d1880b28f1780ae6c8a815343a",
  "app_secret": "d35bfc94628963626f0f8958c95c4c10"
})
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxNSIsImp0aSI6ImEyZTlkMzllYTcxMTRhMTE4ODY3NmQxNmNmMWZjYzNmYzcyYmJmYTBkYTRiNWZlMDRmZjFlNmY1ZmY4M2E4N2JiOTcyNzBlMWIyOTNhYjQ3IiwiaWF0IjoxNjkzMzExMjI5LjQ1ODcsIm5iZiI6MTY5MzMxMTIyOS40NTg3LCJleHAiOjE2OTMzMTg0MjkuNDUzMiwic3ViIjoiMzgyIiwic2NvcGVzIjpbXX0.GyabFvLN5JldPXpnX-q3bBUEcPWlVMxsoaGnB3-2Erxuk-aaezCCtbS6ccJpEgUF3TnWdLv3jCpRiFy0NvXpKVAfH5MCKGRoe1D6FDoa-aPHswqEd-avo5VfbT346S2nsHytYYWcFWGVuhrJ3ZprLP0GYdDCqMTJd4jV33_pyMET_J0VFuEdKNJ051F7JyhzSMysE5dsC-sdIRMENYtZzVnO41lr0FJmdLJjwiZSIBmf_0C3CRRwRD8qLkGnUITO13CJvLbx_Wgz4mrXe-CrlvuOtqybBqK24iiNDY2WIMjnRyYsi9QbMeenU46x4UlH9SSDVb0ypQRX5fI7oYx7v6yJE0kYmSX8SmOgFuTup-86Hmd52KfvRfn8lpV35Ul2tqWmhP5INhyP9klyuITmFyj4FjNkRBBFLJR-1jyCVdyL3XdwMNzxVcZA-QcHwOiaU1hBsuHlbWOY7E7SWt8nrn4Zz1OJVHuuiL5Fcrntik-r17pNIvmN7QZJl9hXcsM7hLNVZN79NnOiKhDx7Vn_q211YxVu-MEFG31o8-HEQ3XmGCqk2xydyuRKWE1jbl9CFsD1VYZ80Z1Xpb0AH2Wb3WbemQaWA0qlGTQo21vnVSTQK4KLwgzifdVl2aUQK0KqzCMph4TFaqv88Xvs46So0s1fazkLhysX1R6GYLfaQpU'
}

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

print(response.text)
Nodejs Örneği
javascript
const axios = require('axios');
let data = JSON.stringify({
  "app_id": "20b619d1880b28f1780ae6c8a815343a",
  "app_secret": "d35bfc94628963626f0f8958c95c4c10"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://test.vepara.com.tr/ccpayment/api/token',
  headers: { 
    'Content-Type': 'application/json', 
    'Accept': 'application/json', 
    'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxNSIsImp0aSI6ImEyZTlkMzllYTcxMTRhMTE4ODY3NmQxNmNmMWZjYzNmYzcyYmJmYTBkYTRiNWZlMDRmZjFlNmY1ZmY4M2E4N2JiOTcyNzBlMWIyOTNhYjQ3IiwiaWF0IjoxNjkzMzExMjI5LjQ1ODcsIm5iZiI6MTY5MzMxMTIyOS40NTg3LCJleHAiOjE2OTMzMTg0MjkuNDUzMiwic3ViIjoiMzgyIiwic2NvcGVzIjpbXX0.GyabFvLN5JldPXpnX-q3bBUEcPWlVMxsoaGnB3-2Erxuk-aaezCCtbS6ccJpEgUF3TnWdLv3jCpRiFy0NvXpKVAfH5MCKGRoe1D6FDoa-aPHswqEd-avo5VfbT346S2nsHytYYWcFWGVuhrJ3ZprLP0GYdDCqMTJd4jV33_pyMET_J0VFuEdKNJ051F7JyhzSMysE5dsC-sdIRMENYtZzVnO41lr0FJmdLJjwiZSIBmf_0C3CRRwRD8qLkGnUITO13CJvLbx_Wgz4mrXe-CrlvuOtqybBqK24iiNDY2WIMjnRyYsi9QbMeenU46x4UlH9SSDVb0ypQRX5fI7oYx7v6yJE0kYmSX8SmOgFuTup-86Hmd52KfvRfn8lpV35Ul2tqWmhP5INhyP9klyuITmFyj4FjNkRBBFLJR-1jyCVdyL3XdwMNzxVcZA-QcHwOiaU1hBsuHlbWOY7E7SWt8nrn4Zz1OJVHuuiL5Fcrntik-r17pNIvmN7QZJl9hXcsM7hLNVZN79NnOiKhDx7Vn_q211YxVu-MEFG31o8-HEQ3XmGCqk2xydyuRKWE1jbl9CFsD1VYZ80Z1Xpb0AH2Wb3WbemQaWA0qlGTQo21vnVSTQK4KLwgzifdVl2aUQK0KqzCMph4TFaqv88Xvs46So0s1fazkLhysX1R6GYLfaQpU'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
C# Örneği
c#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://test.vepara.com.tr/ccpayment/api/token");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxNSIsImp0aSI6ImEyZTlkMzllYTcxMTRhMTE4ODY3NmQxNmNmMWZjYzNmYzcyYmJmYTBkYTRiNWZlMDRmZjFlNmY1ZmY4M2E4N2JiOTcyNzBlMWIyOTNhYjQ3IiwiaWF0IjoxNjkzMzExMjI5LjQ1ODcsIm5iZiI6MTY5MzMxMTIyOS40NTg3LCJleHAiOjE2OTMzMTg0MjkuNDUzMiwic3ViIjoiMzgyIiwic2NvcGVzIjpbXX0.GyabFvLN5JldPXpnX-q3bBUEcPWlVMxsoaGnB3-2Erxuk-aaezCCtbS6ccJpEgUF3TnWdLv3jCpRiFy0NvXpKVAfH5MCKGRoe1D6FDoa-aPHswqEd-avo5VfbT346S2nsHytYYWcFWGVuhrJ3ZprLP0GYdDCqMTJd4jV33_pyMET_J0VFuEdKNJ051F7JyhzSMysE5dsC-sdIRMENYtZzVnO41lr0FJmdLJjwiZSIBmf_0C3CRRwRD8qLkGnUITO13CJvLbx_Wgz4mrXe-CrlvuOtqybBqK24iiNDY2WIMjnRyYsi9QbMeenU46x4UlH9SSDVb0ypQRX5fI7oYx7v6yJE0kYmSX8SmOgFuTup-86Hmd52KfvRfn8lpV35Ul2tqWmhP5INhyP9klyuITmFyj4FjNkRBBFLJR-1jyCVdyL3XdwMNzxVcZA-QcHwOiaU1hBsuHlbWOY7E7SWt8nrn4Zz1OJVHuuiL5Fcrntik-r17pNIvmN7QZJl9hXcsM7hLNVZN79NnOiKhDx7Vn_q211YxVu-MEFG31o8-HEQ3XmGCqk2xydyuRKWE1jbl9CFsD1VYZ80Z1Xpb0AH2Wb3WbemQaWA0qlGTQo21vnVSTQK4KLwgzifdVl2aUQK0KqzCMph4TFaqv88Xvs46So0s1fazkLhysX1R6GYLfaQpU");
var content = new StringContent(" {\n \t\"app_id\":\"20b619d1880b28f1780ae6c8a815343a\",\n \t\"app_secret\":\"d35bfc94628963626f0f8958c95c4c10\"\n }", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Vepara