PHP code example of kiriminaja / kiriminaja-php
1. Go to this page and download the library: Download kiriminaja/kiriminaja-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kiriminaja / kiriminaja-php example snippets
// When on your dev/stag
KiriminAjaConfig::setMode(Mode::Staging)::setApiTokenKey('YOUR_KEY');
// When on your production
KiriminAjaConfig::setMode(Mode::Production)::setApiTokenKey('YOUR_KEY');
KiriminAja::getCity((int) $province_id);
KiriminAja::getDistrict((int) $district_id);
KiriminAja::getDistrictByName((string) $keyword);
KiriminAja::getProvince();
KiriminAja::setWhiteListExpedition((array) $services);
KiriminAja::setCallback((string) $url);
KiriminAja::getPrice(ShippingPriceData $data);
KiriminAja::requestPickup(RequestPickupData $data);
KiriminAja::getPayment((string) $payment_id);
KiriminAja::cancelShipment((string) $waybill,(string) $reason);
KiriminAja::getTracking((string) $package_id);
KiriminAja::getSchedules();
public function get_price() {
$shipping_price_object = new ShippingPriceData;
$shipping_price_object->origin = 1063;
$shipping_price_object->destination = 1064;
$shipping_price_object->weight = 1000;
$shipping_price_object->insurance = 1;
$shipping_price_object->item_value = 100000;
$shipping_price_object->courier = ['jne', 'jnt', 'sicepat'];
return KiriminAja::getPrice($shipping_price_object);
}
public function request_pickup() {
$pickup_object = new RequestPickupData;
$pickup_object->address = "Jl. Jodipati No.29 Perum Taman Kencana Sejahtera";
$pickup_object->phone = "082129627860";
$pickup_object->name = "dipaferdian";
$pickup_object->kecamatan_id = 5784;
$pickup_object->schedule = "2022-11-03 17:00:00";
$pickup_object->zipcode = 16610;
$pickup_object->platform_name = 'mitra';
// Array of packages
$pickup_object->packages = [];
// Package object
$package_data = new PackageData;
$package_data->order_id = "DEV-2300000024";
$package_data->destination_name = "Flag Test3";
$package_data->destination_phone = "082223323333";
$package_data->destination_address = "Jl. Magelang KM 11";
$package_data->destination_kecamatan_id = 419;
$package_data->destination_zipcode = 55598;
$package_data->weight = 520;
$package_data->width = 8;
$package_data->height = 8;
$package_data->length = 8;
$package_data->item_value = 275000;
$package_data->shipping_cost = 65000;
$package_data->service = "sicepat";
$package_data->service_type = "SIUNT";
$package_data->item_name = "Test item name";
$package_data->package_type_id = 1;
$package_data->cod = 0;
$package_data->note = 'test pickup request non cod';
$package_data->drop = true;
// Bind package object to packages
$pickup_object->packages = [$package_data];
return KiriminAja::requestPickup($pickup_object);
}
bash
composer
bash
php examples\InvoiceExample.php