Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

topship-africa

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

topship-africa

A node package to interface with the Topship.Africa API and create a shipping method for your store.

  • 0.0.5
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

Topship Open Server Docs

This library allows you to quickly and easily use the Topship Africa Shipping API via Node.js.

Installation

The following recommended installation requires npm. If you are unfamiliar with npm, see the npm docs. Npm comes installed with Node.js since node version 0.8.x, therefore, you likely already have it.

Obtain an API Key

Grab your API Key from the Topship Africa.

Setup Environment Variables

Do not hardcode your Topship Africa into your code. Instead, use an environment variable or some other secure means of protecting your Topship API Key. Following is an example of using an environment variable.

Install Package

$ npm install topship-africa

You may also use yarn to install

$ yarn add topship-africa

The following is the minimum needed code to get Qoutes and Prices for Shipment. Use this example, and modify the to and from variables:

const {topship} = require("topship-africa");

topship.quotesAndPrices(
    {
        shipmentDetail: {
            {
            senderDetails: {
                cityName: "Yaba",
                countryCode: "NG"
            },
            receiverDetails: {
                cityName: "Washington",
                countryCode: "US"
            },
            totalWeight: 4
        }
    }
);

The following is the minimum needed code to get Pickup Rate for Shipment. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.pickupRate({
  input: {
    senderDetail: {
      addressLine1: "268, Herbert Macauly way",
      addressLine2: "",
      country: "Nigeria",
      countryCode: "NG",
      state: "Lagos",
      city: "Yaba"
    },
    pickupDate: "2024-02-15T09:14:29.000Z"
  }
});

The following is the minimum needed code to get Booked Shipment. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.getBookedShipment({
  filter: {
    take: 10,
    page: 2
  }
});

The following is the minimum needed code to get Single Shipment. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.getShipmentById("5e9f8f9f8d8f8d8f8d8f8f8f");

The following is the minimum needed code to Cancel Single Shipment. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.cancelShipmentById("5e9f8f9f8d8f8d8f8d8f8f8f");

The following is the minimum needed code to Track Shipment. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.trackShipment("T619979552");

The following is the minimum needed code to get State List. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.getStates("NG");

The following is the minimum needed code to get City List. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.getCities("NG");

The following is the minimum needed code to Book a Shipment. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.saveShipment(
  {
    shipment: [
      {
        items: [
          {
            category:
              "Appliance || BeautyProducts || Jewelry || ComputerSupplies || HomeDecor || BabySupplies || TelevisionAndEntertainment || KitchenAccessories || Furniture || Gadgets || SolarPanelsAndInverter || VehicleParts || ClothingAndTextile || SportAccessories || GymEquipment || Fashion || Furniture || Education || Drones || Document || OriginalArtwork || ArtPrints || FoodItems || Medication || Fish || Herbs || BatteryLiquidElectrical || Crayfish || Driedfish || Prawns || Otherfish || GoatMeat || CowSkin || Beef || Snail || OtherMeats || PaintingsAndDrawings || ArtifactsAndHistoricalMonuments || LaptopsAndTablets || Phones || HeadphonesOrEarphonesOrAirPods || Wristwatches || VideoGames || OtherElectronicsOrGadgets || GoldSilverAndFineJewelry || PreciousStonesAndJewels || CostumeJewelry || HerbsAndPlants || FoodstuffAndFoodProducts || Drinks || Others",
            description: "Gucci Bag",
            weight: 4,
            quantity: 1,
            value: 99
          }
        ],
        itemCollectionMode: "DropOff || PickUp",
        pricingTier: "Budget || Express || FedEx || Premium || LastMileBudget",
        insuranceType: "None || Premium || Extended",
        insuranceCharge: 0,
        discount: 200,
        shipmentRoute: "Import || Export || Domestic",
        shipmentCharge: 128000,
        pickupCharge: 4000,
        deliveryLocation: "Lagos",
        pickupId: "topship-1234",
        pickupPartner: "Fez || Standard || Dellyman || Sendstack || Messenger",
        valueAddedTaxCharge: 800,
        senderDetail: {
          name: "John Doe",
          email: "john.doe@gmail.com",
          phoneNumber: "08080808080",
          addressLine1: "SPencer",
          addressLine2: "Alagomeji",
          addressLine3: "Yaba",
          country: "Nigeria",
          state: "Lagos",
          city: "Lagos",
          countryCode: "NG",
          postalCode: "100001"
        },
        receiverDetail: {
          name: "Jane Doe",
          email: "jane.doe@gmail.",
          phoneNumber: "070347890",
          addressLine1: "Garki",
          addressLine2: "Maitama",
          addressLine3: "Suleja",
          country: "Nigeria",
          state: "Abuja",
          city: "Abuja",
          countryCode: "NG",
          postalCode: "111000"
        }
      }
    ]
  },
  process.env.TOPSHIP_API_KEY
);

The following is the minimum needed code to Pay for Shipment. Use this example, and modify the to and from variables:

const { topship } = require("topship-africa");

topship.payForShipment(
  {
    detail: {
      shipmentId: "string"
    }
  },
  process.env.TOPSHIP_API_KEY
);

Keywords

FAQs

Package last updated on 31 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc