Enable Bangkok-area same-day delivery
A MedusaJS plugin that integrates Makesend logistics services for Thai e-commerce fulfillment. Built specifically for Medusa v2.11.3+.
1# Using yarn2yarn add @civicagrotech/medusa-plugin-makesend34# Using npm5npm install @civicagrotech/medusa-plugin-makesend
Create or update your file:
MAKESEND_API_KEY=your_makesend_api_key
Add the plugin to your :
1import { defineConfig } from "@medusajs/framework/utils"23module.exports = defineConfig({4 // Register the fulfillment provider5 modules: [6 {7 resolve: "@medusajs/medusa/fulfillment",8 options: {9 providers: [10 // Keep default manual provider11 {12 resolve: "@medusajs/medusa/fulfillment-manual",13 id: "manual",14 },15 // Add Makesend provider16 {17 resolve: "medusa-plugin-makesend/providers/makesend",18 id: "makesend",19 options: {20 apiKey: process.env.MAKESEND_API_KEY,21 // Optional: Override API endpoints22 // baseUrl: "https://apis.makesend.asia/oapi/api",23 // trackingBaseUrl: "https://app.makesend.asia",24 // labelBaseUrl: "https://app.makesend.asia",25 // Webhook URLs (optional - for automatic webhook registration)26 // statusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",27 // parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",28 // Enable debug logging (default: false)29 // debug: false,30 },31 },32 ],33 },34 },35 ],36 // Register the plugin for admin UI and webhooks37 plugins: [38 {39 resolve: "medusa-plugin-makesend",40 options: {41 apiKey: process.env.MAKESEND_API_KEY,42 // Optional: Override API endpoints43 // baseUrl: "https://apis.makesend.asia/oapi/api",44 // trackingBaseUrl: "https://app.makesend.asia",45 // labelBaseUrl: "https://app.makesend.asia",46 // Webhook URLs (optional - for automatic webhook registration)47 // statusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",48 // parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",49 // Enable debug logging (default: false)50 // debug: false,51 },52 },53 ],54})
After installation, create shipping options in Medusa Admin:
The Makesend provider supports the following configuration options:
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Your Makesend API key for authentication | |
| string | No | Base URL for Makesend API endpoints | ||
| string | No | Base URL for tracking links | ||
| string | No | Base URL for shipping label links | ||
| string | No | - | URL for Makesend to send status update webhooks | |
| string | No | - | URL for Makesend to send parcel size update webhooks | |
| boolean | No | Enable debug logging for API requests |
Example with all options:
1{2 apiKey: process.env.MAKESEND_API_KEY,3 baseUrl: "https://apis.makesend.asia/oapi/api",4 trackingBaseUrl: "https://app.makesend.asia",5 labelBaseUrl: "https://app.makesend.asia",6 statusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",7 parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",8 debug: true,9}
The plugin provides three shipping options:
| Option ID | Name | Temperature |
|---|---|---|
| Makesend Standard Delivery | Normal (0) | |
| Makesend Chill Delivery | Chill (1) | |
| Makesend Frozen Delivery | Frozen (2) |
| ID | Code | Size |
|---|---|---|
| 6 | s80 | S+ (S80) |
| 7 | s100 | M (S100) |
When you provide and/or in the plugin configuration, the plugin will automatically register these webhooks with Makesend during module initialization. No manual configuration in the Makesend dashboard is required.
1plugins: [2 {3 resolve: "medusa-plugin-makesend",4 options: {5 apiKey: process.env.MAKESEND_API_KEY,6 // These webhooks will be automatically registered with Makesend7 statusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",8 parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",9 },10 },11]
The plugin will:
Endpoint:
Automatically updates fulfillment tracking when shipment status changes. Supported status codes:
Endpoint:
Receives notifications when actual parcel size differs from declared size.
The plugin includes scripts for testing webhooks during development:
1# Make script executable (Unix/Linux/macOS)2chmod +x scripts/test-webhooks.sh34# Test all webhooks5./scripts/test-webhooks.sh all67# Test with specific tracking ID and status8./scripts/test-webhooks.sh all --tracking EXSS2601121002503 --status DELIVERED910# Test only status webhook11./scripts/test-webhooks.sh status --tracking YOUR_TRACKING_ID1213# Test only parcel size webhook14./scripts/test-webhooks.sh parcel-size --tracking YOUR_TRACKING_ID
See scripts/README.md for detailed testing documentation.
| Endpoint | Method | Description |
|---|---|---|
| GET | Plugin health check | |
| POST | Receive status update webhooks from Makesend | |
| POST | Receive parcel size update webhooks from Makesend |
| Endpoint | Method | Description |
|---|---|---|
| GET | Admin plugin health check | |
| GET | Get list of Thai provinces | |
| GET | Get districts filtered by province | |
| GET | Get supported parcel sizes | |
| GET/POST | Get or update Makesend settings |
The plugin provides several admin extensions:
Displays on the order details page with:
Navigate to Settings → Makesend to configure:
The plugin includes comprehensive Thai logistics data in the directory:
The plugin provides Medusa workflows for managing shipments:
Creates a shipment in Makesend when fulfilling an order. Automatically:
Complete fulfillment workflow that:
See src/workflows/README.md for workflow documentation.
Makesend API uses Satang (1 Baht = 100 Satang) for all monetary values. The plugin handles this automatically when calculating prices.
1# Install dependencies2yarn install34# Build the plugin5yarn build67# Run in development mode (with linked Medusa app)8yarn dev910# Test webhooks locally11./scripts/test-webhooks.sh
CivicAgrotech Co., Ltd.
Website: https://civicagrotech.com
Contributions are welcome! Please feel free to submit a Pull Request.
MIT