PHP code example of victorycodedev / shipday
1. Go to this page and download the library: Download victorycodedev/shipday 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/ */
victorycodedev / shipday example snippets
use Victorycodedev\Shipday\Delivery;
$delivery = new Delivery($apiKey);
// Sign up on https://www.shipday.com to grab your API key.
//INSERT AN ORDER
$orderDetails = [
"orderNumber" => "99qT5A",
"customerName" => "Mr. Jhon Mason",
"customerAddress" => "556 Crestlake Dr, San Francisco, CA 94132, USA",
"customerEmail" => "[email protected] ",
"customerPhoneNumber" => "+14152392212",
"restaurantName" => "Popeyes Louisiana Kitchen",
"restaurantAddress" => "890 Geneva Ave, San Francisco, CA 94112, United States",
"restaurantPhoneNumber" => "+14152392013",
"expectedDeliveryDate" => "2021-06-03",
"expectedPickupTime" => "17:45:00",
"expectedDeliveryTime" => "19:22:00",
"pickupLatitude" => 41.53867,
"pickupLongitude" => -72.0827,
"deliveryLatitude" => 41.53867,
"deliveryLongitude" => -72.0827,
"tips" => 2.5,
"tax" => 1.5,
"discountAmount" => 1.5,
"deliveryFee" => 3,
"totalOrderCost" => 13.47,
"deliveryInstruction" => "fast",
"orderSource" => "Seamless",
"additionalId" => "4532",
"clientRestaurantId" => 12,
"paymentMethod" => "credit_card",
"creditCardType" => "visa",
"creditCardId" => 1234
];
$order = $delivery->insertOrder($orderDetails);
$orderId = 002002;
$details = [
'orderId' => $orderId,
....
];
$response = $delivery->updateOrder($orderId, $details);
$orders = $delivery->getActiveOrders();
$order = $delivery->getOrderDetails('test order 1')[0];
$orders = $delivery->queryOrder([
...
]);
$delivery->deleteOrder('ENTER ORDER ID');
$delivery->assignOrderToDriver('ENTER ORDER ID', 'ENTER CARRIER ID');
$response = $delivery->updateOrderStatus('ENTER ORDER ID', [
'status' => 'STARTED',
]);
$delivery->readyToPickup('ENTER ORDER ID');
$driver = $delivery->addDriver([...]);
$drivers = $delivery->drivers();
$driver = $delivery->getDriverDetails('Enter carrierId');
$response = $delivery->deleteDriver('CARRIER ID');
use Victorycodedev\Shipday\OnDemandDelivery;
$ondemandDelivery = new OnDemandDelivery($apiKey);
// Sign up on https://www.shipday.com to grab your API key.
$response = $ondemandDelivery->services();
$response = $ondemandDelivery->estimate('ORDER ID');
$response = $ondemandDelivery->assign([
//... KEY VALUE PAIR PAYLOAD
]);
$response = $ondemandDelivery->getDetails('ORDER ID');
$response = $ondemandDelivery->cancel('ORDER ID');
$response = $ondemandDelivery->availability([
//... KEY VALUE PAIR PAYLOAD
]);