Download the PHP package kejubayer/pathao-api-integration without Composer
On this page you can find all versions of the php package kejubayer/pathao-api-integration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kejubayer/pathao-api-integration
More information about kejubayer/pathao-api-integration
Files in kejubayer/pathao-api-integration
Package pathao-api-integration
Short Description Laravel Pathao Courier API integration package for creating orders, delivery price calculation, parcel tracking, merchant stores, and webhook status updates.
License MIT
Informations about the package pathao-api-integration
Pathao Courier API Integration for Laravel
A Laravel package for Pathao Courier API integration in Bangladesh. Create Pathao courier orders, calculate delivery price, get stores, cities, zones, and areas, track parcels, cancel orders, and receive parcel status updates through a webhook.
kejubayer/pathao-api-integration provides a Laravel service, facade, config file, route, migration, and model for common Pathao Courier merchant API workflows.
Features
- Pathao Courier order creation from Laravel
- Pathao delivery price calculation
- Pathao merchant store list
- City, zone, and area lookup
- Parcel tracking by consignment ID
- Order cancellation
- Parcel status webhook route
- Webhook event storage in database
- Laravel facade and dependency injection support
- Laravel package auto-discovery
Keywords
Pathao Laravel package, Pathao Courier API, Pathao API integration, Laravel courier API, Bangladesh courier API, Pathao parcel tracking, Pathao webhook, Pathao delivery charge, Pathao merchant API.
Requirements
- PHP 7.4 or higher
- Laravel 8, 9, 10, or 11
- Guzzle 7
Laravel Pathao API Installation
Install the package with Composer:
Publish the configuration file:
Add your Pathao credentials to .env:
Laravel package auto-discovery will register the service provider and facade automatically.
Run the migrations to create the parcel status webhook table:
Pathao API Configuration
The package configuration is stored in config/pathao.php.
| Key | Environment Variable | Description |
|---|---|---|
base_url |
PATHAO_BASE_URL |
Pathao API base URL. Defaults to https://api-hermes.pathao.com. |
client_id |
PATHAO_CLIENT_ID |
Pathao API client ID. |
client_secret |
PATHAO_CLIENT_SECRET |
Pathao API client secret. |
username |
PATHAO_USERNAME |
Pathao merchant username. |
password |
PATHAO_PASSWORD |
Pathao merchant password. |
webhook_route |
PATHAO_WEBHOOK_ROUTE |
Webhook route path for parcel status callbacks. Defaults to pathao/webhook/parcel-status. |
Pathao Courier API Usage
Import the facade:
Get Access Token
Create Pathao Courier Order
Pathao requires store_id when creating an order. Use Pathao::stores() to get your available stores, then pass the selected store_id to Pathao::createOrder().
Pathao Delivery Price Calculation
Pathao Store List
Pathao City List
Pathao Zone List
Pathao Area List
Track Pathao Parcel
Cancel Pathao Order
Pathao Parcel Status Webhook
The package registers a POST webhook route for Pathao parcel status updates:
Use this URL in your Pathao webhook/callback settings:
When Pathao sends a parcel status callback, the package stores the event in the pathao_parcel_statuses table.
Stored columns:
| Column | Description |
|---|---|
consignment_id |
Consignment ID from the webhook payload, when available. |
merchant_order_id |
Merchant order ID from the webhook payload, when available. |
store_id |
Pathao store ID from the webhook payload. |
event |
Pathao webhook event name, such as order.created. |
delivery_fee |
Delivery fee from the webhook payload. |
pathao_updated_at |
Pathao updated_at value from the webhook payload. |
pathao_timestamp |
Pathao timestamp value from the webhook payload. |
payload |
Full webhook request payload as JSON. |
received_at |
Time the webhook was received. |
Example webhook payload:
Read saved parcel statuses:
To customize the webhook URL, change PATHAO_WEBHOOK_ROUTE:
Pathao API Data Reference
Pathao Create Order Data
| Field | Type | Required | Description |
|---|---|---|---|
store_id |
integer | Yes | Pathao store ID from Pathao::stores(). |
merchant_order_id |
string | No | Your internal order ID. |
recipient_name |
string | Yes | Customer name. |
recipient_phone |
string | Yes | Customer phone number. |
recipient_secondary_phone |
string | No | Additional customer phone number. |
recipient_address |
string | Yes | Full delivery address. |
recipient_city |
integer | No | City ID from Pathao::cities(). |
recipient_zone |
integer | No | Zone ID from Pathao::zones($cityId). |
recipient_area |
integer | No | Area ID from Pathao::areas($zoneId). |
delivery_type |
integer | Yes | Delivery type ID supported by Pathao. |
item_type |
integer | Yes | Item type ID supported by Pathao. |
special_instruction |
string | No | Delivery instruction. |
item_quantity |
integer | Yes | Number of items. |
item_weight |
number | Yes | Parcel weight. |
amount_to_collect |
number | Yes | Cash collection amount. Use 0 for non-COD orders. |
item_description |
string | No | Parcel or product description. |
Pathao Price Calculation Data
| Field | Type | Required | Description |
|---|---|---|---|
store_id |
integer | Yes | Pathao store ID. |
item_type |
integer | Yes | Item type ID supported by Pathao. |
delivery_type |
integer | Yes | Delivery type ID supported by Pathao. |
item_weight |
number | Yes | Parcel weight. |
recipient_city |
integer | Yes | Destination city ID. |
recipient_zone |
integer | Yes | Destination zone ID. |
Laravel Method Reference
| Method | Description |
|---|---|
getAccessToken() |
Issues an access token using configured Pathao credentials. |
createOrder(array $data) |
Creates a courier order. |
priceCalculation(array $data) |
Calculates delivery price. |
stores() |
Returns available merchant store list. |
cities() |
Returns available city list. |
zones($cityId) |
Returns zones for a city. |
areas($zoneId) |
Returns areas for a zone. |
trackOrder($consignmentId) |
Returns tracking information for a consignment. |
cancelOrder($consignmentId) |
Cancels an order by consignment ID. |
Pathao API Endpoints Used
| Method | HTTP | Endpoint |
|---|---|---|
getAccessToken() |
POST | /aladdin/api/v1/issue-token |
createOrder() |
POST | /aladdin/api/v1/orders |
priceCalculation() |
POST | /aladdin/api/v1/merchant/price-plan |
stores() |
GET | /aladdin/api/v1/stores |
cities() |
GET | /aladdin/api/v1/city-list |
zones() |
GET | /aladdin/api/v1/cities/{cityId}/zone-list |
areas() |
GET | /aladdin/api/v1/zones/{zoneId}/area-list |
trackOrder() |
GET | /aladdin/api/v1/orders/{consignmentId}/info |
cancelOrder() |
POST | /aladdin/api/v1/orders/{consignmentId}/cancel |
Dependency Injection
You can also inject the contract instead of using the facade:
License
This package is open-sourced software licensed under the MIT license.
All versions of pathao-api-integration with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^7.0