Skydropxpro
A Medusa plugin for Skydropx Pro - Updated for latest API
Compatibility
This starter is compatible with versions >= 2.4.0 of .
Getting Started
Visit the Quickstart Guide to set up a server.
Visit the Plugins documentation to learn more about plugins and how to create them.
Visit the Docs to learn more about our system requirements.
What is Medusa
Medusa is a set of commerce modules and tools that allow you to build rich, reliable, and performant commerce applications without reinventing core commerce logic. The modules can be customized and used to build advanced ecommerce stores, marketplaces, or any product that needs foundational commerce primitives. All modules are open-source and freely available on npm.
Learn more about Medusa’s architecture and commerce modules in the Docs.
Community & Contributions
The community and core team are available in GitHub Discussions, where you can ask for support, discuss roadmap, and share ideas.
Join our Discord server to meet other community members.
Other channels
node_modules/@medusajs/medusa/dist/commands/plugin/db/generate.js -- npx medusa plugin:publish
npx medusa plugin:db:generate
Plugin Development npx medusa plugin:develop
Plugin DB generation npx medusa plugin:db:generate
On Medusa Main Project npx medusa db:migrate
on MasFactura Module npx medusa plugin:build npm publish --access public
Medusa Skydropx Pro Plugin
A Medusa plugin for integrating with Skydropx Pro shipping services. This plugin has been updated to work with the latest Skydropx API.
Features
- Shipping Rate Calculation: Get shipping rates from multiple carriers (FedEx, DHL, etc.)
- Shipment Creation: Create shipments with tracking numbers and labels
- Order Management: Create and manage orders in Skydropx
- Pickup Management: Schedule and manage pickups
- Shipment Tracking: Track shipments in real-time
- Shipment Protection: Add insurance to shipments
- Product Management: Manage products in Skydropx catalog
- Printing Format Settings: Configure label printing formats
Installation
- Install the plugin:
npm install @zaamx/medusa-skydropxpro
- Add the plugin to your Medusa configuration:
// medusa-config.jsimport { ConfigModule } from '@medusajs/medusa'import { SkydropxProModule } from '@zaamx/medusa-skydropxpro'const config: ConfigModule = {modules: {[SkydropxProModule.PACKAGE_NAME]: {resolve: SkydropxProModule,options: {apiUrl: 'https://pro.skydropx.com/api/v1',apiKey: process.env.SKYDROPPX_API_KEY,apiSecret: process.env.SKYDROPPX_API_SECRET,},},},}export default config
- Set up environment variables:
SKYDROPPX_API_KEY=your_api_key_hereSKYDROPPX_API_SECRET=your_api_secret_hereSTORE_ZIP_CODE=54030STORE_STATE=Estado de MéxicoSTORE_MUNICIPALITY=TlalnepantlaSTORE_SUBURB=Centro Industrial TlalnepantlaSTORE_ADDRESS=Perif. Blvd. Manuel Ávila CamachoSTORE_EXT_NUMBER=3039STORE_REFERENCE=Agencia automovilSTORE_NAME=Toyota SateliteSTORE_PHONE=5555555555STORE_EMAIL=store@email.com
API Endpoints
Store Endpoints
Get Shipping Rates
POST /store/skydropxpro/quotationsContent-Type: application/json{"cart": {"items": [...],"shipping_address": {...},"email": "customer@example.com"}}
Admin Endpoints
Test Connection
GET /admin/skydropxpro
Shipments
GET /admin/skydropxpro/shipments?page=1POST /admin/skydropxpro/shipmentsGET /admin/skydropxpro/shipments/{id}POST /admin/skydropxpro/shipments/{id}/cancelPOST /admin/skydropxpro/shipments/{id}/protectGET /admin/skydropxpro/shipments/tracking?tracking_number=123&carrier_name=fedex
Orders
GET /admin/skydropxpro/orders?page=1POST /admin/skydropxpro/ordersGET /admin/skydropxpro/orders/{id}PATCH /admin/skydropxpro/orders/{id}
Pickups
GET /admin/skydropxpro/pickups?page=1POST /admin/skydropxpro/pickupsGET /admin/skydropxpro/pickups/{id}POST /admin/skydropxpro/pickups/{id}/rescheduleGET /admin/skydropxpro/pickups/coverage?shipment_id={id}
Products
GET /admin/skydropxpro/products?page=1&filters={"destination_country_code":"MX"}
Settings
PATCH /admin/skydropxpro/settings/printing-formatsContent-Type: application/json{"printing_format": "thermal"}
Usage Examples
Getting Shipping Rates
import { getQuotationSkydropxproWorkflow } from '@zaamx/medusa-skydropxpro/workflows'const { result } = await getQuotationSkydropxproWorkflow(scope).run({input: { cart }})console.log(result.quotation)
Creating a Shipment
import { createShipmentSkydropxproWorkflow } from '@zaamx/medusa-skydropxpro/workflows'const { result } = await createShipmentSkydropxproWorkflow(scope).run({input: {order,fulfillment,warehouse: "warehouse_id"}})console.log(result.shipment)
Using the Service Directly
import { SKYDROPPX_MODULE } from '@zaamx/medusa-skydropxpro'import SkydropxProService from '@zaamx/medusa-skydropxpro/modules/skydropxpro/service'const skydropxService: SkydropxProService = container.resolve(SKYDROPPX_MODULE)// Get shipping ratesconst rates = await skydropxService.calculateShippingRates(cart, zipCode)// Create shipmentconst shipment = await skydropxService.createShipment(order, zipCode, fulfillment, warehouse)// Track shipmentconst tracking = await skydropxService.trackShipment(trackingNumber, carrierName)
Key Changes in Latest Update
API Structure Updates
- Updated to use the new Skydropx Pro API base URL:
- Updated OAuth authentication flow
- Updated quotation API structure with new field names
- Updated shipment creation API with new required fields
New Features
- Orders API: Full CRUD operations for orders
- Products API: Product catalog management
- Shipment Protection: Add insurance to shipments
- Shipment Cancellation: Cancel shipments with reasons
- Shipment Tracking: Real-time tracking information
- Printing Format Settings: Configure label printing
Field Name Changes
- → (array)
- →
- →
- : Now uses uppercase format ("MX" instead of "mx")
- and : Now returned as strings instead of numbers
Error Handling
- Improved error handling with proper error propagation
- Better logging of API errors
- Consistent error response format
Environment Variables
Variable | Description | Required | Default |
---|---|---|---|
Your Skydropx API key | Yes | - | |
Your Skydropx API secret | Yes | - | |
Store postal code | No | 54030 | |
Store state/province | No | Estado de México | |
Store city/municipality | No | Tlalnepantla | |
Store neighborhood | No | Centro Industrial Tlalnepantla | |
Store street address | No | Perif. Blvd. Manuel Ávila Camacho | |
Store internal number | No | 3039 | |
Store reference | No | Agencia automovil | |
Store name | No | Toyota Satelite | |
Store phone number | No | 5555555555 | |
Store email | No | store@email.com |
Support
For issues and questions, please contact:
- Email: api@skydropx.com
- Documentation: Skydropx API Documentation
License
MIT