home / mcp / payfast mcp server

PayFast MCP Server

Provides transaction, subscription, refund, and credit card query capabilities for PayFast via MCP with sandbox support and environment-variable credentials.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jpbester-payfast-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "payfast-mcp"
      ],
      "env": {
        "PAYFAST_PASSPHRASE": "your-passphrase",
        "PAYFAST_ENVIRONMENT": "sandbox",
        "PAYFAST_MERCHANT_ID": "your-merchant-id",
        "PAYFAST_MERCHANT_KEY": "your-merchant-key"
      }
    }
  }
}

You can run PayFast MCP to securely interact with your PayFast merchant account through an MCP client. This server provides transaction, subscription, refunds, and card query capabilities in a sandbox-friendly, credentials-only setup, ensuring sensitive data is never logged.

How to use

You use an MCP client to talk to the PayFast MCP server. Start the server using your preferred MCP-integrated client (Claude, Codex, Cursor, or similar) and supply the required environment variables. The server exposes functions for fetching transactions, managing subscriptions, processing refunds, and querying card details. High-risk actions require explicit human approval before execution, so plan those steps with your workflow.

How to install

# Prerequisites
Node.js 18+
PayFast merchant account (sandbox or production)

# Install the MCP server globally
npm install -g payfast-mcp

# Or run directly with npx
npx payfast-mcp

Additional sections

Configuration and security are central to safe operation. You will provide credentials exclusively via environment variables. Sensitive data is never logged.

Environment variables you need to set include: PAYFAST_MERCHANT_ID, PAYFAST_MERCHANT_KEY, PAYFAST_PASSPHRASE, and PAYFAST_ENVIRONMENT. The default environment is sandbox unless you explicitly set production.

The following sections show practical configuration examples for common MCP clients. Use these exact patterns to connect your client to this MCP server.

Security and best practices

- Use environment variables to store credentials and avoid logging sensitive values. - Run in sandbox mode for testing before moving to production. - Review high-risk operations and require human approval where appropriate.

Troubleshooting

If the MCP server fails to start, verify Node.js 18+ is installed, and ensure you have network access for dependencies. Check that the required environment variables are present and correctly named.

Available tools

ping

Test API connectivity

transaction_fetch

Get transaction by ID

transaction_history

Query transaction history

transaction_charge

Charge a stored token

subscription_fetch

Get subscription details

subscription_pause

Pause a subscription

subscription_unpause

Resume a subscription

subscription_cancel

Cancel a subscription

subscription_update

Update subscription terms

subscription_adhoc

Ad-hoc subscription charge

refund_create

Process a refund

refund_fetch

Get refund details

creditcard_fetch

Query card transaction