API RAJAONGKIR PLUGIN. silahkan lapor jika ada bug atau masukan
Install dengan Composer
composer require dickyp/rajaongkir
Dickyp\RajaOngkir\ROngkirPackageServiceProvider::class,
'RajaOngkir' => Dickyp\RajaOngkir\RajaOngkirFacade::class
setelah itu lakukan.
php artisan vendor:publish
dalam folder laravel-project/config/config/rajaongkir.php
pindahkan rajaongkir.php ke folder laravel-project/config/
atau membuat manual file config dengan nama rajaongkir.php
return [
'end_point' => env('RONGKIR_ENDPOINT', 'http://rajaongkir.com/api/starter'),
'token' => env('RONGKIR_KEY', 'token')
];
dalam file .env tambahkan
RONGKIR_ENDPOINT=http://rajaongkir.com/api/starter
RONGKIR_KEY=API-TOKEN-ANDA
untuk menggunakan tambahkan.
use RajaOngkir;
RajaOngkir::province();
callback
0 => array:2 [▼
"province_id" => "1"
"province" => "Bali"
]
1 => array:2 [▼
"province_id" => "2"
"province" => "Bangka Belitung"
]
$id = 1;
RajaOngkir::province($id);
callback
0 => array:2 [▼
"province_id" => "1"
"province" => "Bali"
]
RajaOngkir::city()
callback
0 => array:6 [▼
"city_id" => "1"
"province_id" => "21"
"province" => "Nanggroe Aceh Darussalam (NAD)"
"type" => "Kabupaten"
"city_name" => "Aceh Barat"
"postal_code" => "23681"
]
$id = 1;
RajaOngkir::city($id)
callback
0 => array:6 [▼
"city_id" => "1"
"province_id" => "21"
"province" => "Nanggroe Aceh Darussalam (NAD)"
"type" => "Kabupaten"
"city_name" => "Aceh Barat"
"postal_code" => "23681"
]
$province_id = 1;
RajaOngkir::city_by_province($province_id)
callback
0 => array:6 [▼
"city_id" => "17"
"province_id" => "1"
"province" => "Bali"
"type" => "Kabupaten"
"city_name" => "Badung"
"postal_code" => "80351"
]
$origin = $id_city_origin; // id kota pengirim
$destination = $id_city_destination; //id kota penerima
$weight = 10000; //dalam satuan gram
$courier = "jne" bisa di isi kurir lain tergantung tipe akun.
RajaOngkir::shipping($origin, $destination, $weight, $courier);
callback
"code" => "jne"
"name" => "Jalur Nugraha Ekakurir (JNE)"
"costs" => array:2 [▼
0 => array:3 [▼
"service" => "OKE"
"description" => "Ongkos Kirim Ekonomis"
"cost" => array:1 [▶]
]
1 => array:3 [▼
"service" => "REG"
"description" => "Layanan Reguler"
"cost" => array:1 [▶]
]
]
- V 1.0
- Upload fitur dasar, ambil data kota, provinsi, ongkos kirim.