midtrans
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
midtrans-kit
CLI + MCP server for seamless Midtrans payment integrations — built for beginners and non-backend developers.
Midtrans has no official CLI, and existing community MCP servers are unmaintained. midtrans-kit distills hardened patterns from production Midtrans integrations into one npx-able toolkit: create payments, check whether an order is safe to fulfill, test your webhook locally without tunnels, and scaffold a working integration in seconds.
Note on "OAuth login": Midtrans does not offer OAuth — it only has per-environment API keys (server key + client key).
midtrans loginis the closest safe equivalent: it validates your keys live against Midtrans, then stores them locally in~/.midtrans/config.toml(chmod 600) with multi-merchant profile support.
Install / run without installing
npx midtrans-kit --help # or: npm i -g midtrans-kit
midtrans --versionRelated MCP server: Yolfi MCP Server
Quickstart (sandbox)
# 1. Save your sandbox keys (Midtrans Dashboard → Settings → Access Keys)
midtrans login
# server key: SB-Mid-server-…
# 2. Create a payment and open it
midtrans snap:create --amount 10000 --item-name "Test" --open
# → pay with card 4811 1111 1111 1114, CVV 123, OTP 112233
# 3. Check it
midtrans status KIT-MZABC123-ABCDEF1234
# Fulfillment: PAID — safe to fulfill ✅
# 4. Diagnose your setup
midtrans doctorCommands
Command | What it does |
| Validate keys live, store them in |
| Manage profiles & see which credentials are active |
| Create a Snap payment → token + payment link ( |
| Raw status + a safe-to-fulfill verdict (paid/pending/failed/expired) |
| Transaction actions — production requires |
| Full/partial refund |
| Fire a correctly-signed fake notification at your local handler — no tunnels |
| Verify a payload's signature locally (with gotcha explanations) |
| Scaffold a complete, hardened integration |
| Key validity, sandbox/production consistency, optional webhook probe |
| Offline reference: test cards, statuses, signature, retries, simulators |
Webhook testing — the killer feature
Midtrans can only POST notifications to one public HTTPS URL per merchant, which makes local development painful. midtrans-kit solves it:
# Your dev server is running on localhost:3000
midtrans webhook:test --status settlement --url http://localhost:3000/api/payment/webhook
midtrans webhook:test --status expire --url http://localhost:3000/api/payment/webhook
midtrans webhook:test --tamper --url http://localhost:3000/api/payment/webhook
# ^ must be rejected (403) — or your handler is unsafe!Environment variables (alternative to login)
Same names your app code likely uses — env vars override the saved profile:
MIDTRANS_SERVER_KEY=SB-Mid-server-…
MIDTRANS_CLIENT_KEY=SB-Mid-client-… # optional
MIDTRANS_IS_PRODUCTION=falsemidtrans doctor catches the classic bug — a sandbox key paired with IS_PRODUCTION=true or a mismatched client key.
Safety model
Sandbox/production is detected from the key prefix (
SB-Mid-…= sandbox)Money-changing commands against production require an explicit
--productionflagKeys are masked in all output; config file is chmod 600; nothing is ever logged
MCP server (for AI coding agents)
One login serves both the CLI and the MCP server.
# Claude Code
claude mcp add midtrans -- npx midtrans-kit mcp
# Cursor / ZCode / anything MCP — stdio command:
npx midtrans-kit mcpTools: create_snap_payment, get_transaction_status (with fulfillment verdict), approve/deny/cancel/expire/refund_transaction (production-gated by confirm: true), verify_webhook_signature, send_test_webhook_notification, search_midtrans_docs.
So you can tell your agent: "create a 25000 IDR sandbox payment and give me the link" or "send a settlement webhook to my local server and make sure it's accepted".
Scaffolding
midtrans init nextjs # App Router routes + snap.js button + env example
midtrans init express # single-file express server, zero extra depsBoth templates bake in the rules learned from production integrations:
Amounts resolve server-side — the client sends an item id, never a price
Register the order before creating the token — webhooks always find a row
Signature verified first —
sha512(order_id + status_code + gross_amount + server_key), gross_amount hashed as the exact received stringIdempotent settling — Midtrans retries; nothing fulfills twice
Status API reconciliation — the webhook lagging never loses an order
FAQ
Does Midtrans have OAuth? No — only API keys (verified against the official docs). Any tool claiming Midtrans "OAuth login" would be storing keys anyway; midtrans-kit does that honestly, with live validation.
Sandbox vs production keys? SB-Mid-server-… / SB-Mid-client-… are sandbox; Mid-server-… / Mid-client-… are production. Each environment has its own pair, generated for you, visible in the dashboard.
Test cards? midtrans docs test-cards — e.g. 4811 1111 1111 1114 (approve), 4911 1111 1111 1113 (deny), OTP 112233.
Roadmap
Iris payouts, subscriptions/recurring, BI-SNAP asymmetric signatures
More scaffolds (Remix, Nuxt, Laravel, Rails…)
midtrans watch— live tail of notifications against local handlers
Development
npm install
npm run build # tsc → dist/
npm test # node:test via tsxStructure: src/core (framework-free Midtrans logic — shared by CLI, MCP, and templates), src/cli (commander commands), src/mcp (MCP server), templates/ (scaffolds).
License
MIT
Not affiliated with Midtrans. This is an independent community toolkit; Midtrans is a product of PT Midtrans. Official documentation: docs.midtrans.com.
This server cannot be deployed
Maintenance
Related MCP Connectors
Stripe payments for AI agents. Create links, verify, manage customers.
Marketplace and payment rail for AI agents: list, buy and settle with signed receipts.
Verified, pay-per-use API tools for AI agents through one authenticated connection.
Let AI agents add Yolfi crypto checkout, paylinks, webhooks, and status checks.
Related MCP Servers
AlicenseAqualityBmaintenanceEnables coding agents to create and look up crypto payments over stdio, returning checkout links, payment statuses, paged payment lists, and receivable currencies, with real payments gated behind an explicit opt-in environment flag.4MIT- FlicenseNot gradedqualityBmaintenanceEnables AI coding agents to add stablecoin checkout, payment links, payment status checks, and webhook verification to applications, plus webhook-based access logic after confirmed payments.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to integrate stablecoin checkout, payment links, payment status checks, webhook verification, and webhook-based entitlement logic into applications.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding agents to add stablecoin checkout, payment links, payment status checks, webhook verification, and webhook-based access logic to applications, including workspace registration, paylink creation, and webhook configuration.-