Shiprocket
Add live shipping rates and fulfillment automation
@sam-ael/medusa-plugin-shiprocket
Production-focused Shiprocket integration for Medusa v2 with fulfillment automation, delivery estimate APIs, and tracking synchronization.
Highlights
- Shiprocket fulfillment provider integration
- Delivery estimate endpoint for storefront experiences
- Tracking sync endpoints for admin and storefront views
- Webhook ingestion for status updates
- Hardened API responses and stricter payload validation
- Webhook idempotency guard and explicit public webhook handling
- Tracking ownership hardening and AWB validation
Install
1yarn add @sam-ael/medusa-plugin-shiprocket
Medusa Configuration
1234567891011121314151617181920modules: [{resolve: "@medusajs/medusa/fulfillment",options: {providers: [{resolve: "@sam-ael/medusa-plugin-shiprocket",id: "shiprocket",options: {email: process.env.SHIPROCKET_EMAIL,password: process.env.SHIPROCKET_PASSWORD,pickup_location: process.env.SHIPROCKET_PICKUP_LOCATION,},},],},},],plugins: [{
Environment Variables
12345678SHIPROCKET_EMAIL=your_email@example.comSHIPROCKET_PASSWORD=your_passwordSHIPROCKET_PICKUP_LOCATION=PrimarySHIPROCKET_WEBHOOK_TOKEN=your_webhook_tokenSHIPROCKET_DELIVERY_PREFERENCE=FASTSHIPROCKET_API_TIMEOUT_MS=15000SHIPROCKET_WEBHOOK_PAYLOAD_RETENTION_DAYS=30
API
Method Endpoint Description Copy to clipboardGET Copy to clipboard/store/shiprocket/delivery-estimate Delivery estimate lookup Copy to clipboardGET Copy to clipboard/store/shiprocket/tracking/:awb Store tracking lookup Copy to clipboardPOST Copy to clipboard/hooks/fulfillment/shiprocket Shiprocket webhook receiver Copy to clipboardGET Copy to clipboard/admin/shiprocket/tracking/:awb Admin tracking details Copy to clipboardPOST Copy to clipboard/admin/shiprocket/tracking/:awb/sync Force tracking/document sync
Security and Reliability Notes
- Unified error contract: Copy to clipboard
{ success: false, code, message, details? } - AWB and query validation added for tracking and estimate APIs
- Webhook token validation with constant-time compare
- Webhook replay/idempotency keying on AWB + status/timestamp
- Public route boundaries are explicit
- Retention cleanup job for webhook raw payload minimization
- Indexes added for high-frequency lookup fields
Quality Gates
1234yarn typecheckyarn lintyarn testyarn build
Smoke tests are available under Copy to clipboardsrc/tests.
License
MIT

