PHP code example of kejubayer / pathao-api-integration

1. Go to this page and download the library: Download kejubayer/pathao-api-integration 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/ */

    

kejubayer / pathao-api-integration example snippets


use Pathao;

$token = Pathao::getAccessToken();

$stores = Pathao::stores();
$storeId = $stores['data']['data'][0]['store_id'];

$order = Pathao::createOrder([
    'store_id' => $storeId,
    'merchant_order_id' => 'ORD-1001',
    'recipient_name' => 'Customer Name',
    'recipient_phone' => '017XXXXXXXX',
    'recipient_address' => 'House 1, Road 2, Dhaka',
    'delivery_type' => 48,
    'item_type' => 2,
    'special_instruction' => 'Handle with care',
    'item_quantity' => 1,
    'item_weight' => 0.5,
    'amount_to_collect' => 1200,
    'item_description' => 'Product description',
]);

$price = Pathao::priceCalculation([
    'store_id' => 12345,
    'item_type' => 2,
    'delivery_type' => 48,
    'item_weight' => 0.5,
    'recipient_city' => 1,
    'recipient_zone' => 2,
]);

$stores = Pathao::stores();

$cities = Pathao::cities();

$zones = Pathao::zones($cityId);

$areas = Pathao::areas($zoneId);

$tracking = Pathao::trackOrder($consignmentId);

$cancelled = Pathao::cancelOrder($consignmentId);

use Kejubayer\PathaoIntegration\Models\PathaoParcelStatus;

$statuses = PathaoParcelStatus::latest()->get();

use Kejubayer\PathaoIntegration\Contracts\PathaoInterface;

class OrderController
{
    public function store(PathaoInterface $pathao)
    {
        return $pathao->cities();
    }
}
bash
php artisan vendor:publish --tag=pathao-config
bash
php artisan migrate
text
POST /pathao/webhook/parcel-status