PayFast MCP Server
The PayFast MCP Server enables AI assistants to securely manage payment transactions, subscriptions, and refunds through the PayFast payment gateway.
Connectivity
ping— Test API connectivity and verify credentials
Transaction Management
transaction.fetch— Retrieve details of a specific transaction by payment IDtransaction.history— Query transaction history with optional date range filtering and paginationtransaction.charge— Process a charge on a tokenized card
Subscription Management
subscription.fetch— Get subscription details by tokensubscription.pause— Pause a subscription for a specified number of billing cyclessubscription.unpause— Resume a paused subscriptionsubscription.cancel— Permanently cancel a subscriptionsubscription.update— Update subscription parameters like amount, cycles, frequency, or run datesubscription.adhoc— Process a one-time ad-hoc charge on an existing subscription
Refund Processing
refund.query— Check refund availability and amounts before creating a refundrefund.create— Process a full or partial refund for a transactionrefund.fetch— Retrieve refund transaction history and available balance
Credit Card Queries
creditcard.fetch— Query credit card transaction details for a specific payment
⚠️ High-risk operations (canceling/pausing/updating subscriptions, creating refunds, ad-hoc charges) require explicit confirmation before execution.
The server supports sandbox mode for safe testing and uses environment variables for secure credential management.
Click on "Deploy 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., "@PayFast MCP Server Show my transaction history from the last 7 days"
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.
payfast-mcp
A Model Context Protocol (MCP) server for PayFast, South Africa's leading payment gateway. Enables AI assistants like Claude to securely interact with your PayFast merchant account.
Features
Transaction management — fetch transaction details, query history, process tokenized charges
Subscription management — fetch, pause, unpause, cancel, update, and ad-hoc charge subscriptions
Refund processing — create refunds (full or partial) and query refund status
Credit card queries — look up credit card transaction details
Sandbox support — defaults to sandbox mode for safe testing
Secure by design — credentials via environment variables only, sensitive data never logged
Related MCP server: Payoza MCP Server
Available Tools
Tool | Description | Risk |
| Test API connectivity | Low |
| Get transaction by ID | Low |
| Query transaction history | Low |
| Charge a stored token | Medium |
| Get subscription details | Low |
| Pause a subscription | High |
| Resume a subscription | Medium |
| Cancel a subscription | High |
| Update subscription terms | High |
| Ad-hoc subscription charge | High |
| Process a refund | High |
| Get refund details | Low |
| Query card transaction | Low |
High-risk operations require human approval before execution.
Quick Start
Prerequisites
Node.js 18+
A PayFast merchant account (sandbox or production)
Installation
npm install -g payfast-mcpOr run directly with npx:
npx payfast-mcpConfiguration
Set the following environment variables:
Variable | Required | Description |
| Yes | Your PayFast Merchant ID |
| Yes | Your PayFast Merchant Key |
| Yes | Your PayFast API Passphrase |
| No |
|
You can also create a .env file in your working directory.
Claude Desktop
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"payfast": {
"command": "npx",
"args": ["-y", "payfast-mcp"],
"env": {
"PAYFAST_MERCHANT_ID": "your-merchant-id",
"PAYFAST_MERCHANT_KEY": "your-merchant-key",
"PAYFAST_PASSPHRASE": "your-passphrase",
"PAYFAST_ENVIRONMENT": "sandbox"
}
}
}
}Claude Code
Add to your Claude Code settings:
claude mcp add payfast \
-e PAYFAST_MERCHANT_ID=your-merchant-id \
-e PAYFAST_MERCHANT_KEY=your-merchant-key \
-e PAYFAST_PASSPHRASE=your-passphrase \
-e PAYFAST_ENVIRONMENT=sandbox \
-- npx -y payfast-mcpCursor
Add to your Cursor MCP config (.cursor/mcp.json for project-level, or ~/.cursor/mcp.json for global):
{
"mcpServers": {
"payfast": {
"command": "npx",
"args": ["-y", "payfast-mcp"],
"env": {
"PAYFAST_MERCHANT_ID": "your-merchant-id",
"PAYFAST_MERCHANT_KEY": "your-merchant-key",
"PAYFAST_PASSPHRASE": "your-passphrase",
"PAYFAST_ENVIRONMENT": "sandbox"
}
}
}
}Codex
Add via the Codex CLI:
codex mcp add payfast \
--env PAYFAST_MERCHANT_ID=your-merchant-id \
--env PAYFAST_MERCHANT_KEY=your-merchant-key \
--env PAYFAST_PASSPHRASE=your-passphrase \
--env PAYFAST_ENVIRONMENT=sandbox \
-- npx -y payfast-mcpOr add directly to ~/.codex/config.toml:
[mcp_servers.payfast]
command = "npx"
args = ["-y", "payfast-mcp"]
[mcp_servers.payfast.env]
PAYFAST_MERCHANT_ID = "your-merchant-id"
PAYFAST_MERCHANT_KEY = "your-merchant-key"
PAYFAST_PASSPHRASE = "your-passphrase"
PAYFAST_ENVIRONMENT = "sandbox"Development
# Clone the repo
git clone https://github.com/jpbester/payfast-mcp.git
cd payfast-mcp
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Run with MCP Inspector
npm run inspectLicense
MIT
Available Tools
14 toolscreditcard.fetchC
Query credit card transaction details for a specific PayFast payment
Inputs: pf_payment_id (required).
pingA
Test connectivity to the PayFast API and verify credentials are valid
Inputs: no named parameters.
refund.createC
Create a refund for a PayFast transaction. This will return money to the customer's original payment method.
Inputs: pf_payment_id (required), amount (required), reason (required), notify_buyer, +1 more.
refund.fetchA
Fetch refund transaction history and available balance for a payment that has ALREADY been refunded. Returns 404 if no refund exists yet — use refund.query first to check availability.
Inputs: pf_payment_id (required).
refund.queryA
Query refund availability for a transaction BEFORE creating a refund. Returns available amounts, refund methods (credit card or bank payout), and required parameters. Use this first to check if a refund is possible.
Inputs: pf_payment_id (required).
subscription.adhocC
Process an ad-hoc (one-time) charge on an existing PayFast subscription
Inputs: token (required), amount (required), item_name (required), confirmed.
subscription.cancelA
Permanently cancel a PayFast subscription. This cannot be undone.
Inputs: token (required), confirmed.
subscription.fetchC
Fetch details of a PayFast subscription by its token
Inputs: token (required).
subscription.pauseB
Pause a PayFast subscription for a specified number of billing cycles. This stops charges temporarily.
Inputs: token (required), cycles (required), confirmed.
subscription.unpauseA
Resume a previously paused PayFast subscription. Billing will resume on the next cycle.
Inputs: token (required), confirmed.
subscription.updateC
Update a PayFast subscription's parameters (amount, cycles, frequency, or run date)
Inputs: token (required), amount, cycles, frequency, +2 more.
transaction.chargeA
Process a charge on a tokenized card. This creates a real payment. Requires confirmation.
Inputs: token (required), amount (required), item_name (required), item_description, +1 more.
transaction.fetchC
Fetch details of a specific PayFast transaction by payment ID
Inputs: pf_payment_id (required).
transaction.historyB
Get PayFast transaction history with optional date range and pagination
Inputs: from, to, offset, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool has a clearly distinct purpose with no ambiguity. For example, refund.query checks availability, refund.create initiates a refund, and refund.fetch retrieves refund details, all serving different steps in the refund workflow. Similarly, subscription tools like pause, unpause, cancel, and update target specific lifecycle actions without overlap.
All tool names follow a consistent verb_noun pattern with dot notation for subcategories (e.g., subscription.cancel, transaction.fetch). The naming is uniform across all 14 tools, using clear verbs like fetch, create, query, and cancel, making the set highly predictable and readable.
With 14 tools, the count is well-scoped for a payment processing server, covering core operations like transactions, refunds, subscriptions, and connectivity. Each tool earns its place by addressing specific needs in the domain, such as subscription lifecycle management and transaction handling, without being excessive or sparse.
The tool surface provides complete CRUD/lifecycle coverage for the PayFast domain. It includes connectivity testing (ping), transaction processing and history (charge, fetch, history), refund management (query, create, fetch), and full subscription operations (fetch, update, pause, unpause, cancel, adhoc), with no obvious gaps that would hinder agent workflows.
Related MCP Connectors
Manage GoCardless payments, mandates, subscriptions, refunds and payouts via AI assistants.
South Africa payments for AI agents — cards / EFT via Paystack. Never holds funds.
Stripe payments for AI agents. Create links, verify, manage customers.
Pink Agentic AI Payments: AI agents pay within spending rules (budgets, caps, approval). Sandbox.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to interact with multiple payment providers (Stripe, Paystack) through a unified API. Supports payment initialization, verification, refunds, customer management, and invoicing without requiring knowledge of specific provider implementations.2-
- FlicenseNot gradedqualityDmaintenanceConnects the Payoza crypto payments API to AI assistants, enabling users to manage transactions, subscriptions, and payment links across multiple blockchains. It provides a comprehensive suite of tools for handling checkout sessions, customers, and real-time revenue analytics through natural language commands.-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to accept payments in South Africa using Paystack's hosted checkout for cards and instant EFT.MIT
- AlicenseAqualityCmaintenanceEnables an AI assistant to create, query and cancel South African instant EFT (pay-by-bank) payment requests and verify credentials and environment settings. It is structurally locked to the staging environment unless production is explicitly unlocked with two independent keys, with a per-request amount ceiling and confirmation required for live payments.5MIT