Skip to content

İşyeri Komisyonları ​

İş yerinin komisyonları almak için bu API kullanılır.

İstek Bilgileri ​

  • Metot: POST
  • URL: https://staging.halkode.com.tr/ccpayment/api/commissions
  • CANLI URL: https://app.halkode.com.tr/ccpayment/api/commissions
  • Yetkilendirme: Bearer {token} Token Alma servisinden alınan değer

İstek Parametreleri (Body) ​

ParametreTipKoşulAçıklama
currency_codestringZorunluPara birimi. Varsayılan: TRY

Örnek İstek (Request) ​

json
{
    "currency_code": "TRY"
}

Başarılı Yanıt ​

json

{
    "status_code": 100,
    "status_description": "Successfull",
    "data": [
        "1": [
            {
                "card_program": "CardFinans",
                "merchant_commission_percentage": "2.9900",
                "merchant_commission_fixed": "0.0000",
                "user_commission_percentage": 0,
                "user_commission_fixed": 0,
                "currency_code": "TRY",
                "installment": 1
            },
            {
                "card_program": "Axess",
                "merchant_commission_percentage": "2.9900",
                "merchant_commission_fixed": "0.0000",
                "user_commission_percentage": 0,
                "user_commission_fixed": 0,
                "currency_code": "TRY",
                "installment": 1
            },
        ],
        "2": [
            {
                "title": "Regular Commission",
                "card_program": "CardFinans",
                "merchant_commission_percentage": "5.6100",
                "merchant_commission_fixed": "0.0000",
                "user_commission_percentage": 0,
                "user_commission_fixed": 0,
                "currency_code": "TRY",
                "installment": 2,
                "pos_id": 254
            },
            {
                "title": "Regular Commission",
                "card_program": "Axess",
                "merchant_commission_percentage": "5.6100",
                "merchant_commission_fixed": "0.0000",
                "user_commission_percentage": 0,
                "user_commission_fixed": 0,
                "currency_code": "TRY",
                "installment": 2,
                "pos_id": 254
            },
        ],
        "3": [ ... 

        ],
        "4": [ ...

        ]
    ]
}

Başarısız Yanıt ​

json
{
    "status_code": 0,
    "status_description": "No Data Found",
    "data": []
}

Kod Örnekleri ​

PHP Örnek Kodu
PHP

<?php

function sendRequest( $data, $token) {
    $baseUrl = "https://staging.halkode.com.tr/ccpayment/api/commissions"
    $url = $baseUrl . $endpoint;
    
    $ch = curl_init($url);
    $payload = json_encode($data);
    
    $headers = [
        'Content-Type: application/json',
        'Accept: application/json',
        'Authorization: Bearer ' . $token
    ];
    
   
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    return json_decode($response, true);
}

//Token get token servisinden alınır. 

$authData = [
    "currency_code": "TRY"
];

$authResult = sendRequest($authData,$token);
print_r($authResult);
?>
C# /.NET Örnek Kodu
C#

using System.Text;
using System.Text.Json;
using System.Net.Http.Headers;

public class HalkodeClient
{
    private static readonly HttpClient client = new HttpClient();

    public async Task<string> GetCommissions(string currencyCode, string token)
    {
        var url = "https://staging.halkode.com.tr/ccpayment/api/commissions";
        
        var requestBody = new { 
            currency_code = currencyCode 
        };
        var json = JsonSerializer.Serialize(requestBody);
        var content = new StringContent(json, Encoding.UTF8, "application/json");

        client.DefaultRequestHeaders.Clear();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        var response = await client.PostAsync(url, content);
        return await response.Content.ReadAsStringAsync();
    }
}

// Token get token servisinden alınır. 

var halkode = new HalkodeClient();
var result = await halkode.GetCommissions("TRY", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9...");
JavaScript / NodeJs Örnek Kodu
JavaScript

const axios = require('axios');

async function getCommissions(currencyCode, token) {
    try {
        const config = {
            method: 'post',
            // URL doğrudan tam yol olarak belirtilmiştir
            url: 'https://staging.halkode.com.tr/ccpayment/api/commissions',
            headers: { 
                'Content-Type': 'application/json', 
                'Accept': 'application/json',
                'Authorization': 'Bearer' . token
            },
            data: {
               "currency_code": currencyCode
            }
        };

        const response = await axios(config);
        return response.data;
    } catch (error) {
        console.error('Hata:', error.response ? error.response.data : error.message);
    }
}

// Token get token servisinden alınır. 

getCommissions("TRY","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9...").then(console.log);