Skip to main content
Glama

get_payment

Retrieve a specific payment's details using its unique GoCardless ID to view transaction status and information.

Instructions

Get a specific payment by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payment_idYesThe GoCardless payment ID (e.g., PM123)

Implementation Reference

  • Handler implementation for the 'get_payment' tool. Retrieves payment details by ID using the GoCardless client API and returns formatted JSON response including metadata and links.
    elif name == "get_payment":
        payment_id = arguments["payment_id"]
        payment = client.payments.get(payment_id)
        result = {
            "id": payment.id,
            "amount": payment.amount,
            "currency": payment.currency,
            "status": payment.status,
            "description": payment.description,
            "created_at": payment.created_at,
            "charge_date": payment.charge_date,
            "metadata": payment.metadata if hasattr(payment, 'metadata') else {},
            "links": {
                "mandate": payment.links.mandate if hasattr(payment, 'links') and hasattr(payment.links, 'mandate') else None,
                "subscription": payment.links.subscription if hasattr(payment, 'links') and hasattr(payment.links, 'subscription') else None,
            },
        }
        return [
            types.TextContent(type="text", text=_format_json(result))
        ]
  • Tool schema definition including input schema for 'payment_id' parameter, registered in the list_tools handler.
    types.Tool(
        name="get_payment",
        description="Get a specific payment by ID",
        inputSchema={
            "type": "object",
            "properties": {
                "payment_id": {
                    "type": "string",
                    "description": "The GoCardless payment ID (e.g., PM123)",
                }
            },
            "required": ["payment_id"],
        },
    ),
  • Registration of the 'get_payment' tool within the list_tools method, which returns all available tools with their schemas.
    @server.list_tools()
    async def handle_list_tools() -> list[types.Tool]:
        """List available GoCardless tools."""
        return [
            types.Tool(
                name="list_customers",
                description="List all customers from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of customers to retrieve (default: 50)",
                        }
                    },
                },
            ),
            types.Tool(
                name="get_customer",
                description="Get a specific customer by ID",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "customer_id": {
                            "type": "string",
                            "description": "The GoCardless customer ID (e.g., CU123)",
                        }
                    },
                    "required": ["customer_id"],
                },
            ),
            types.Tool(
                name="create_customer",
                description="Create a new customer in GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "email": {
                            "type": "string",
                            "description": "Customer email address",
                        },
                        "given_name": {
                            "type": "string",
                            "description": "Customer first name",
                        },
                        "family_name": {
                            "type": "string",
                            "description": "Customer last name",
                        },
                        "company_name": {
                            "type": "string",
                            "description": "Customer company name (optional)",
                        },
                    },
                    "required": ["email"],
                },
            ),
            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)",
                        },
                    },
                },
            ),
            types.Tool(
                name="get_payment",
                description="Get a specific payment by ID",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "payment_id": {
                            "type": "string",
                            "description": "The GoCardless payment ID (e.g., PM123)",
                        }
                    },
                    "required": ["payment_id"],
                },
            ),
            types.Tool(
                name="create_payment",
                description="Create a new payment in GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "amount": {
                            "type": "integer",
                            "description": "Amount in minor currency unit (e.g., 1000 for £10.00)",
                        },
                        "currency": {
                            "type": "string",
                            "description": "ISO 4217 currency code (e.g., GBP, EUR)",
                        },
                        "mandate_id": {
                            "type": "string",
                            "description": "ID of the mandate to use for this payment",
                        },
                        "description": {
                            "type": "string",
                            "description": "Payment description",
                        },
                    },
                    "required": ["amount", "currency", "mandate_id"],
                },
            ),
            types.Tool(
                name="list_mandates",
                description="List mandates from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of mandates to retrieve (default: 50)",
                        },
                        "customer": {
                            "type": "string",
                            "description": "Filter by customer ID",
                        },
                    },
                },
            ),
            types.Tool(
                name="get_mandate",
                description="Get a specific mandate by ID",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "mandate_id": {
                            "type": "string",
                            "description": "The GoCardless mandate ID (e.g., MD123)",
                        }
                    },
                    "required": ["mandate_id"],
                },
            ),
            types.Tool(
                name="list_subscriptions",
                description="List subscriptions from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of subscriptions to retrieve (default: 50)",
                        },
                        "status": {
                            "type": "string",
                            "description": "Filter by subscription status",
                        },
                    },
                },
            ),
            types.Tool(
                name="get_subscription",
                description="Get subscription by ID. Returns links.mandate - use get_mandate then get_customer for full details, or use get_subscription_details instead.",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "subscription_id": {
                            "type": "string",
                            "description": "The GoCardless subscription ID (e.g., SB123)",
                        }
                    },
                    "required": ["subscription_id"],
                },
            ),
            types.Tool(
                name="get_subscription_details",
                description="Get complete subscription info including mandate and customer in one call",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "subscription_id": {
                            "type": "string",
                            "description": "The GoCardless subscription ID (e.g., SB123)",
                        }
                    },
                    "required": ["subscription_id"],
                },
            ),
            types.Tool(
                name="list_payouts",
                description="List payouts from GoCardless",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "limit": {
                            "type": "integer",
                            "description": "Number of payouts to retrieve (default: 50)",
                        }
                    },
                },
            ),
        ]

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