- Installation
- Getting started
- On-Demand Delivery
- Usage
- Creating a Shipday Delivery Order
- Editing a Shipday Delivery Order
- Updating a Shipday Delivery Order Status
- Assigning a Shipday Delivery Order to a Driver
- Creating a Shipday Carrier Account
- Assigning an Order to On-Demand Delivery Service
- Canceling an On-Demand Delivery
- Checking On-Demand Delivery Service Availability
- Getting Available On-Demand Services
Installation
You can install the extension via composer using the following command:
composer require igniterlabs/ti-ext-shipday -W
Run the database migrations to create the required tables:
php artisan igniter:up
Getting started
To get started with the Shipday Delivery extension, follow these steps:
- Signup for a Shipday account: Visit the Shipday website and create an account if you don't already have one.
- Navigate to the Manage > Settings > Shipday Delivery Settings admin page in your TastyIgniter Admin.
- The following fields are available on the Shipday Delivery Settings page:
- Shipday API Key: Enter your Shipday API key here. You can find this key in your Shipday account under the integrations tab.
- Delivery Type: Choose between "In-House Delivery" (using your own delivery staff) or "On-Demand Delivery" (using third-party delivery services like DoorDash, Postmates, or Uber).
- On-Demand Delivery Option: (Only visible when Delivery Type is set to "On-Demand Delivery") Choose how to select third-party delivery services:
- Manually Select 3rd Party Delivery Service: You can manually choose which service to use for each order.
- Auto Select Delivery Service With Lowest Fee: The system will automatically select the service with the lowest delivery fee.
- 3rd party On-Demand Delivery Services: (Only visible when manually selecting services) Choose which third-party delivery service to use by default (e.g., DoorDash, Postmates, Uber).
- Delivery Staff Group: Choose the staff group for delivery staff members. Each staff member of this group will have a corresponding Shipday account created, allowing them to access the Shipday platform and manage deliveries efficiently. (Only used for In-House Delivery)
- Delivery Ready for Pickup Status: Select the order status that indicates an order is ready for pickup. This status will be used to trigger the delivery process in Shipday.
- Map Order Status to Shipday Status (and vice versa): Choose the order statuses that will be mapped to Shipday statuses. This allows you to track the delivery status of orders in both TastyIgniter and Shipday.
- Click the Save button to save your settings. Now your TastyIgniter site is integrated with Shipday Delivery, your delivery orders will be automatically sent to Shipday for dispatch and tracking.
Adding your webhook URL to Shipday
To ensure that Shipday can communicate with your TastyIgniter site, you need to add your webhook URL to your Shipday account. This URL is used by Shipday to send updates about delivery orders back to your TastyIgniter site.
This requires a paid Shipday account.
- Navigate to the Manage > Settings > Shipday Delivery Settings admin page in your TastyIgniter Admin.
- Copy the Webhook URL provided on the Shipday Delivery Settings page.
- Log in to your Shipday account and navigate to the Integrations section.
- In the Integrations section, click the API Credentials button.
- In the API Credentials section, find the Webhook Setup section and click the Add API Link button.
- In the Add API Link dialog, paste the copied Webhook URL into the URL field.
- Set the Event Types to the events you want to receive updates for. Typically, you would select all available events to ensure you receive comprehensive updates about your delivery orders.
- Click the Save button to save the webhook configuration.
- Your webhook URL is now set up, and Shipday will send updates to your TastyIgniter site whenever the selected events occur.
Marking an order as ready for pickup
To mark an order as ready for pickup, follow these steps:
- Navigate to the Manage > Orders admin page in your TastyIgniter Admin.
- Under the Status column, click on the status next to the order you want to mark as ready for pickup. This will open a dropdown menu with available actions.
- Select the configured Delivery Ready for Pickup Status status from the dropdown menu.
- The Shipday order will now be marked as ready for pickup
Assign a delivery staff member to an order
To assign a delivery staff member to an order, follow these steps:
- Navigate to the Manage > Orders admin page in your TastyIgniter Admin.
- Click on the order you want to assign a delivery staff member to. This will open the order details page.
- In the order details page, locate the Assignee section, which is typically found in the top right section of the order details page.
- Click on the ... text under the Assignee label. This will open a dialog box.
- In the dialog box, first select your configured Delivery Staff Group from the dropdown menu under Assign To Group field. This will filter the available staff members to only those in the selected group.
- Next, select the delivery staff member you want to assign to the order from the Assign To User dropdown menu. The dropdown will only show staff members from the selected group.
- Click the Save button to assign the selected delivery staff member to the order.
- The Shipday order will now be updated with the assigned delivery staff member, and they will be able to access the order in their Shipday account. If no associated Shipday Carrier account is found, a new one will be created automatically.
On-Demand Delivery
The Shipday extension supports on-demand delivery through third-party services like DoorDash, Postmates, and Uber. This feature allows restaurants to offer delivery services without maintaining their own delivery fleet.
How On-Demand Delivery Works
When Delivery Type is set to On-Demand Delivery:
-
During Checkout: When customers place a delivery order, the system automatically checks which third-party delivery services are available for the delivery address and calculates the delivery fee in real-time.
-
Delivery Fee Calculation: The delivery fee is calculated based on:
- Pickup address (restaurant location)
- Delivery address (customer address)
- Pickup time (order scheduled time)
- Available services and their current rates
-
Service Selection: Depending on your configuration:
- Manual Selection: You can choose a specific service (e.g., DoorDash) to use for all orders.
- Auto Select Lowest Fee: The system automatically selects the service with the lowest delivery fee available at checkout time.
- Auto Select Highest Fee: The system automatically selects the service with the highest delivery fee available at checkout time.
- If no services are available for the customer's address, the configured location delivery area fee will be used as a fallback.
-
Order Processing: When an order is marked as Ready for Pickup:
- The order is automatically assigned to the selected third-party delivery service
- The delivery service dispatches a driver to pick up and deliver the order
- Customers can track their delivery in real-time through Shipday
-
Order Cancellation: If an order is canceled after being assigned to a delivery service, the on-demand delivery assignment is automatically canceled.
Usage
This section covers how to integrate the Shipday Delivery extension into your own extension. The Shipday Delivery extension provides a simple API for managing delivery orders and staff assignments.
Creating a Shipday Delivery Order
This extension extends the functionality of the Igniter\Cart\Model\Order model to include methods for creating and managing delivery orders with Shipday. To create a Shipday delivery order, you can use the createShipdayDeliveryOrder method provided by the IgniterLabs\Shipday\Actions\ManagesShipdayDelivery class.
use Igniter\Cart\Models\Order;
$order = Order::find($orderId); // Replace $orderId with the actual order ID
$order->createShipdayDeliveryOrder();
Editing a Shipday Delivery Order
To edit a Shipday delivery order, you can use the editShipdayDeliveryOrder method provided by the Igniter\Cart\Model\Order model. This method allows you to update the details of an existing Shipday delivery order.
use Igniter\Cart\Models\Order;
$order = Order::find($orderId); // Replace $orderId with the actual order ID
$order->editShipdayDeliveryOrder([
'delivery_address' => '123 New Address',
'delivery_instructions' => 'Leave at the front door',
]);
Updating a Shipday Delivery Order Status
To update the status of a Shipday delivery order, you can use the updateShipdayDeliveryOrderStatus method provided by the Igniter\Cart\Model\Order model. This method allows you to change the status of an existing Shipday delivery order.
use Igniter\Cart\Models\Order;
$order = Order::find($orderId); // Replace $orderId with the actual order ID
$order->updateShipdayDeliveryStatus($shipdayStatus); // Replace shipdayStatus with the desired shipday status
Assigning a Shipday Delivery Order to a Driver
To assign a delivery staff member to an order, you can use the assignShipdayDeliveryToDriver method provided by the Igniter\Cart\Model\Order model. This method allows you to assign a staff member to a specific Shipday delivery order.
use Igniter\Cart\Models\Order;
use Igniter\User\Models\User;
$order = Order::find($orderId); // Replace $orderId with the actual order ID
$user = User::find($userId); // Replace $userId with the actual user ID of the delivery staff member
$order->assignShipdayDeliveryToDriver($order, $user);
Creating a Shipday Carrier Account
To create a Shipday carrier account for a delivery staff member, you can use the createAsShipdayDriver method provided by the Igniter\User\Models\User model. This method allows you to create a new Shipday carrier account for a specific user.
use Igniter\User\Models\User;
$user = User::find($userId); // Replace $userId with the actual user ID of the delivery staff member
$user->createAsShipdayDriver();
Assigning an Order to On-Demand Delivery Service
When using on-demand delivery, you can manually assign an order to a third-party delivery service. This is typically done automatically when an order is marked as ready for pickup, but you can also do it programmatically:
use Igniter\Cart\Models\Order;
$order = Order::find($orderId); // Replace $orderId with the actual order ID
$order->assignOrderToShipdayOnDemandDeliveryService();
This method will:
- Check for available delivery services based on the order's pickup and delivery addresses
- Select the appropriate service based on your configuration (manual selection or lowest fee)
- Assign the order to the selected service
- Log the assignment for tracking purposes
Canceling an On-Demand Delivery
If you need to cancel an on-demand delivery assignment, you can use the cancelShipdayOnDemandDelivery method:
use Igniter\Cart\Models\Order;
$order = Order::find($orderId); // Replace $orderId with the actual order ID
$order->cancelShipdayOnDemandDelivery();
This will cancel the delivery assignment with the third-party service. Note that cancellation policies may vary by service provider.
Checking On-Demand Delivery Service Availability
To check which delivery services are available for a specific address and time, you can use the getAvailableService method from the Shipday Client:
use IgniterLabs\Shipday\Classes\Client;
$client = resolve(Client::class);
$availableService = $client->getAvailableService([
'pickup_address' => '123 Restaurant St, City, State',
'delivery_address' => '456 Customer St, City, State',
'pickup_time' => '2024-01-15T18:00:00Z',
]);
if ($availableService) {
$serviceName = $availableService['name']; // e.g., 'DoorDash'
$deliveryFee = $availableService['fee']; // Delivery fee amount
} else {
// No services available
}
Getting Available On-Demand Services
To retrieve a list of all available on-demand delivery services configured in your Shipday account:
use IgniterLabs\Shipday\Classes\Client;
$client = resolve(Client::class);
$services = $client->getOnDemandServices(); // Returns array of service names, e.g., ['DoorDash', 'Postmates', 'Uber']