Web Dev LK Logo

How to Integrate Local Shipping APIs into Online Stores 2025

Complete technical guide to integrating Sri Lankan shipping provider APIs for automated shipping, tracking, and label generation

How to integrate local shipping APIs into online stores in Sri Lanka

Understanding Shipping API Integration

Shipping API integration automates the entire shipping process for e-commerce stores, from calculating rates to generating labels and tracking deliveries. Instead of manually entering shipment details into courier websites, integrated systems automatically create shipments, calculate costs, print labels, and update customers with tracking information - saving hours of work daily.

For Sri Lankan e-commerce businesses, shipping API integration is essential for scaling operations. Manual shipping processes become overwhelming beyond 20-30 daily orders. Automated shipping reduces errors, speeds up fulfillment, provides better customer experience through real-time tracking, and allows businesses to compare rates across multiple couriers to minimize costs.

Available Shipping APIs in Sri Lanka

1. Aramex API - Most Complete

Aramex provides a comprehensive REST API with full documentation. Supports rate calculation, shipment creation, label generation, pickup scheduling, tracking, and COD handling.

  • ✓ Full REST API with JSON responses
  • ✓ Excellent documentation and developer support
  • ✓ WooCommerce plugin available
  • ✓ Sandbox environment for testing
  • ✓ Real-time rate calculation
  • ✓ Automatic label generation (PDF)
  • ✓ COD support for Sri Lankan orders

API Access: Free (requires Aramex account)

2. DHL Express API

DHL offers MyDHL API for e-commerce integration. Provides rate quotes, shipment creation, tracking, and label printing. Good for international shipments from Sri Lanka.

  • ✓ RESTful XML/JSON API
  • ✓ Comprehensive documentation
  • ✓ Test environment available
  • ✓ WooCommerce & Shopify plugins
  • ✓ Excellent for international shipping

3. FedEx Web Services API

FedEx provides SOAP-based web services API. More complex than REST APIs but very powerful. Best for businesses with high international shipping volumes.

4. Pronto Lanka - Local Courier API

Pronto offers API services for local delivery within Sri Lanka. Contact their technical team for API access and documentation. Good for domestic COD shipments.

5. PickMe Fleet API - On-Demand Delivery

PickMe offers fleet services with API for on-demand delivery. Suitable for same-day local deliveries in Colombo and major cities.

Integration Process: Step-by-Step

Step 1: Get API Credentials

Contact shipping provider to request API access. Provide business details, website URL, and intended usage. You'll receive API keys, account numbers, and access to developer documentation and sandbox environment.

Step 2: Review API Documentation

Study the API documentation thoroughly. Understand:

  • • Authentication methods (API keys, OAuth, etc.)
  • • Available endpoints (rate calculation, shipment creation, tracking)
  • • Request/response formats (JSON, XML)
  • • Rate limits and usage restrictions
  • • Error codes and handling

Step 3: Set Up Development Environment

Use sandbox/test environment first. Never test with production API on live store. Set up local development environment, install necessary libraries (HTTP clients, PDF generators), and prepare test data.

Step 4: Implement Core Functions

Develop these essential functions:

  • • Rate calculation (get shipping costs)
  • • Shipment creation (book shipments)
  • • Label generation (download PDF labels)
  • • Tracking integration (get status updates)
  • • Pickup scheduling (request courier pickup)

Step 5: Error Handling & Logging

Implement comprehensive error handling for API failures, timeouts, invalid addresses, weight limits exceeded, etc. Log all API requests/responses for debugging. Provide user-friendly error messages.

Step 6: Testing & Quality Assurance

Test thoroughly with various scenarios: different weights, dimensions, destinations, COD vs prepaid, international vs domestic. Verify label printing, tracking updates, and rate accuracy.

Step 7: Go Live & Monitor

Switch to production API credentials. Monitor API performance, response times, error rates. Set up alerts for failures. Gather feedback from shipping team about any issues.

Technical Implementation Example

// Example: Aramex Rate Calculation API Call
const calculateShippingRate = async (orderData) => {
  const apiUrl = 'https://ws.aramex.net/ShippingAPI.V2/RateCalculator/Service_1_0.svc/json/CalculateRate';

  const requestData = {
    ClientInfo: {
      UserName: 'your_username',
      Password: 'your_password',
      AccountNumber: 'your_account',
      AccountPin: 'your_pin',
      AccountEntity: 'CMB',
      AccountCountryCode: 'LK'
    },
    OriginAddress: {
      City: 'Colombo',
      CountryCode: 'LK'
    },
    DestinationAddress: {
      City: orderData.city,
      CountryCode: 'LK'
    },
    ShipmentDetails: {
      Weight: orderData.weight,
      NumberOfPieces: 1,
      PaymentType: 'P',
      ProductGroup: 'DOM',
      ProductType: 'OND'
    }
  };

  const response = await fetch(apiUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(requestData)
  });

  const data = await response.json();
  return data.TotalAmount.Value;
};

Integration Costs & Timelines

Basic Integration

LKR 50,000-75,000
  • ✓ Single courier API
  • ✓ Rate calculation
  • ✓ Basic label generation
  • ✓ Simple tracking

Timeline: 1-2 weeks

Professional Integration

LKR 100,000-150,000
  • ✓ Multi-courier support
  • ✓ Rate comparison
  • ✓ Auto label printing
  • ✓ Advanced tracking
  • ✓ Pickup scheduling

Timeline: 2-4 weeks

Enterprise Integration

LKR 200,000-300,000
  • ✓ All professional features
  • ✓ Custom shipping rules
  • ✓ Returns management
  • ✓ Analytics dashboard
  • ✓ Warehouse integration

Timeline: 4-6 weeks

Frequently Asked Questions

Which shipping companies offer APIs in Sri Lanka? Major shipping companies offering APIs in Sri Lanka include: Aramex (full REST API), DHL Express (API and WooCommerce plugin), FedEx (Web Services API), Pronto (API available), Kangaroo (developing API), Sri Lanka Post (EMS tracking API), and Pickme Fleet (delivery API). International couriers have better API documentation than local providers.

How much does shipping API integration cost? Shipping API integration costs LKR 50,000-200,000 depending on complexity. Simple single courier integration: LKR 50,000-75,000. Multi-courier with rate comparison: LKR 100,000-150,000. Advanced features (automatic label printing, tracking, returns): LKR 150,000-250,000. Most APIs are free to use, you only pay shipping rates to couriers.

What features do shipping APIs provide? Shipping APIs provide: Real-time rate calculation based on weight/dimensions/ destination, shipping label generation (PDF), tracking number creation, package tracking/status updates, pickup scheduling, address validation, delivery time estimates, COD (Cash on Delivery) support, proof of delivery, and returns management.

Do I need technical knowledge to integrate shipping APIs? Yes, shipping API integration requires programming knowledge (PHP, JavaScript, Python, etc.), understanding of REST/SOAP APIs, JSON/XML parsing, and web development experience. For WooCommerce/Shopify, some plugins are available that reduce technical requirements, but custom integration needs developer expertise.

Professional Shipping API Integration Services

Web Dev LK provides complete shipping API integration services for e-commerce websites. We have extensive experience integrating Aramex, DHL, FedEx, Pronto, and other shipping providers with WooCommerce, Shopify, and custom e-commerce platforms. Our integration includes rate calculation, label generation, tracking, COD handling, and multi-courier support.

Our team handles the complete integration process from API setup to testing and deployment. We provide training for your staff, documentation, and ongoing support. Integration typically takes 1-4 weeks depending on complexity. Contact us at +94766881010 or hello@web-dev.lk for a free consultation and quote.

Need Shipping API Integration?

Save time and reduce shipping costs with automated shipping API integration. Our experts handle complete setup, testing, and training for seamless shipping operations.