Pazartesi - Cumartesi: 09:00 - 18:00

26.03.2026 10 dk okuma Kargo Entegrasyonu

MNG Kargo API

MNG Kargo, REST tabanlı modern bir API sunar. JSON formatında veri alışverişi yapılır. Gönderi oluşturma, barkod alma, kargo takibi ve fiyat hesaplama işlemlerini destekler.

API Bilgileri

  • Base URL: https://api.mngkargo.com.tr/mngapi/api
  • Auth: Bearer Token (API Key)

1. Token Alma

function mng_get_token($api_key, $api_secret) {
    $ch = curl_init('https://api.mngkargo.com.tr/token');
    curl_setopt_array($ch, [
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query([
            'grant_type'    => 'password',
            'username'      => $api_key,
            'password'      => $api_secret,
        ]),
        CURLOPT_RETURNTRANSFER => true,
    ]);
    $res = json_decode(curl_exec($ch));
    curl_close($ch);
    return $res->access_token;
}

2. Gönderi Oluşturma

function mng_create_shipment($token, $order) {
    $payload = json_encode([
        'order' => [
            'referenceId'  => $order['id'],
            'barcode'      => '',
            'billOfLandingId' => '',
            'isCOD'        => 0,
            'codAmount'    => 0,
            'packagingType'=> 1,
            'content'      => $order['product'],
            'count'        => 1,
            'weight'       => $order['weight'],
            'volume'       => $order['desi'],
            'recipient'    => [
                'customerId'  => '',
                'firstName'   => $order['name'],
                'phone'       => $order['phone'],
                'cityCode'    => $order['city'],
                'districtName'=> $order['district'],
                'address'     => $order['address'],
            ],
        ],
    ]);

    $ch = curl_init('https://api.mngkargo.com.tr/mngapi/api/standardshipment');
    curl_setopt_array($ch, [
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => $payload,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . $token,
            'Content-Type: application/json',
        ],
        CURLOPT_RETURNTRANSFER => true,
    ]);
    return json_decode(curl_exec($ch));
}
Avantaj: MNG Kargo REST API kullandığı için SOAP bilgisi gerekmez, JSON ile çalışır ve daha modern bir entegrasyon sunar.

Sıkça Sorulan Sorular

MNG Kargo API REST mi SOAP mı?
MNG Kargo modern REST API sunar. JSON formatında çalışır.
MNG Kargo API'ye nasıl başvurulur?
MNG Kargo ile kurumsal anlaşma yaptıktan sonra teknik ekipten API bilgilerini talep edin.
Kapıda ödeme (COD) nasıl yapılır?
isCOD parametresini 1, codAmount'u tahsil edilecek tutar olarak ayarlayın.
Mesaj Gönderin0850 307 34 58
Hemen Arayın0850 307 34 58
Hemen Arayın WhatsApp