Skip to content

Kart Kaydetme

Açıklama: Kart Kayıt servisi, kart bilgilerini Vepara Sisteminde saklamak ve bir tokenı geri göndermek için kullanılır. payByCardToken API 'de kullanılacak yanıt.

URL: /api/saveCard

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

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

Method: POST

REQUEST BODY SCHEMA

json
{
  "type": "object",
  "properties": {
    "merchant_key" : {
        "type": "string",
        "description": "Vepara tarafından sağlanan üye işyerinin benzersiz anahtarıdır."
    },
    "card_holder_name": {
        "type": "string",
        "description": "Kart üzerindeki isim"   
    },
    "card_number":{
      "type" : "string",
      "description" : "Kart Numarası"
    },
    "expiry_year": {
      "type": "string",
      "description": "Kart son kullanım yılı, dört haneli olmalı"
    },
    "expiry_mounth": {
      "type":"string",
      "description": "Kart son kullanım ayı"
    },
    "customer_number": {
       "type": "number|unique",
       "description": "Müşterinin numarası" 
    },
    "customer_name": {
       "type": "string",
       "description": "Müşterinin ismi" 
    },
    "customer_email": {
      "type": "string",
      "description": "Müşteri emaili"
    },
    "customer_phone": {
      "type":"string",
      "description": "Müşteri telefonu"
    },
    "hash_key": {
      "type": "string",
      "description": "işlemin bankaya ulaşmadan, kullanıcının ödemeyle ilgili değişiklikler yapamamasını ve ödemenin güvenli olarak tamamlanmasını sağlamaktadır. Aşağıda verilen hash anahtarını yazmak için kullanılan algoritma için tıklayınız veya sağ taraftaki PHP sekmesinden örneğini inceleyiniz."
    } 
  },
  "required": ["merchant_key"],
  "required": ["card_holder_name"],
  "required": ["card_number"],
  "required": ["expiry_year"],
  "required": ["expiry_mounth"],
  "required": ["customer_number"],
  "required": ["hash_key"],
}
200 Başarılı Sonuç
json

 {
    "status_code": 100,
    "status_description": "The card token saved successfully",
    "card_token": "fca2bc425fbd8b6c81031d60de5566ba"
 }
400 Başarısız Sonuç
json
{
    "status_code": 98,
    "status_description": "Merchant is not allowed for pay by token",
    "card_token": ""
}

Kod Örnekleri

PHP Örneği
php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://test.vepara.com.tr/ccpayment/api/saveCard',
  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 =>'{
    "card_holder_name": "Customer Postman",
    "card_number": "4508034508034509",
    "expiry_month": "12",
    "expiry_year": "2026",
    "merchant_key": "$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he",
    "customer_number": "",
    "hash_key": ""
}',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Content-Type: application/json',
    'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxOSIsImp0aSI6ImFkODMxYTUxYmU3MWEzMzAxYzQzN2I1MTU5MGY4OGJjMTZkZjRmODM4NjZhZGI5NmU3NmJkMzZjZjFjMmU1ZmM1ZDAxZWU5NTFkYjc4MjUxIiwiaWF0IjoxNjk1MjE3NDk2LjI0NjUsIm5iZiI6MTY5NTIxNzQ5Ni4yNDY1LCJleHAiOjE2OTUyMjQ2OTYuMjQwNywic3ViIjoiNiIsInNjb3BlcyI6W119.uXMULNGpNPfH4bLyraz5PV-cBgPM3JZlrRFW4PuGpDcop2HatY4YhKHviNf5-xkgor50iTyaCHYfTGEErNW-1wiWiddxSr62H-Nc7lHP9wRinZEEKFyeF3UbYG7lSAaLy1dTtICsnb3Sixw0XePqGyuAlKw9_gGQOzAmT0p6zQY1VsSzTROIG490G-Sk-CdAeAJS8z0eIgC9avXz2PZ4Esf5AnxH5k9IGX-nLaFnkGP28FdnM3nZMfD8-9OKkrS_uv6DU2uiWmdeZI1pIQknAigJUR2qAZDXa42xJfRfBqBmGA4Ugq-_aje4DzAX063CjHRFSzlWDTv189y2AOM3gCsXSP0UojFwq8KxdxREEj96X-5qebp93q59FevJJiMXmGDKRxwRiAONpXcTNwVXXbrSEerjybZUZRw_SOJxcb6Vmb2NREODqb13S-5bjFo11Lm8K40QBPmKjcc13RsAVb5g_D7Nc7wS3DSNSNxKIzMI8GF7hQPPVKRJ_Wb4_TwlEsPGlZ6HLXwEQ7u4F6KTh38aSvMW4a2Z8dOR9kONgRYdgltnPJ7Z6iUuUY_NHBdrX9q0CAm35R8-eUjOOu8XrX03CLsRLcAimCmZJEREev391yM4o2KLy-If6jBrJ0LGNSMNk0bC6_LGqzACyuZ6vltw84HpiKcPqmE4uXJxESg'
  ),
));

$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/saveCard")

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

request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxOSIsImp0aSI6ImFkODMxYTUxYmU3MWEzMzAxYzQzN2I1MTU5MGY4OGJjMTZkZjRmODM4NjZhZGI5NmU3NmJkMzZjZjFjMmU1ZmM1ZDAxZWU5NTFkYjc4MjUxIiwiaWF0IjoxNjk1MjE3NDk2LjI0NjUsIm5iZiI6MTY5NTIxNzQ5Ni4yNDY1LCJleHAiOjE2OTUyMjQ2OTYuMjQwNywic3ViIjoiNiIsInNjb3BlcyI6W119.uXMULNGpNPfH4bLyraz5PV-cBgPM3JZlrRFW4PuGpDcop2HatY4YhKHviNf5-xkgor50iTyaCHYfTGEErNW-1wiWiddxSr62H-Nc7lHP9wRinZEEKFyeF3UbYG7lSAaLy1dTtICsnb3Sixw0XePqGyuAlKw9_gGQOzAmT0p6zQY1VsSzTROIG490G-Sk-CdAeAJS8z0eIgC9avXz2PZ4Esf5AnxH5k9IGX-nLaFnkGP28FdnM3nZMfD8-9OKkrS_uv6DU2uiWmdeZI1pIQknAigJUR2qAZDXa42xJfRfBqBmGA4Ugq-_aje4DzAX063CjHRFSzlWDTv189y2AOM3gCsXSP0UojFwq8KxdxREEj96X-5qebp93q59FevJJiMXmGDKRxwRiAONpXcTNwVXXbrSEerjybZUZRw_SOJxcb6Vmb2NREODqb13S-5bjFo11Lm8K40QBPmKjcc13RsAVb5g_D7Nc7wS3DSNSNxKIzMI8GF7hQPPVKRJ_Wb4_TwlEsPGlZ6HLXwEQ7u4F6KTh38aSvMW4a2Z8dOR9kONgRYdgltnPJ7Z6iUuUY_NHBdrX9q0CAm35R8-eUjOOu8XrX03CLsRLcAimCmZJEREev391yM4o2KLy-If6jBrJ0LGNSMNk0bC6_LGqzACyuZ6vltw84HpiKcPqmE4uXJxESg"
request.body = JSON.dump({
  "card_holder_name": "Customer Postman",
  "card_number": "4508034508034509",
  "expiry_month": "12",
  "expiry_year": "2026",
  "merchant_key": "$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he",
  "customer_number": "",
  "hash_key": ""
})

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

conn = http.client.HTTPSConnection("test.vepara.com.tr")
payload = json.dumps({
  "card_holder_name": "Customer Postman",
  "card_number": "4508034508034509",
  "expiry_month": "12",
  "expiry_year": "2026",
  "merchant_key": "$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he",
  "customer_number": "",
  "hash_key": ""
})
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxOSIsImp0aSI6ImFkODMxYTUxYmU3MWEzMzAxYzQzN2I1MTU5MGY4OGJjMTZkZjRmODM4NjZhZGI5NmU3NmJkMzZjZjFjMmU1ZmM1ZDAxZWU5NTFkYjc4MjUxIiwiaWF0IjoxNjk1MjE3NDk2LjI0NjUsIm5iZiI6MTY5NTIxNzQ5Ni4yNDY1LCJleHAiOjE2OTUyMjQ2OTYuMjQwNywic3ViIjoiNiIsInNjb3BlcyI6W119.uXMULNGpNPfH4bLyraz5PV-cBgPM3JZlrRFW4PuGpDcop2HatY4YhKHviNf5-xkgor50iTyaCHYfTGEErNW-1wiWiddxSr62H-Nc7lHP9wRinZEEKFyeF3UbYG7lSAaLy1dTtICsnb3Sixw0XePqGyuAlKw9_gGQOzAmT0p6zQY1VsSzTROIG490G-Sk-CdAeAJS8z0eIgC9avXz2PZ4Esf5AnxH5k9IGX-nLaFnkGP28FdnM3nZMfD8-9OKkrS_uv6DU2uiWmdeZI1pIQknAigJUR2qAZDXa42xJfRfBqBmGA4Ugq-_aje4DzAX063CjHRFSzlWDTv189y2AOM3gCsXSP0UojFwq8KxdxREEj96X-5qebp93q59FevJJiMXmGDKRxwRiAONpXcTNwVXXbrSEerjybZUZRw_SOJxcb6Vmb2NREODqb13S-5bjFo11Lm8K40QBPmKjcc13RsAVb5g_D7Nc7wS3DSNSNxKIzMI8GF7hQPPVKRJ_Wb4_TwlEsPGlZ6HLXwEQ7u4F6KTh38aSvMW4a2Z8dOR9kONgRYdgltnPJ7Z6iUuUY_NHBdrX9q0CAm35R8-eUjOOu8XrX03CLsRLcAimCmZJEREev391yM4o2KLy-If6jBrJ0LGNSMNk0bC6_LGqzACyuZ6vltw84HpiKcPqmE4uXJxESg'
}
conn.request("POST", "/ccpayment/api/saveCard", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Nodejs Örneği
javascript
const axios = require('axios');
let data = JSON.stringify({
  "card_holder_name": "Customer Postman",
  "card_number": "4508034508034509",
  "expiry_month": "12",
  "expiry_year": "2026",
  "merchant_key": "$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he",
  "customer_number": "",
  "hash_key": ""
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://test.vepara.com.tr/ccpayment/api/saveCard',
  headers: { 
    'Accept': 'application/json', 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxOSIsImp0aSI6ImFkODMxYTUxYmU3MWEzMzAxYzQzN2I1MTU5MGY4OGJjMTZkZjRmODM4NjZhZGI5NmU3NmJkMzZjZjFjMmU1ZmM1ZDAxZWU5NTFkYjc4MjUxIiwiaWF0IjoxNjk1MjE3NDk2LjI0NjUsIm5iZiI6MTY5NTIxNzQ5Ni4yNDY1LCJleHAiOjE2OTUyMjQ2OTYuMjQwNywic3ViIjoiNiIsInNjb3BlcyI6W119.uXMULNGpNPfH4bLyraz5PV-cBgPM3JZlrRFW4PuGpDcop2HatY4YhKHviNf5-xkgor50iTyaCHYfTGEErNW-1wiWiddxSr62H-Nc7lHP9wRinZEEKFyeF3UbYG7lSAaLy1dTtICsnb3Sixw0XePqGyuAlKw9_gGQOzAmT0p6zQY1VsSzTROIG490G-Sk-CdAeAJS8z0eIgC9avXz2PZ4Esf5AnxH5k9IGX-nLaFnkGP28FdnM3nZMfD8-9OKkrS_uv6DU2uiWmdeZI1pIQknAigJUR2qAZDXa42xJfRfBqBmGA4Ugq-_aje4DzAX063CjHRFSzlWDTv189y2AOM3gCsXSP0UojFwq8KxdxREEj96X-5qebp93q59FevJJiMXmGDKRxwRiAONpXcTNwVXXbrSEerjybZUZRw_SOJxcb6Vmb2NREODqb13S-5bjFo11Lm8K40QBPmKjcc13RsAVb5g_D7Nc7wS3DSNSNxKIzMI8GF7hQPPVKRJ_Wb4_TwlEsPGlZ6HLXwEQ7u4F6KTh38aSvMW4a2Z8dOR9kONgRYdgltnPJ7Z6iUuUY_NHBdrX9q0CAm35R8-eUjOOu8XrX03CLsRLcAimCmZJEREev391yM4o2KLy-If6jBrJ0LGNSMNk0bC6_LGqzACyuZ6vltw84HpiKcPqmE4uXJxESg'
  },
  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/saveCard");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxOSIsImp0aSI6ImFkODMxYTUxYmU3MWEzMzAxYzQzN2I1MTU5MGY4OGJjMTZkZjRmODM4NjZhZGI5NmU3NmJkMzZjZjFjMmU1ZmM1ZDAxZWU5NTFkYjc4MjUxIiwiaWF0IjoxNjk1MjE3NDk2LjI0NjUsIm5iZiI6MTY5NTIxNzQ5Ni4yNDY1LCJleHAiOjE2OTUyMjQ2OTYuMjQwNywic3ViIjoiNiIsInNjb3BlcyI6W119.uXMULNGpNPfH4bLyraz5PV-cBgPM3JZlrRFW4PuGpDcop2HatY4YhKHviNf5-xkgor50iTyaCHYfTGEErNW-1wiWiddxSr62H-Nc7lHP9wRinZEEKFyeF3UbYG7lSAaLy1dTtICsnb3Sixw0XePqGyuAlKw9_gGQOzAmT0p6zQY1VsSzTROIG490G-Sk-CdAeAJS8z0eIgC9avXz2PZ4Esf5AnxH5k9IGX-nLaFnkGP28FdnM3nZMfD8-9OKkrS_uv6DU2uiWmdeZI1pIQknAigJUR2qAZDXa42xJfRfBqBmGA4Ugq-_aje4DzAX063CjHRFSzlWDTv189y2AOM3gCsXSP0UojFwq8KxdxREEj96X-5qebp93q59FevJJiMXmGDKRxwRiAONpXcTNwVXXbrSEerjybZUZRw_SOJxcb6Vmb2NREODqb13S-5bjFo11Lm8K40QBPmKjcc13RsAVb5g_D7Nc7wS3DSNSNxKIzMI8GF7hQPPVKRJ_Wb4_TwlEsPGlZ6HLXwEQ7u4F6KTh38aSvMW4a2Z8dOR9kONgRYdgltnPJ7Z6iUuUY_NHBdrX9q0CAm35R8-eUjOOu8XrX03CLsRLcAimCmZJEREev391yM4o2KLy-If6jBrJ0LGNSMNk0bC6_LGqzACyuZ6vltw84HpiKcPqmE4uXJxESg");
var content = new StringContent("{\r\n    \"card_holder_name\": \"Customer Postman\",\r\n    \"card_number\": \"4508034508034509\",\r\n    \"expiry_month\": \"12\",\r\n    \"expiry_year\": \"2026\",\r\n    \"merchant_key\": \"$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he\",\r\n    \"customer_number\": \"\",\r\n    \"hash_key\": \"\"\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Vepara