Medusa fulfillment plugin for Makesend integration
A MedusaJS plugin that integrates Makesend logistics services for Thai e-commerce fulfillment. Built specifically for Medusa v2.11.3+.
# Using yarnyarn add @civicagrotech/medusa-plugin-makesend# Using npmnpm install @civicagrotech/medusa-plugin-makesend
Create or update your file:
MAKESEND_API_KEY=your_makesend_api_key
Add the plugin to your :
import { defineConfig } from "@medusajs/framework/utils"module.exports = defineConfig({// Register the fulfillment providermodules: [{resolve: "@medusajs/medusa/fulfillment",options: {providers: [// Keep default manual provider{resolve: "@medusajs/medusa/fulfillment-manual",id: "manual",},// Add Makesend provider{resolve: "medusa-plugin-makesend/providers/makesend",id: "makesend",options: {apiKey: process.env.MAKESEND_API_KEY,// Optional: Override API endpoints// baseUrl: "https://apis.makesend.asia/oapi/api",// trackingBaseUrl: "https://app.makesend.asia",// labelBaseUrl: "https://app.makesend.asia",// Webhook URLs (optional - for automatic webhook registration)// statusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",// parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",// Enable debug logging (default: false)// debug: false,},},],},},],// Register the plugin for admin UI and webhooksplugins: [{resolve: "medusa-plugin-makesend",options: {apiKey: process.env.MAKESEND_API_KEY,// Optional: Override API endpoints// baseUrl: "https://apis.makesend.asia/oapi/api",// trackingBaseUrl: "https://app.makesend.asia",// labelBaseUrl: "https://app.makesend.asia",// Webhook URLs (optional - for automatic webhook registration)// statusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",// parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",// Enable debug logging (default: false)// debug: false,},},],})
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:
{apiKey: process.env.MAKESEND_API_KEY,baseUrl: "https://apis.makesend.asia/oapi/api",trackingBaseUrl: "https://app.makesend.asia",labelBaseUrl: "https://app.makesend.asia",statusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",debug: true,}
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.
plugins: [{resolve: "medusa-plugin-makesend",options: {apiKey: process.env.MAKESEND_API_KEY,// These webhooks will be automatically registered with MakesendstatusWebhookUrl: "https://your-domain.com/store/makesend/webhook/status",parcelSizeWebhookUrl: "https://your-domain.com/store/makesend/webhook/parcel-size",},},]
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:
# Make script executable (Unix/Linux/macOS)chmod +x scripts/test-webhooks.sh# Test all webhooks./scripts/test-webhooks.sh all# Test with specific tracking ID and status./scripts/test-webhooks.sh all --tracking EXSS2601121002503 --status DELIVERED# Test only status webhook./scripts/test-webhooks.sh status --tracking YOUR_TRACKING_ID# Test only parcel size webhook./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.
# Install dependenciesyarn install# Build the pluginyarn build# Run in development mode (with linked Medusa app)yarn dev# Test webhooks locally./scripts/test-webhooks.sh
CivicAgrotech Co., Ltd.
Website: https://civicagrotech.com
Contributions are welcome! Please feel free to submit a Pull Request.
MIT