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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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

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

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

PHP Build Version
Package Version
Requires php Version >=7.4
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kejubayer/pathao-api-integration contains the following files

Loading the files please wait ...