# Payhere — how to use (mcp.ai)

Connect your Payhere account and use 13 tools for ecommerce straight from your AI agent. Connect with your own API key. Easy payment links for accepting online payments.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_payhere?ms=1787295780000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `payhere_create_hook`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/payhere`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/payhere/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/payhere/create/hook` — Tool to subscribe to a REST hook for receiving webhook events. Use when you need to register a webhook endpoint to receive real-time notifications for payment_received, subscription_cancelled, or subs
  - body: { post_url: string, resource: string, integration: string }
- `POST https://api.mcp.ai/api/payhere/create/plan` — Tool to create a new payment plan in PayHere. Use when you need to set up either a recurring subscription or one-off payment plan for accepting payments.
  - body: { name: string, price?: number, hidden?: boolean, currency: string, show_qty?: boolean, setup_fee?: number, billing_day?: integer, description?: string, success_url?: string, webhook_url?: string, cancel_after?: integer, payment_type: string, receipt_text?: string, pay_button_text?: string, billing_interval?: string, min_billing_cycles?: integer, user_selects_amount?: boolean }
- `POST https://api.mcp.ai/api/payhere/delete/hook` — Tool to remove a REST hook listener subscription. Use when you need to stop receiving webhook events for a specific hook.
  - body: { id: integer }
- `POST https://api.mcp.ai/api/payhere/get/current/company` — Tool to fetch company information for the currently authenticated user. Use when you need to retrieve comprehensive company details including identity, configuration, integration status, and associate
- `POST https://api.mcp.ai/api/payhere/get/current/company/stats` — Tool to fetch payment statistics for the last 30 days with comparison data from the preceding 30-day period (30-60 days ago). Use when you need to analyze recent payment trends, subscriber growth, or 
- `POST https://api.mcp.ai/api/payhere/get/user` — Tool to fetch information on the currently authenticated user. Use when you need to retrieve details about the logged-in user.
- `POST https://api.mcp.ai/api/payhere/list/customers` — Tool to list all customers from Payhere, ordered chronologically with most recent first. Use when you need to retrieve customer records, browse customers, or access customer information. Supports pagi
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/payhere/list/hooks` — Tool to list all active REST hooks subscriptions for the authenticated company. Use when you need to view all currently registered webhook listeners for your PayHere account.
- `POST https://api.mcp.ai/api/payhere/list/payments` — Tool to list all payments ordered chronologically, most recent first. Use when you need to retrieve payment history or check payment statuses. Supports pagination with page and per_page parameters.
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/payhere/list/plans` — Tool to list all plans in your PayHere account. Use when you need to retrieve and paginate through available plans.
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/payhere/list/subscriptions` — Tool to list all subscriptions ordered chronologically by most recent payment first. Use when you need to retrieve subscription data with customer and plan details.
  - body: { page?: integer, per_page?: integer }
- `POST https://api.mcp.ai/api/payhere/update/current/company` — Tool to update the company information for the currently authenticated user. Use when modifying company details such as name, legal name, address, logo, support email, website, or branding preferences
  - body: { logo?: object, name?: string, address?: string, website?: string, legal_name?: string, button_text?: string, button_color?: string, support_email?: string }
- `POST https://api.mcp.ai/api/payhere/update/plan` — Tool to update an existing plan's configuration and settings. Use when you need to modify plan properties like name, description, pricing, or other settings for both one-off and subscription plans.
  - body: { id: string, name?: string, price?: number, hidden?: boolean, currency?: string, show_qty?: boolean, setup_fee?: number, billing_day?: integer, description?: string, success_url?: string, webhook_url?: string, cancel_after?: integer, receipt_text?: string, pay_button_text?: string, min_billing_cycles?: integer }

## Example prompts
- "What can I do in Payhere?"
- "Show me a summary of my Payhere account"

## More
- Page: https://mcp.ai/payhere
- Agent spec (llms.txt): https://mcp.ai/payhere/llms.txt
- Postman collection: https://mcp.ai/payhere/postman.json
