Skip to main content
Glama

create_customer

Add a new customer to GoCardless payment system by providing email, name, and optional company details to enable payment processing.

Instructions

Create a new customer in GoCardless

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
company_nameNoCustomer company name (optional)
emailYesCustomer email address
family_nameNoCustomer last name
given_nameNoCustomer first name

Implementation Reference

  • Registration of the create_customer tool including its input schema definition.
    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"], }, ),
  • Handler function that executes the create_customer tool by calling the GoCardless API to create a customer with the provided parameters.
    elif name == "create_customer": params = { "email": arguments["email"], } if "given_name" in arguments: params["given_name"] = arguments["given_name"] if "family_name" in arguments: params["family_name"] = arguments["family_name"] if "company_name" in arguments: params["company_name"] = arguments["company_name"] customer = client.customers.create(params=params) return [ types.TextContent( type="text", text=f"Customer created successfully:\n{_format_json({'id': customer.id, 'email': customer.email})}", ) ]
  • Helper function to initialize the GoCardless client, used by the create_customer handler.
    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