New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aramex-pillvery

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aramex-pillvery

A simple wrapper for Aramex (JSON) API to manage shipments, tracking, and printing labels.

  • 1.0.4
  • latest
  • npm
  • Socket score

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

Aramex Create Shipments API Wrapper

A Node.js wrapper for the Aramex Shipping API that simplifies creating shipments. It supports both testing and production environments and offers an easy-to-use interface for mapping required parameters.


📦 Installation

Install the package using npm:

npm install aramex-pillvery

🚀 Usage

Import the Package

const Aramex = require('aramex-pillvery');

Initialize the Class

Create a new instance of the Aramex API wrapper with your credentials and environment settings.

const aramex = new Aramex({
  UserName: "your_username",
  Password: "your_password",
  AccountNumber: "your_account_number",
  AccountPin: "your_account_pin",
  isTesting: true, // Set to false for production
});

Create a Shipment

Call the createShipment method to create a new shipment.

(async () => {
  try {
    const response = await aramex.createShipment({
      client_order_id: "12345",
      value: 50,
      customer_name: "John Doe",
      customer_phone: "962790123456",
      pickup_lat: 31.963158,
      pickup_lng: 35.930359,
      lat: 31.95,
      lng: 35.91,
      preparation_time: 15, // Default: 1 minute
      payment_type: 1, // 1 = CASH, 2 = CREDIT
    });

    console.log("Shipment created successfully:", response);
  } catch (error) {
    console.error("Error:", error);
  }
})();

📋 Parameters

Constructor Parameters

ParameterTypeDescription
UserNameStringYour Aramex API username.
PasswordStringYour Aramex API password.
AccountNumberStringYour Aramex account number.
AccountPinStringYour Aramex account PIN.
isTestingBooleanSet to true for the testing environment and false for production.

createShipment Method Parameters

ParameterTypeDescription
client_order_idStringClient's order ID. Mapped to Reference1.
valueNumberValue of the shipment. Mapped to CustomsValueAmount.Value.
customer_nameStringName of the customer. Mapped to Consignee.Contact.PersonName.
customer_phoneStringCustomer's phone number. Mapped to Consignee.Contact.PhoneNumber1.
pickup_latNumberLatitude for the shipper's pickup location. Mapped to Shipper.PartyAddress.Latitude.
pickup_lngNumberLongitude for the shipper's pickup location. Mapped to Shipper.PartyAddress.Longitude.
latNumberLatitude for the consignee's address. Mapped to Consignee.PartyAddress.Latitude.
lngNumberLongitude for the consignee's address. Mapped to Consignee.PartyAddress.Longitude.
preparation_timeNumberTime in minutes to add to the current time for shipment. Defaults to 1.
payment_typeNumberPayment type: 1 for CASH and 2 for CREDIT. Defaults to 1.

📤 Response

The createShipment method returns the response from the Aramex API. Handle the response or errors as needed.


📘 Example Response

Below is an example of a successful response:

{
  "Transaction": {
    "Reference1": "12345",
    "Reference2": "",
    "Reference3": ""
  },
  "HasErrors": false,
  "Shipments": [
    {
      "ID": "123456789",
      "LabelURL": "https://aramex.com/label/123456789.pdf",
      "ShipmentTrackingNumber": "123456789"
    }
  ]
}

👤 Author

  • Your Name
    GitHub: @abedjaradat2017
    Email: abedjaradat2014@gmail.com

Keywords

FAQs

Package last updated on 11 Dec 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