Anında bayilik, anında entegrasyon

2551 tane ürünü kendi sitenize kolayca entegre edin!

API ile sitenize anında entegre edin

API dokümantasyonu
# Ürün & stok listesini çek
curl "https://playsultan.com/api/v1/products?currency=EUR&lang=en&in_stock=1&per_page=50" \
  -H "Authorization: Bearer pb_live_xxxxxxxxxxxxxxxx"

# Canlı fiyatlarla kendi sitenizde listeleyin
# { "ok": true, "data": [ { "id": 445, "name": "PlayStation $1 USD PSN United States",
#   "price": 0.82, "currency": "EUR", "price_try": 44.25, "stock": 42, "in_stock": true } ],
#   "meta": { "page": 1, "total": 2104, "has_more": true } }
<?php
// Katalogu senkronize et
$key = 'pb_live_xxxxxxxxxxxxxxxx';
$page = 1;

do {
  $url = 'https://playsultan.com/api/v1/products?currency=EUR&per_page=200&page=' . $page;
  $res = file_get_contents($url, false, stream_context_create([
    'http' => ['header' => "Authorization: Bearer $key\r\n"],
  ]));
  $body = json_decode($res, true);

  foreach ($body['data'] as $product) {
    // kendi veritabanınıza yazın
  }

  $page++;
} while (!empty($body['meta']['has_more']));
// Katalogu senkronize et
const key = 'pb_live_xxxxxxxxxxxxxxxx';
let page = 1, hasMore = true;

while (hasMore) {
  const res = await fetch(
    `https://playsultan.com/api/v1/products?currency=EUR&per_page=200&page=${page}`,
    { headers: { Authorization: `Bearer ${key}` } }
  );
  const { data, meta } = await res.json();

  for (const product of data) {
    // kendi veritabanınıza yazın
  }

  hasMore = meta.has_more;
  page++;
}