These docs are for v1.0. Click to read the latest docs for v2024.09.

Discussions

Ask a Question
Back to All

Need tracking number for usps

hello i am stucking in a problem:

I am developing an ecommerce website and want to create shipment with usps i ran the following json in production Environment. but unable to find usps tracking_number by which i can track in usps like in the following page:

USPS Tracking Page:

https://emailus.usps.com/s/?_gl=1*dkewrx*_ga*Nzg4Njc3NTI4LjE2NzAyNDc1MzY.*_ga_3NXP3C8S9V*MTY3MTIwMzkzNy42LjEuMTY3MTIwMzk0NC4wLjAuMA..
am i missing some thing??

here is my code

client = new \GuzzleHttp\Client();

                $response = $client->request('POST', 'https://api.easyship.com/2022-10/shipments', [
                'body' => '{
                    "origin_address": {
                    "line_1": "8210 NY-28 Richfield Springs",
                    "state": "NY",
                    "city": "richfield springs",
                    "postal_code": "13439",
                    "country_alpha2": "US",
                    "company_name": "US",
                    "contact_name": "UFS Express",
                    "contact_phone": " 520 838 1280",
                    "contact_email": "[email protected]"
                    },
                    "destination_address": {
                    "line_1": "273 W Alexander Palm Road",
                    "state": "FL",
                    "city": "Boca Raton",
                    "postal_code": "33432",
                    "contact_name": "laurie degroote",
                    "contact_phone": "12345",
                    "contact_email": "[email protected]",
                    "country_alpha2": "US"
                    },
                    "incoterms": "DDU",
                    "insurance": {
                    "is_insured": false
                    },
                    "courier_selection": {
                    "allow_courier_fallback": false,
                    "apply_shipping_rules": true,
                    "selected_courier_id": "9ac8d13c-5cc1-4fb6-ba39-c0c7354e7f4a"
                    },
                    "shipping_settings": {
                    "units": {
                    "weight": "kg",
                    "dimension": "cm"
                    },
                    "buy_label": false,
                    "buy_label_synchronous": false,
                    "printing_options": {
                    "format": "pdf",
                    "label": "4x6",
                    "commercial_invoice": "A4",
                    "packing_slip": "4x6"
                    }
                    },
                    "parcels": [
                    {
                    "items": [
                    {
                    "quantity": 1,
                    "dimensions": {
                    "length": 5,
                    "width": 10,
                    "height": 1
                    },
                    "description": "Doll clothes",
                    "category": "home_decor",
                    "contains_battery_pi966": false,
                    "contains_battery_pi967": false,
                    "contains_liquids": false,
                    "origin_country_alpha2": "US",
                    "sku": "9",
                    "actual_weight": 0.05,
                    "declared_currency": "USD",
                    "declared_customs_value": 5
                    }
                    ],
                    "total_actual_weight": 0.05
                    }
                    ]
                    }',
                'headers' => [
                    'accept' => 'application/json',
                    'authorization' => 'Bearer <My production code>',
                    'content-type' => 'application/json',
                ],
                ]);

                return $response->getBody();