Hepsiburada API

Hepsiburada Entegrasyonu: Merchant API Rehberi

Hepsiburada Merchant API ile ürün yükleme, stok senkronizasyonu, sipariş yönetimi ve HepsiJet entegrasyonu. RESTful API, batch upload ve gerçek zamanlı senkronizasyon.

🛒Hepsiburada Merchant API

Hepsiburada Merchant API, satıcıların ürün, fiyat, stok, sipariş ve iade işlemlerini otomatik yönetmesini sağlar. RESTful API (JSON) kullanır.

# Hepsiburada API Base URL
Production: https://mpop.hepsiburada.com

# Authentication
Basic Auth: Username (Merchant ID) + Password (API Key)

# Temel Endpoint'ler:
POST   /product/api/products                    # Ürün ekle
GET    /product/api/products/{sku}              # Ürün detay
PUT    /product/api/products/price-inventory    # Fiyat/Stok güncelle
GET    /order/api/orders                        # Sipariş listesi
POST   /order/api/orders/{orderId}/shipping     # Kargo bildir

# Rate Limit: 60 istek/dakika

Merchant ID ve API Key Alma

1. Hepsiburada Merchant Panel → Entegrasyon → API Ayarları
2. "Merchant ID" ve "API Key" bilgilerini kaydet
3. Test environment'ta test et (staging.hepsiburada.com)
4. Canlıya geçmek için Hepsiburada onayı gerekir

Ürün Yükleme

# Python ile Hepsiburada'ya ürün ekleme
import requests
from requests.auth import HTTPBasicAuth
import json

API_URL = "https://mpop.hepsiburada.com"
MERCHANT_ID = "12345678"
API_KEY = "your-api-key"

auth = HTTPBasicAuth(MERCHANT_ID, API_KEY)
headers = {"Content-Type": "application/json"}

product = {
    "merchantSku": "LAPTOP-ASUS-001",
    "hepsiburadaSku": "HBV00000ABC123",  # Hepsiburada ürün kodu
    "price": 25000.00,
    "availableStock": 15,
    "dispatchTime": 2,  # Kargo hazırlık süresi (gün)
    "cargoCompany": "HepsiJet",
    "attributes": {
        "Marka": "ASUS",
        "Model": "VivoBook 15",
        "Renk": "Gri",
        "EkranBoyutu": "15.6 inç",
        "RAM": "8 GB",
        "Depolama": "512 GB SSD"
    },
    "images": [
        "https://cdn.example.com/laptop1.jpg",
        "https://cdn.example.com/laptop2.jpg",
        "https://cdn.example.com/laptop3.jpg"
    ],
    "description": "ASUS VivoBook 15 - Intel Core i5, 8GB RAM, 512GB SSD",
    "longDescription": """
        ASUS VivoBook 15, günlük kullanım için ideal performans sunar.
        - İşlemci: Intel Core i5-1135G7 (11. Nesil)
        - RAM: 8 GB DDR4
        - Depolama: 512 GB NVMe SSD
        - Ekran: 15.6" FHD (1920x1080)
        - Grafik: Intel Iris Xe
        - İşletim Sistemi: Windows 11 Home
    """,
    "vatRate": 18,
    "warranty": 24,  # Garanti süresi (ay)
    "categoryId": "18020301"  # Laptop kategorisi
}

response = requests.post(
    f"{API_URL}/product/api/products",
    auth=auth,
    headers=headers,
    json=product
)

if response.status_code in [200, 201]:
    print("Ürün başarıyla eklendi!")
    print(response.json())
else:
    print(f"Hata: {response.status_code}")
    print(response.text)

Stok ve Fiyat Güncelleme

# Toplu fiyat ve stok güncelleme
def update_price_stock(items):
    """
    items = [
        {"merchantSku": "LAPTOP-ASUS-001", "price": 24500, "stock": 12},
        {"merchantSku": "LAPTOP-HP-002", "price": 18900, "stock": 8},
    ]
    """
    url = f"{API_URL}/product/api/products/price-inventory"

    # Hepsiburada formatına çevir
    payload = {
        "items": [
            {
                "merchantSku": item["merchantSku"],
                "price": item.get("price"),
                "availableStock": item.get("stock"),
                "dispatchTime": 2
            }
            for item in items
        ]
    }

    response = requests.put(url, auth=auth, headers=headers, json=payload)
    return response.json()

# Sadece fiyat güncelleme
def update_price_only(sku, new_price):
    return update_price_stock([{
        "merchantSku": sku,
        "price": new_price
    }])

# Sadece stok güncelleme
def update_stock_only(sku, new_stock):
    return update_price_stock([{
        "merchantSku": sku,
        "stock": new_stock
    }])

# Kampanya fiyatı belirleme
def set_campaign_price(sku, original_price, campaign_price):
    url = f"{API_URL}/product/api/products/campaign-price"

    payload = {
        "merchantSku": sku,
        "listPrice": original_price,
        "salePrice": campaign_price,
        "campaignStartDate": "2026-02-20T00:00:00",
        "campaignEndDate": "2026-02-28T23:59:59"
    }

    response = requests.post(url, auth=auth, headers=headers, json=payload)
    return response.json()

Sipariş Yönetimi

# Sipariş listesi çekme
from datetime import datetime, timedelta

def get_orders(status="Approved", days=7):
    """
    status: Approved, Preparing, Shipped, Delivered, Cancelled, Returned
    """
    url = f"{API_URL}/order/api/orders"

    end_date = datetime.now()
    start_date = end_date - timedelta(days=days)

    params = {
        "status": status,
        "beginDate": start_date.strftime("%Y-%m-%dT%H:%M:%S"),
        "endDate": end_date.strftime("%Y-%m-%dT%H:%M:%S"),
        "page": 0,
        "size": 100
    }

    response = requests.get(url, auth=auth, params=params)
    return response.json()

# Sipariş detayı
def get_order_detail(order_number):
    url = f"{API_URL}/order/api/orders/{order_number}"
    response = requests.get(url, auth=auth)
    return response.json()

# HepsiJet ile kargo bildirimi
def ship_with_hepsijet(order_id, package_items):
    """
    package_items = [
        {"merchantSku": "LAPTOP-ASUS-001", "quantity": 1}
    ]
    """
    url = f"{API_URL}/order/api/orders/{order_id}/shipping"

    payload = {
        "cargoCompany": "HepsiJet",
        "cargoTrackingNumber": None,  # HepsiJet otomatik oluşturur
        "packages": [
            {
                "items": package_items,
                "desi": 5,  # Desi hesaplaması
                "width": 40,
                "height": 30,
                "length": 10
            }
        ]
    }

    response = requests.post(url, auth=auth, headers=headers, json=payload)
    return response.json()

# Kendi kargonuzla gönderim
def ship_with_own_cargo(order_id, tracking_number, cargo_company):
    url = f"{API_URL}/order/api/orders/{order_id}/shipping"

    payload = {
        "cargoCompany": cargo_company,  # "Yurtiçi", "Aras", "MNG", vb.
        "cargoTrackingNumber": tracking_number
    }

    response = requests.post(url, auth=auth, headers=headers, json=payload)
    return response.json()

İade Yönetimi

# İade taleplerini çekme
def get_return_requests(status="Pending"):
    """
    status: Pending, Approved, Rejected, Completed
    """
    url = f"{API_URL}/order/api/returns"

    params = {"status": status, "page": 0, "size": 50}
    response = requests.get(url, auth=auth, params=params)
    return response.json()

# İade onaylama
def approve_return(return_id, refund_type="REFUND"):
    """
    refund_type: REFUND (para iadesi) veya EXCHANGE (ürün değişimi)
    """
    url = f"{API_URL}/order/api/returns/{return_id}/approve"

    payload = {
        "refundType": refund_type,
        "approvalNote": "İade talebi onaylandı."
    }

    response = requests.post(url, auth=auth, headers=headers, json=payload)
    return response.json()

# İade reddetme
def reject_return(return_id, reason):
    url = f"{API_URL}/order/api/returns/{return_id}/reject"

    payload = {"rejectionReason": reason}
    response = requests.post(url, auth=auth, headers=headers, json=payload)
    return response.json()

İade Süreçleri:

14 gün yasal iade hakkı: Tüm ürünlerde geçerli
Satıcı onayı: İadeyi 2 iş günü içinde onaylayın
Kargo ücreti: Kusurlu ürün → Satıcı öder, cayma → Alıcı öder
Para iadesi: Ürün teslim alındıktan sonra 5-7 iş günü

HepsiJet Avantajları

🚚 Hızlı Teslimat

Aynı gün: Seçili şehirlerde
1-2 gün: Türkiye geneli
Teslimat oranı: %98+

💰 Maliyet Avantajı

Komisyon: %15-30 daha düşük
Kargo: Dahil (satıcıya ek yük yok)
İade kargo: Hepsiburada karşılar

Maliyet ve Performans

KategoriKomisyonKargoÖdeme
Elektronik%12-15HepsiJet: DahilT+15
Moda/Giyim%18-22HepsiJet: DahilT+15
Kozmetik%15-20HepsiJet: DahilT+15
Ev/Yaşam%10-18HepsiJet: DahilT+15

Örnek ROI Hesabı:

Aylık ciro: 500K TL
Komisyon (ort. %15): 75K TL
Kargo (HepsiJet): 0 TL (dahil)
Entegrasyon maliyeti: 25K TL (bir kerelik)
Net kâr: 425K TL/ay
ROI: İlk ayda %1600+

Hepsiburada Entegrasyonunuzu Kuralım

Otomatik ürün yükleme, stok senkronizasyonu, HepsiJet entegrasyonu ve sipariş yönetimi ile Hepsiburada satışlarınızı artırın.

Demo İste