Skip to main content
Glama

list_payments

Retrieve and filter GoCardless payment records by status, subscription, or mandate to monitor transaction activity.

Instructions

List payments from GoCardless

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of payments to retrieve (default: 50)
statusNoFilter by payment status (pending_customer_approval, pending_submission, submitted, confirmed, paid_out, cancelled, customer_approval_denied, failed, charged_back)
subscriptionNoFilter by subscription ID (e.g., SB123)
mandateNoFilter by mandate ID (e.g., MD123)

Implementation Reference

  • Handler implementation for list_payments tool: constructs params from arguments, calls client.payments.list(), formats and returns list of payments.
    elif name == "list_payments": params = {"limit": arguments.get("limit", 50)} if "status" in arguments: params["status"] = arguments["status"] if "subscription" in arguments: params["subscription"] = arguments["subscription"] if "mandate" in arguments: params["mandate"] = arguments["mandate"] payments = client.payments.list(params=params) result = [] for payment in payments.records: result.append( { "id": payment.id, "amount": payment.amount, "currency": payment.currency, "status": payment.status, "description": payment.description, "created_at": payment.created_at, } ) return [ types.TextContent( type="text", text=f"Found {len(result)} payments:\n{_format_json(result)}", ) ]
  • Registration of the list_payments tool in handle_list_tools(), including name, description, and input schema definition.
    types.Tool( name="list_payments", description="List payments from GoCardless", inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Number of payments to retrieve (default: 50)", }, "status": { "type": "string", "description": "Filter by payment status (pending_customer_approval, pending_submission, submitted, confirmed, paid_out, cancelled, customer_approval_denied, failed, charged_back)", }, "subscription": { "type": "string", "description": "Filter by subscription ID (e.g., SB123)", }, "mandate": { "type": "string", "description": "Filter by mandate ID (e.g., MD123)", }, }, }, ),
  • Input schema definition for the list_payments tool, defining optional parameters for filtering payments.
    inputSchema={ "type": "object", "properties": { "limit": { "type": "integer", "description": "Number of payments to retrieve (default: 50)", }, "status": { "type": "string", "description": "Filter by payment status (pending_customer_approval, pending_submission, submitted, confirmed, paid_out, cancelled, customer_approval_denied, failed, charged_back)", }, "subscription": { "type": "string", "description": "Filter by subscription ID (e.g., SB123)", }, "mandate": { "type": "string", "description": "Filter by mandate ID (e.g., MD123)", }, },
  • Helper function get_client() used by all tools including list_payments to initialize the GoCardless client.
    def get_client() -> gocardless_pro.Client: """Initialize and return GoCardless client.""" access_token = os.environ.get("GOCARDLESS_ACCESS_TOKEN") if not access_token: raise ValueError("GOCARDLESS_ACCESS_TOKEN environment variable is required") environment = os.environ.get("GOCARDLESS_ENVIRONMENT", "sandbox") return gocardless_pro.Client(access_token=access_token, environment=environment)

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/jmceleney/gocardless-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server