Skip to main content

Get Shipment Details using Shipment ID

In this example use case, we will retrieve shipment details using a shipment ID with the getShipmentById API. This guide demonstrates how to implement a headless commerce solution using the Fynd Platform SDK.

Prerequisites

  • Node.js v18↗ or later

  • Before you begin, collect the following credentials and identifiers from the Fynd Commerce platform for headless implementation:

    • Application ID
    • Application Token

    These credentials establish the connection between your API calls and your storefront account, ensuring secure and authenticated access to platform resources.

Obtaining Credentials

Follow these steps to retrieve your credentials from the Fynd Commerce portal:

  1. Log in to the Fynd Commerce.
  2. Navigate to CompanySettingsDevelopers section.
  3. Go to the Application Token tab to collect the required credentials.

Project Setup

  1. Create a new directory for your project.
  2. Navigate to your project directory.
  3. Create a new JavaScript file (e.g., getShipmentById.js).

Install Dependencies

  1. Install the FDK Client JavaScript SDK:
npm install @gofynd/fdk-client-javascript
  1. Initialize your Node.js project.
npm init -y

SDK Configuration

The following code initializes the Fynd Platform SDK for headless architecture. This configuration establishes the foundation for all API interactions with Fynd's backend services.

import {
ApplicationConfig,
ApplicationClient,
} from "@gofynd/fdk-client-javascript";

const config = new ApplicationConfig({
applicationID: "YOUR_APPLICATION_ID", // Replace with your actual Application ID
applicationToken: "YOUR_APPLICATION_TOKEN", // Replace with your actual Application Token
domain: "https://api.fynd.com"
});

// Set appropriate log level for your environment
config.setLogLevel("info");

// Initialize the application client
const applicationClient = new ApplicationClient(config);

Logging Configuration

The SDK provides comprehensive logging capabilities to help with development and debugging. Here, we have used debug.

platformConfig.setLogLevel("debug");

Available Log Levels

Choose the appropriate log level based on your environment and debugging needs:

  • trace: Most detailed logs, including all internal operations
  • debug: Detailed information useful for debugging (recommended for development)
  • info: General information about application operations
  • warn: Warnings about potential issues
  • error: Error messages only

Fetch Shipment Details

Retrieve shipment information using the shipment ID:

const response = await applicationClient.order.getShipmentById({
"shipmentId": "17549816125261339115", // Replace with actual shipment ID
"allowInactive": false
});

console.log("Shipment Details:", response);

Parameters:

  • shipmentId (string, required): Unique identifier for the shipment you want to retrieve
  • allowInactive (boolean, optional): Whether to include inactive shipments in the response (default: false)

Execute the Script

Run the following command to get the shipment details:

node getShipmentById.js

Expected Response

Upon successful execution, you'll receive a comprehensive shipment object containing detailed information about the order, tracking details, and fulfillment information:

{
shipment: {
order_id: 'FY689AE4EC13496F96BB',
beneficiary_details: false,
shipment_created_at: '2025-08-12T12:23:33.000Z',
shipment_created_ts: '2025-08-12T06:53:32Z',
shipment_id: '17549816125261339115',
shipment_status: {
title: 'In Transit',
value: 'in_transit',
hex_code: '#7043F7'
},
track_url: 'https://powerpartner.fynd.io/',
traking_no: 'Tracking No.: 1',
awb_no: '1',
dp_name: 'self delivery',
tracking_details: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
total_bags: 1,
order_type: 'HomeDelivery',
is_validated: false,
currency: { currency_code: 'INR', currency_symbol: '₹' },
currency_info: { ordering_currency: [Object], conversion_rate: [Object] },
bags: [ [Object] ],
size_info: { m3cy6ddw_PO: [Object] },
charges: [],
fulfillment_option: {
name: 'Standard Delivery',
slug: 'standard-delivery',
type: 'HomeDelivery',
is_default: true
},
promise: { show_promise: true, timestamp: [Object] },
total_details: { sizes: 1, total_price: 500, pieces: 1 },
fulfilling_store: {
name: 'PowerPartner',
company_id: 8845,
id: 84676,
code: 'HS-d4590',
tags: []
},
fulfilling_company: { id: 8845, name: 'PowerPartner' },
need_help_url: 'https://fynd.freshdesk.com/support/solutions/33000003306'
}
}

Was this section helpful?