3D Secure ile Ödeme

Kredi kartı bilgileri ile 3D Secure doğrulaması yaparak güvenli ödeme işlemi gerçekleştirir.

Endpoint Bilgileri
Method: POST
URL: /api/v1/paymentwith3d
Content-Type: application/json
Kimlik Doğrulama

Bu endpoint hash tabanlı kimlik doğrulama kullanır.

hash = SHA256(apiKey + requestData + hashKey)

Parametreler

Parametre Tip Zorunlu Açıklama
ApiKey string Zorunlu API anahtarınız
Hash string Zorunlu SHA256 hash değeri
CardNumber string Zorunlu Kredi kartı numarası (16 haneli)
CardHolder string Zorunlu Kart sahibinin adı
CardMonth string Zorunlu Kartın son kullanma ayı (MM)
CardYear string Zorunlu Kartın son kullanma yılı (YY)
CardCcv string Zorunlu Kartın güvenlik kodu (CVV)
Price decimal Zorunlu Ödeme tutarı
CustomerFirstname string Zorunlu Müşteri adı
CustomerLastname string Zorunlu Müşteri soyadı
CustomerEmail string Zorunlu Müşteri e-posta adresi

Kod Örnekleri

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using Newtonsoft.Json;

public class iPosApiClient
{
    private readonly string _apiKey;
    private readonly string _hashKey;
    private readonly string _baseUrl;
    private readonly HttpClient _httpClient;

    public iPosApiClient(string apiKey, string hashKey, string baseUrl)
    {
        _apiKey = apiKey;
        _hashKey = hashKey;
        _baseUrl = baseUrl;
        _httpClient = new HttpClient();
    }

    public async Task<string> PaymentAsync(dynamic requestData)
    {
        var jsonData = JsonConvert.SerializeObject(requestData);
        var hash = GenerateHash(_apiKey + jsonData + _hashKey);
        
        requestData.ApiKey = _apiKey;
        requestData.Hash = hash;

        var content = new StringContent(
            JsonConvert.SerializeObject(requestData),
            Encoding.UTF8,
            "application/json"
        );

        var response = await _httpClient.PostAsync($"{_baseUrl}/api/v1/paymentwith3d", content);
        return await response.Content.ReadAsStringAsync();
    }

    private string GenerateHash(string input)
    {
        using (var sha256 = SHA256.Create())
        {
            var bytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(input));
            return Convert.ToHexString(bytes).ToLower();
        }
    }
}

// Kullanım örneği
var client = new iPosApiClient("your-api-key", "your-hash-key", "https://your-domain.com");

var request = new
{
    CardNumber = "4111111111111111",
    CardHolder = "John Doe",
    CardMonth = "12",
    CardYear = "25",
    CardCcv = "123",
    Price = 100.00m,
    CustomerFirstname = "John",
    CustomerLastname = "Doe",
    CustomerEmail = "[email protected]",
    ProductName = "Test Product"
};

var result = await client.PaymentAsync(request);
Console.WriteLine(result);

İnteraktif Test

Demo Verilerle Test Et

Aşağıdaki formu kullanarak endpoint'i demo verilerle test edebilirsiniz.

Test ediliyor...