Skip to main content
GET
https://www.xn--dkkango-n2a.com/api/integrations
/
orders
/
variables
Get Order Variables
curl --request GET \
  --url https://www.xn--dkkango-n2a.com/api/integrations/orders/variables \
  --header 'Access-Token: <api-key>'
{
  "status": true,
  "data": {
    "paymentMethod": [
      {
        "key": "<string>",
        "name": "<string>"
      }
    ],
    "shippingMethod": [
      {
        "key": "<string>",
        "name": "<string>"
      }
    ]
  }
}

Overview

Returns the available payment methods and shipping methods used in the system.

Headers

Access-Token
string
required
Your API access token

Response

status
boolean
true if successful
data
object
Object containing payment and shipping method arrays

Examples

curl -X GET https://www.xn--dkkango-n2a.com/api/integrations/orders/variables \
  -H 'Access-Token: your-access-token'

Success Response (200)

{
  "status": true,
  "data": {
    "paymentMethod": [
      {
        "key": "CASH",
        "name": "Nakit"
      },
      {
        "key": "CREDIT_CARD",
        "name": "Kredi Kartı"
      },
      {
        "key": "DEBIT_CARD",
        "name": "Banka Kartı"
      }
    ],
    "shippingMethod": [
      {
        "key": "delivery",
        "name": "Teslimat"
      },
      {
        "key": "pickup",
        "name": "Gel Al"
      }
    ]
  }
}

Error Response (401)

{
  "status": false,
  "error": "yetkisiz erişim"
}

Use Cases

Fetch and cache variables when POS starts.
async function initializePOS() {
  const variables = await getOrderVariables();
  
  // Store in local cache
  localStorage.setItem('paymentMethods', 
    JSON.stringify(variables.paymentMethod));
  localStorage.setItem('shippingMethods', 
    JSON.stringify(variables.shippingMethod));
  
  console.log('POS initialized with order variables');
}
Map payment/shipping keys to display names.
function formatOrderDetails(order) {
  const paymentMethods = getPaymentMethods();
  const shippingMethods = getShippingMethods();
  
  const paymentName = paymentMethods.find(
    p => p.key === order.payment_type
  )?.name || order.payment_type;
  
  const shippingName = shippingMethods.find(
    s => s.key === order.shipping_method
  )?.name || order.shipping_method;
  
  return {
    ...order,
    paymentMethodName: paymentName,
    shippingMethodName: shippingName
  };
}
Create dropdown filters in POS interface.
async function buildOrderFilters() {
  const variables = await getOrderVariables();
  
  // Payment filter
  const paymentFilter = variables.paymentMethod.map(pm => ({
    value: pm.key,
    label: pm.name
  }));
  
  // Shipping filter
  const shippingFilter = variables.shippingMethod.map(sm => ({
    value: sm.key,
    label: sm.name
  }));
  
  renderFilters(paymentFilter, shippingFilter);
}
Validate incoming order data.
function validateOrderVariables(order) {
  const variables = getCachedVariables();
  
  const validPayment = variables.paymentMethod.some(
    p => p.key === order.payment_type
  );
  
  const validShipping = variables.shippingMethod.some(
    s => s.key === order.shipping_method
  );
  
  if (!validPayment || !validShipping) {
    throw new Error('Invalid payment or shipping method');
  }
}

Caching Strategy

These values rarely change. Cache them locally to avoid unnecessary API calls.
class VariablesCache {
  constructor() {
    this.cache = null;
    this.lastFetch = null;
    this.cacheDuration = 24 * 60 * 60 * 1000; // 24 hours
  }
  
  async getVariables() {
    const now = Date.now();
    
    // Return cached if recent
    if (this.cache && (now - this.lastFetch) < this.cacheDuration) {
      return this.cache;
    }
    
    // Fetch fresh
    const response = await fetch('/orders/variables');
    this.cache = await response.json();
    this.lastFetch = now;
    
    return this.cache;
  }
  
  invalidate() {
    this.cache = null;
    this.lastFetch = null;
  }
}

Payment Methods

KeyNameDescription
CASHNakitCash payment on delivery
CREDIT_CARDKredi KartıCredit card (pre-paid)
DEBIT_CARDBanka KartıDebit card (pre-paid)

Shipping Methods

KeyNameDescription
deliveryTeslimatHome/office delivery
pickupGel AlCustomer pickup from restaurant