create_payment
Create a new payment in GoCardless by specifying amount, currency, and mandate ID. This tool processes payments through the GoCardless MCP Server for managing payment data.
Instructions
Create a new payment in GoCardless
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount in minor currency unit (e.g., 1000 for £10.00) | |
| currency | Yes | ISO 4217 currency code (e.g., GBP, EUR) | |
| mandate_id | Yes | ID of the mandate to use for this payment | |
| description | No | Payment description |
Implementation Reference
- src/gocardless_mcp/server.py:369-384 (handler)Handler for the create_payment tool. Constructs payment parameters from arguments and calls client.payments.create to execute the payment creation.elif name == "create_payment": params = { "amount": arguments["amount"], "currency": arguments["currency"], "links": {"mandate": arguments["mandate_id"]}, } if "description" in arguments: params["description"] = arguments["description"] payment = client.payments.create(params=params) return [ types.TextContent( type="text", text=f"Payment created successfully:\n{_format_json({'id': payment.id, 'amount': payment.amount, 'currency': payment.currency, 'status': payment.status})}", ) ]
- src/gocardless_mcp/server.py:131-156 (registration)Registration of the create_payment tool in the list_tools handler, including name, description, and input schema definition.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"], }, ),
- src/gocardless_mcp/server.py:134-155 (schema)Input schema definition for the create_payment tool, specifying required parameters and types.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"], },
- src/gocardless_mcp/server.py:14-21 (helper)Helper function get_client() used by all tools including create_payment to initialize the GoCardless API 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)