MetorialDocs

Set up Payhere in Metorial for Claude, ChatGPT and Cursor

Share Payhere with your team in Claude, ChatGPT and Cursor through Metorial: API key sign-in, 14 tools (9 read-only).

To give your team Payhere in Claude, ChatGPT, Cursor and other AI clients, an admin shares the Payhere integration in a Metorial portal, and each person connects with an API key. Agents can manage payment plans, subscriptions, customers, and refunds. The integration has 14 tools, 9 read-only, 3 write and 2 destructive, plus 2 triggers.

What you'll learn

  • How an admin shares Payhere in a portal and how each person connects
  • What Payhere asks for when you connect, and where to find it
  • How to keep the 9 read-only tools and reject the other 5

Before you start

Sign-in method

MethodTypeWhat a person provides
API KeyAPI tokentoken

API Key

To connect, a person enters:

  • token: Payhere API key from your merchant admin at https://app.payhere.co/merchants/integrations

Admin: share Payhere in a portal

In the dashboard

Open Shared Resources

Open Workforce, choose the portal, and select Shared Resources under Access.

Share a new integration

Select Share a Resource, then New Integration, and choose Payhere. For how members connect, choose Each person connects so everyone enters their own API key, or Shared connection to enter one API key for everyone.

Limit the tools

Under Tool Filters, set the write and destructive groups to Reject if agents should only read from Payhere.

Choose who gets it

Add the access groups that should see Payhere. When a person asks for access from the portal, the request appears under Access Requests.

With the CLI

The CLI cannot create the per-user Payhere integration. Once it exists, check which groups have it:

metorial-admin portals access list <portal-id> --type provider_template --search payhere

Employee: connect Payhere

In the portal

Open Payhere in the catalog

Sign in to your portal and open Payhere. The status reads Available.

Authenticate

Under Quick setup, select Authenticate. In the setup window, enter your API key (token).

Confirm

The status changes to Configured. If it later reads Needs reconnect, select Reconnect and sign in again.

With the CLI

metorial catalog search payhere
metorial setup <catalog-item-id>

catalog search prints the catalog item ID.

Add it to your AI client

metorial install adds your Payhere connection to a local MCP client such as Claude Code, Cursor or Codex. metorial list prints the integration ID and metorial client list the client identifiers.

metorial list payhere
metorial client list
metorial install <client-identifier> <integration-id>

For a client that takes a server URL, such as ChatGPT, metorial install custom <integration-id> creates an installation token and shows the endpoint details.

Make it read-only

Open the integration's Tool Filters and set the write and destructive groups to Reject. Agents keep the 9 read-only tools, such as who_am_i and list_plans, and lose the 3 write tools, such as create_plan or update_plan, and the 2 destructive tools, such as refund_payment or cancel_subscription.

Employees see the result on the integration's page in the portal under Tool access. For the full walkthrough, see Tool permissions.

Check it worked

metorial list payhere
metorial tools <integration-id>
metorial call <integration-id> list_plans -d '{}'

metorial tools lists the 14 tools, minus any you rejected. list_plans takes no input. It retrieves a paginated list of payment plans.

To see every input a tool takes, run metorial schema <integration-id> <tool-key>.

Tools

Read-only tools (9)

  • get_customer: Fetch detailed information about a specific customer by their ID. Needs customerId.
  • list_plans: Retrieve a paginated list of payment plans.
  • get_company: Retrieve the current company's profile and statistics.
  • list_subscriptions: Retrieve a paginated list of subscriptions, ordered by most recent payment first.
  • list_payments: Retrieve a paginated list of payments, ordered chronologically with most recent first.
  • list_customers: Retrieve a paginated list of customers, ordered chronologically with most recent first.
  • get_payment: Fetch detailed information about a specific payment, including associated customer, subscription, and plan data. Needs paymentId.
  • get_subscription: Retrieve a subscription by ID, including its customer, plan, and payment history.
  • who_am_i: Retrieve the currently authenticated Payhere user and verify which account the API key belongs to.

Write tools (3)

  • update_plan: Update an existing payment plan's configuration. Needs planId.
  • create_plan: Create a new payment plan for collecting one-off or recurring payments. Needs paymentType and name.
  • update_company: Update the current company's profile settings, including display name, legal name, address, contact information, and branding options shown on receipts and payment pages.

Destructive tools (2)

  • refund_payment: Issue a full or partial refund for an existing payment. Needs paymentId, amount and reason.
  • cancel_subscription: Stop future billing for a subscription. Needs subscriptionId.

Triggers

Payhere has 2 triggers, which fire on events in Payhere:

  • payment_events: Triggers when a payment succeeds.
  • subscription_events: Triggers when a subscription is created or cancelled.

Next steps