PayHere MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PayHere MCP ServerGenerate a checkout payload for order 12345 with amount 1500 LKR"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@lk-pay/payhere-mcp
A Model Context Protocol server for PayHere — Sri Lanka's payment gateway.
Lets developers retrieve payments, issue refunds, generate checkout payloads, and compute / verify PayHere signatures directly from Claude Code, Claude Desktop, or any other MCP-aware client.
Status
v0.1 — early preview. Signature module is fully implemented and tested. API-backed tools (get_payment, issue_refund, verify_credentials) ship next.
Related MCP server: PayFast MCP
Install
# Use directly via npx (no install needed)
npx @lk-pay/payhere-mcp
# Or install globally
npm install -g @lk-pay/payhere-mcpConfigure
Set the following environment variables. Copy .env.example to .env for local use, or pass them via your MCP client's config block.
Variable | Required | Description |
| yes |
|
| yes | From PayHere dashboard → Settings → Integrations |
| yes | Domain-specific secret |
| yes | From Settings → Business Apps |
| yes | App secret paired with |
Claude Code setup
Add to your ~/.claude/mcp.json (or project-local .claude/mcp.json):
{
"mcpServers": {
"payhere": {
"command": "npx",
"args": ["-y", "@lk-pay/payhere-mcp"],
"env": {
"PAYHERE_MODE": "sandbox",
"PAYHERE_MERCHANT_ID": "YOUR_MERCHANT_ID",
"PAYHERE_MERCHANT_SECRET": "YOUR_MERCHANT_SECRET",
"PAYHERE_APP_ID": "YOUR_APP_ID",
"PAYHERE_APP_SECRET": "YOUR_APP_SECRET"
}
}
}
}Tools
Tool | Purpose |
| Generate form fields + hash for |
| Retrieve all payment attempts for an |
| Refund a payment by |
| Compute or verify PayHere MD5 hashes (checkout + notify) |
| Health-check env vars + OAuth token fetch |
Design notes
No
list_payments. PayHere's Retrieval API only acceptsorder_id— there is no date-range / status filter endpoint.get_paymentreturns the array of attempts for an order.generate_signatureis the differentiator. Most PayHere integration bugs come from incorrect hash computation. This tool exposes the exact algorithm used by the gateway, with constant-time verification for notify URL validation.stdio transport only in v0.1. Remote / HTTP transport is on the roadmap.
Development
git clone https://github.com/lakshitha0526/payhere-mcp.git
cd payhere-mcp
npm install
npm run test # vitest
npm run typecheck # tsc --noEmit
npm run lint # biome check
npm run build # tsupLicense
MIT — see LICENSE.
Part of the lk-* family of Sri Lanka-focused developer tooling.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lakshitha0526/payhere-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server