Dokumentasi API Lugistic untuk Integrasi dengan Aplikasi Anda

Lugistic menyediakan API yang memungkinkan Anda mengintegrasikan layanan pengiriman Lugistic langsung ke aplikasi atau website Anda. Simak dokumentasi berikut untuk mengetahui cara mendapatkan API credentials dan menggunakan endpoint yang tersedia.

A. Mendapatkan API Credentials

Untuk dapat menggunakan API Lugistic, Anda memerlukan Client ID dan Client Secret yang akan digunakan untuk autentikasi saat melakukan request ke API.

  1. Pastikan Anda sudah memiliki akun Lugistic yang terverifikasi. Jika belum, silakan melakukan registrasi terlebih dahulu.
  2. Masuk ke akun Lugistic Anda kemudian klik menu Profile > Plugin > Setting > Developer
  3. Pada halaman API, salin Client ID dan Client Secret.

Penting: Jaga kerahasiaan Client Secret Anda! Jangan pernah membagikannya kepada siapapun atau memasukkannya ke dalam kode yang dapat diakses publik.

B. Autentikasi API

Setiap permintaan ke API Lugistic harus menyertakan Client ID dan Client Secret di dalam header permintaan untuk autentikasi:

    headers: {
        'Content-Type': 'application/json',
        'Client-ID': 'your_client_id_here',
        'Client-Secret': 'your_client_secret_here'
    }

Pastikan untuk mengganti your_client_id_here dan your_client_secret_here dengan ID dan Secret yang Anda dapatkan.

C. Endpoint API

API Lugistic menyediakan 2 endpoint utama yang dapat digunakan untuk mengintegrasikan layanan pengiriman ke aplikasi Anda:

1. Check Shipping

URL:
https://lugistic.com/api/check-shipping
Metode:
POST

Body Parameters:

Parameter Tipe Wajib Deskripsi
destination_code String Ya Kode negara tujuan (misal: US)
postal_code String Ya Kode pos tujuan
items Array Ya Daftar barang yang dikirim

Contoh Request:

    fetch('https://lugistic.com/api/check-shipping', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Client-ID': 'your_client_id_here',
            'Client-Secret': 'your_client_secret_here'
        },
        body: JSON.stringify({
            'destination_code': 'US',
            'postal_code': '92108',
            'items': [
                {
                    'weight': 5.575,
                    'length': 36,
                    'width': 30,
                    'height': 25,
                    'quantity': 1
                }
            ]
        })
    })
    .then(res => res.json())
    .then(data => console.log(data));
                

Contoh Response:

    {
        "status": "success",
        "message": "Shipping rates calculated successfully",
        "information": "<span>By continuing to the payment page, you acknowledge that you have read and agree to <a href='https://protoflex.id/purchase_shipment/'>the International Purchase & Shipping Policy.</a><span>",
        "data": [
            {
                "expedition_name": "DHL(2-3 Days)",
                "expedition_id": 1,
                "is_remote_area": false,
                "remote_area_price": 250000,
                "total_estimated_price": 750000,
                "total_weight": 6,
                "publish_rate": 0,
                "multiplier": "2.00",
                "destination_code": "US",
                "items": [
                    {
                        "item_number": 1,
                        "weight": 6,
                        "quantity": 1,
                        "estimated_price": 0
                    }
                ]
            },
            {
                "expedition_name": "FedEx(2-3 Days)",
                "expedition_id": 2,
                "is_remote_area": false,
                "remote_area_price": 0,
                "total_estimated_price": 0,
                "total_weight": 6,
                "publish_rate": 0,
                "multiplier": "2.00",
                "destination_code": "US",
                "items": [
                    {
                        "item_number": 1,
                        "weight": 6,
                        "quantity": 1,
                        "estimated_price": 0
                    }
                ]
            }
        ]
    }

2. Create Transaction

URL:
https://lugistic.com/api/create-transaction
Metode:
POST

Body Parameters:

Parameter Tipe Wajib Deskripsi
woo_order_no String Ya Nomor pesanan WooCommerce
expedition_id Integer Ya ID ekspedisi
receiver_name String Ya Nama penerima
receiver_phone String Ya Nomor telepon penerima
receiver_address String Ya Alamat penerima
receiver_country_code String Ya Kode negara penerima (misal: JP)
receiver_postal_code String Ya Kode pos penerima
total_price Integer Ya Total harga pengiriman
remote_area_price Integer Ya Harga untuk daerah terpencil
total_weight Integer Ya Total berat pengiriman
items Array Ya Daftar barang yang dikirim

Contoh Request:

    fetch('https://lugistic.com/api/create-transaction', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Client-ID': 'your_client_id_here',
            'Client-Secret': 'your_client_secret_here'
        },
        body: JSON.stringify({
            "woo_order_no": "WC12345678",
            "expedition_id": 1,
            "receiver_name": "John Snow",
            "receiver_phone": "08173812734",
            "receiver_address": "1-2-3 Shibuya, Shibuya-ku, Tokyo, Japan",
            "receiver_country_code": "JP",
            "receiver_postal_code": "150-0002",
            "total_price": 200000,
            "remote_area_price": 20000,
            "total_weight": 6,
            "items": [
                {
                    "item_name": "Backpack",
                    "quantity": 1,
                    "weight": 3.5,
                    "length": 30,
                    "width": 20,
                    "height": 40,
                    "price": 30000,
                    "weight_effective": 2.5
                },
                {
                    "item_name": "Shoes",
                    "quantity": 2,
                    "weight": 1.2,
                    "length": 25,
                    "width": 15,
                    "height": 12,
                    "price": 15000,
                    "weight_effective": 2.5
                }
            ]
        })
    })
    .then(res => res.json())
    .then(data => console.log(data));

Contoh Response:

    {
        "status": "success",
        "message": "Transaction created successfully",
        "data": {
            "receipt_no": "-",
            "order_no": "LUG6829510188BEC",
            "woo_order_no": "WC12345678",
            "expedition_id": 1,
            "date": "2025-05-17T17:00:00.000000Z",
            "status": "processing",
            "receiver_name": "John Snow",
            "receiver_phone": "08173812734",
            "receiver_address": "1-2-3 Shibuya, Shibuya-ku, Tokyo, Japan",
            "receiver_country_code": "JP",
            "receiver_postal_code": "150-0002",
            "payment_method": null,
            "pickup_option": "pick up",
            "remote_area_price": 20000,
            "total_price": 200000,
            "updated_at": "2025-05-18T03:16:17.000000Z",
            "created_at": "2025-05-18T03:16:17.000000Z",
            "id": 29,
            "items": [
                {
                    "id": 52,
                    "transaction_id": 29,
                    "item_name": "Backpack",
                    "quantity": 1,
                    "weight": 3.5,
                    "length": 30,
                    "width": 20,
                    "height": 40,
                    "price": "30000.00",
                    "created_at": "2025-05-18T03:16:17.000000Z",
                    "updated_at": "2025-05-18T03:16:17.000000Z"
                },
                {
                    "id": 53,
                    "transaction_id": 29,
                    "item_name": "Shoes",
                    "quantity": 2,
                    "weight": 1.2,
                    "length": 25,
                    "width": 15,
                    "height": 12,
                    "price": "15000.00",
                    "created_at": "2025-05-18T03:16:17.000000Z",
                    "updated_at": "2025-05-18T03:16:17.000000Z"
                }
            ]
        }
    }
                                
WhatsApp Kontak CS