PHPackages                             aoropeza/detrackshippingmanager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. aoropeza/detrackshippingmanager

ActiveMagento2-module[HTTP &amp; Networking](/categories/http)

aoropeza/detrackshippingmanager
===============================

Integration with Detrack shipping service for delivery management and tracking.

00PHP

Since Apr 30Pushed 2mo agoCompare

[ Source](https://github.com/adolforopeza/DetrackShippingManager)[ Packagist](https://packagist.org/packages/aoropeza/detrackshippingmanager)[ RSS](/packages/aoropeza-detrackshippingmanager/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

DetrackShippingManager for Magento 2
====================================

[](#detrackshippingmanager-for-magento-2)

This module integrates Magento 2 with the [Detrack](https://www.detrack.com/) delivery management API, enabling order-based delivery creation, tracking, and management directly from the Magento admin panel.

Business Context
----------------

[](#business-context)

The core function of this module is to synchronize Magento orders with Detrack as delivery jobs, and provide a centralized UI for managing those deliveries.

**Key Features:**

1. **Shipping Method**: Provides a "Detrack" carrier option at checkout with configurable pricing and country restrictions.
2. **Delivery Management UI**: Admin grid listing all Detrack deliveries fetched from the API with search and filtering capabilities.
3. **Order Integration**: Automatically maps Magento order data (customer info, shipping address, products) to Detrack delivery fields.
4. **CRUD Operations**: Create, view, edit, and delete deliveries via the Detrack API directly from Magento admin.
5. **Order Grid**: A dedicated admin grid showing Magento orders eligible for Detrack shipment (filtered by status and shipping method).
6. **Configurable Settings**: API credentials, URL endpoints, order statuses, run numbers, job types, and predefined box/package templates.
7. **Database Columns**: Adds `detrack_status`, `detrack_tracking_no`, and `detrack_sended` columns to the `sales_order` table.

**Example Scenario:**

- A customer places an order selecting the "Detrack" shipping method.
- An admin user navigates to the Detrack Orders grid, selects the order, and creates a delivery job in Detrack.
- The delivery details (DO number, tracking, status, assigned vehicle) are synced back and viewable/editable from the Magento admin.

*Note: This module handles the integration and data synchronization with Detrack only. Pricing, delivery zones, and vehicle assignments are managed via the Detrack platform and module configuration.*

Prerequisites
-------------

[](#prerequisites)

### Detrack Account

[](#detrack-account)

To use this module, you need an active Detrack account.

- [**Create a Detrack account**](https://app.detrack.com/dashboard/#/login)
- [**API v1 Documentation**](https://help.detrack.com/en/collections/3411970-detrack-v1-api-documentation)

### Required Fields in Detrack

[](#required-fields-in-detrack)

Be sure to enable the following fields in your Detrack settings so that the integration works properly:

FieldDescriptionRequiredAPI KeySecret API v1 key. Obtained from the Detrack administration panel.YesRun NumberRoute or shift number. Used to group related deliveries for the same driver.YesJob TypeType of work (Delivery, Pickup, Installation, etc.).YesVehicleID of the vehicle assigned to the delivery.NoDriverName or ID of the driver assigned to the job.YesTracking NumberUnique tracking number for each generated delivery.YesCustomer NameName of the customer receiving the delivery.YesCustomer PhoneCustomer phone number for SMS notifications and updates.NoCustomer EmailCustomer email for sending confirmations and tracking links.NoDelivery DateScheduled delivery date.YesAddressFull destination address for the delivery.YesBox / PackageType of box or package. Must be configured in the product catalog.NoInstallation
------------

[](#installation)

### Composer

[](#composer)

To install the module via Composer:

```
composer require aoropeza/detrackshippingmanager
bin/magento module:enable Aoropeza_DetrackShippingManager
bin/magento setup:upgrade
bin/magento setup:di:compile
```

Usage
-----

[](#usage)

### Admin Configuration

[](#admin-configuration)

1. Go to the Magento Admin Panel.
2. Navigate to **Stores &gt; Configuration &gt; Dev Oropeza &gt; Detrack Settings**.
3. **API Credentials**:
    - **API Key Secret**: Your Detrack API key for authentication.
4. **API URL's**:
    - **Url Base**: Base URL for the Detrack API (default: `https://app.detrack.com/api/v1/`).
    - Individual endpoint paths for listing, creating, editing, deleting, and viewing deliveries, as well as vehicles.
5. **Settings Fields**:
    - **Status Order to send**: Which order statuses are eligible for Detrack delivery (default: `pending,processing`).
    - **Run No.**: Route/run number configuration for grouping related deliveries.
    - **Job Type**: Type of job (e.g., DELIVERY, DROP OFF, PICK UP).
    - **Box Settings**: Predefined package/box templates with dimensions and weight.

### Shipping Method Configuration

[](#shipping-method-configuration)

1. Navigate to **Stores &gt; Configuration &gt; Sales &gt; Shipping Methods &gt; Detrack**.
2. **Enabled**: Activate/Deactivate the carrier.
3. **Method Name / Title**: Display names for the shipping method.
4. **Price**: Flat shipping rate.
5. **Ship to Applicable Countries**: All or specific countries.
6. **Displayed Error Message**: Custom error shown when the method is unavailable.

### Frontend/Admin Flow

[](#frontendadmin-flow)

1. Customer selects "Detrack" as the shipping method during checkout.
2. Admin views eligible orders in the **Detrack Orders** grid.
3. Admin creates a delivery job, which sends order data to the Detrack API.
4. Delivery details are viewable and editable in the **Delivery Management** grid.
5. The `sales_order` table is updated with `detrack_status`, `detrack_tracking_no`, and `detrack_sended` flag.

Magento REST API Reference
--------------------------

[](#magento-rest-api-reference)

This module exposes Magento REST endpoints that wrap the Detrack API operations. All requests require admin authentication via a bearer token.

### Base URL

[](#base-url)

`/rest/V1/detrack`

### Authentication

[](#authentication)

Before calling any endpoint, obtain an admin token:

```
TOKEN=$(curl -s -X POST "http://yourstore.com/rest/V1/integration/admin/token" \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"your_password"}')
```

Include the token in all subsequent requests:

```
-H "Authorization: Bearer $TOKEN"
```

### Endpoints

[](#endpoints)

---

### 1. List All Deliveries

[](#1-list-all-deliveries)

**GET** `/rest/V1/detrack/deliveries?date={YYYY-MM-DD}`

Fetches all deliveries for a given date (defaults to today if omitted).

Example Request```
curl -X GET "http://yourstore.com/rest/V1/detrack/deliveries?date=2026-04-30" \
  -H "Authorization: Bearer $TOKEN"
```

Response Example```
[
  {
    "do": "DO-20260430-001",
    "order_no": "100000001",
    "name": "John",
    "last_name": "Doe",
    "address": "123 Main St, City, State, 12345, United States",
    "phone": "+1234567890",
    "status": "pending",
    "tracking_status": "unassigned",
    "assign_to": "",
    "date": "2026-04-30",
    "start_date": "2026-04-30 08:00:00",
    "tracking_no": "TRK123456"
  }
]
```

---

### 2. View Delivery

[](#2-view-delivery)

**POST** `/rest/V1/detrack/deliveries/view`

Retrieves details for a specific delivery by DO number.

Request Payload```
{
  "doNumber": "DO-20260430-001",
  "date": "2026-04-30"
}
```

Example Request```
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/view" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "doNumber": "DO-20260430-001",
    "date": "2026-04-30"
  }'
```

Response Example```
{
  "do": "DO-20260430-001",
  "order_no": "100000001",
  "name": "John",
  "last_name": "Doe",
  "address": "123 Main St, City, State, 12345, United States",
  "phone": "+1234567890",
  "status": "pending",
  "tracking_status": "unassigned",
  "assign_to": "Vehicle-01",
  "date": "2026-04-30",
  "instructions": "Leave at front door",
  "notify_email": "john@example.com",
  "run_no": "1",
  "tracking_no": "TRK123456",
  "job_type": "delivery"
}
```

---

### 3. Create Delivery

[](#3-create-delivery)

**POST** `/rest/V1/detrack/deliveries/create`

Creates a new delivery job in Detrack from order data.

Request Payload```
{
  "deliveryData": {
    "do": "DO-20260430-002",
    "date": "2026-04-30",
    "order_no": "100000002",
    "name": "Jane",
    "last_name": "Smith",
    "address": "456 Oak Ave, City, State, 67890, United States",
    "phone": "+0987654321",
    "notify_email": "jane@example.com",
    "tracking_no": "TRK654321",
    "instructions": "Call before delivery",
    "run_no": "2",
    "job_type": "delivery"
  }
}
```

Example Request```
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/create" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "deliveryData": {
      "do": "DO-20260430-002",
      "date": "2026-04-30",
      "order_no": "100000002",
      "name": "Jane",
      "last_name": "Smith",
      "address": "456 Oak Ave, City, State, 67890, United States",
      "phone": "+0987654321",
      "notify_email": "jane@example.com",
      "tracking_no": "TRK654321",
      "instructions": "Call before delivery",
      "run_no": "2",
      "job_type": "delivery"
    }
  }'
```

Response Example```
{
  "do": "DO-20260430-002",
  "order_no": "100000002",
  "status": "ok",
  "tracking_no": "TRK654321"
}
```

---

### 4. Update Delivery

[](#4-update-delivery)

**POST** `/rest/V1/detrack/deliveries/update`

Updates an existing delivery's fields in Detrack.

Request Payload```
{
  "doNumber": "DO-20260430-001",
  "fields": {
    "status": "in_transit",
    "assign_to": "Vehicle-01",
    "instructions": "Updated: Ring doorbell"
  }
}
```

Example Request```
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/update" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "doNumber": "DO-20260430-001",
    "fields": {
      "status": "in_transit",
      "assign_to": "Vehicle-01",
      "instructions": "Updated: Ring doorbell"
    }
  }'
```

Response Example```
{
  "do": "DO-20260430-001",
  "status": "ok",
  "assign_to": "Vehicle-01"
}
```

---

### 5. Delete Delivery

[](#5-delete-delivery)

**POST** `/rest/V1/detrack/deliveries/delete`

Deletes a delivery job from Detrack by DO number.

Request Payload```
{
  "doNumber": "DO-20260430-001"
}
```

Example Request```
curl -X POST "http://yourstore.com/rest/V1/detrack/deliveries/delete" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"doNumber": "DO-20260430-001"}'
```

Response Example```
true
```

---

### 6. Get Vehicles

[](#6-get-vehicles)

**GET** `/rest/V1/detrack/vehicles`

Fetches all available vehicles/drivers from Detrack for assignment.

Example Request```
curl -X GET "http://yourstore.com/rest/V1/detrack/vehicles" \
  -H "Authorization: Bearer $TOKEN"
```

Response Example```
[
  {
    "vehicle_id": "V001",
    "name": "Van 1",
    "status": "active",
    "driver": "Driver A"
  },
  {
    "vehicle_id": "V002",
    "name": "Truck 2",
    "status": "active",
    "driver": "Driver B"
  }
]
```

### Detrack API Configuration

[](#detrack-api-configuration)

The module communicates with the Detrack REST API (v1) internally. Endpoints are configured at:

**Stores &gt; Configuration &gt; Dev Oropeza &gt; Detrack Settings**

SettingConfig PathDefault ValueAPI Key`detrack/api/key`*(required)*Base URL`detrack/api_url/base``https://app.detrack.com/api/v1/`List Deliveries`detrack/api_url/list``deliveries/view/all.json`Create Delivery`detrack/api_url/add``deliveries/create.json`Update Delivery`detrack/api_url/edit``deliveries/update.json`Delete Delivery`detrack/api_url/delete``deliveries/delete.json`View Delivery`detrack/api_url/view``deliveries/view.json`Vehicles`detrack/api_url/vehicles``vehicles/view/all.json`

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance56

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3385221?v=4)[Adolfo Oropeza](/maintainers/adolforopeza)[@adolforopeza](https://github.com/adolforopeza)

---

Top Contributors

[![adolforopeza](https://avatars.githubusercontent.com/u/3385221?v=4)](https://github.com/adolforopeza "adolforopeza (1 commits)")

---

Tags

adobe-commerceapi-integrationbackend-developmentcustom-moduledetracklogisticsmagento2order-trackingphpshipping-managementsupply-chain

### Embed Badge

![Health badge](/badges/aoropeza-detrackshippingmanager/health.svg)

```
[![Health](https://phpackages.com/badges/aoropeza-detrackshippingmanager/health.svg)](https://phpackages.com/packages/aoropeza-detrackshippingmanager)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25026.1M82](/packages/php-http-cache-plugin)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k122](/packages/httpsoft-http-message)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)[swoft/websocket-server

swoft websocket server component

16135.7k5](/packages/swoft-websocket-server)[thesis/nats

Async (fiber based) client for Nats.

754.4k](/packages/thesis-nats)[jasny/http-signature

Implementation of the IETF HTTP Signatures draft RFC

10104.7k](/packages/jasny-http-signature)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
