---
title: "Connect GoCardless to ChatGPT: Automate Mandates and Subscriptions"
slug: connect-gocardless-to-chatgpt-automate-mandates-and-subscriptions
date: 2026-09-13
author: Nidhi KN
categories: ["AI & Agents"]
excerpt: "Generate a secure, managed MCP server for GoCardless in seconds. Connect it to ChatGPT to automate Direct Debit mandates, subscriptions, and payouts using natural language."
tldr: "Connect GoCardless to ChatGPT using Truto's auto-generated MCP servers. Learn how to expose strict financial APIs to LLMs, filter access, and execute complex billing workflows without writing custom API integration code."
canonical: https://truto.one/blog/connect-gocardless-to-chatgpt-automate-mandates-and-subscriptions/
---

# Connect GoCardless to ChatGPT: Automate Mandates and Subscriptions


If you want to connect GoCardless to ChatGPT so your AI agents can create customers, orchestrate Direct Debit mandates, manage subscriptions, and process refunds, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's tool calling capabilities and the GoCardless REST API.

If your team uses Claude, check out our guide on [connecting GoCardless to Claude](https://truto.one/connect-gocardless-to-claude-manage-payments-payouts-and-refunds/) or explore our broader architectural overview on [connecting GoCardless to AI Agents](https://truto.one/connect-gocardless-to-ai-agents-handle-billing-and-outbound-flows/).

Giving a Large Language Model (LLM) read and write access to a payment orchestration platform is a high-stakes engineering challenge. You either spend weeks [building, hosting, securing, and maintaining a custom MCP server](https://truto.one/build-vs-buy-the-hidden-costs-of-custom-mcp-servers/) to translate LLM JSON arguments into GoCardless's strict payload structures, or you use a [managed infrastructure layer](https://truto.one/best-mcp-server-platform-for-ai-agents-connecting-to-enterprise-saas/).

This guide breaks down exactly how to use Truto to generate a secure, authenticated MCP server for GoCardless, connect it natively to ChatGPT, and execute complex recurring payment workflows using natural language.

::cta{buttonText="Talk to us" buttonUrl="/book-a-demo/"}
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds.
:::

## The Engineering Reality of the GoCardless API

A custom MCP server is essentially a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against GoCardless's specific architecture is uniquely challenging.

If you decide to build a custom MCP server for GoCardless, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with GoCardless:

### The "Links" Object and Relational Chains
GoCardless does not allow you to simply pass a `customer_id` at the top level of a payment payload. Almost all relationships in the GoCardless API are managed through a strict `links` object. To create a payment, your LLM must successfully chain multiple API calls in exact sequence: create a customer, extract the `customer_id`, create a bank account linked to that customer, extract the `bank_account_id`, create a mandate linking the bank account and creditor, wait for the mandate to be active, and finally create a payment linking the mandate. Your MCP tool schemas must perfectly guide the LLM to construct this nested `links` object, or the API will reject the request.

### Asynchronous State Machines
In standard SaaS APIs, a `201 Created` response means the resource is ready to use. In GoCardless, resources are driven by asynchronous state machines. A mandate starts as `pending_submission`, moves to `submitted`, and eventually becomes `active` or `failed`. If an LLM creates a mandate and immediately tries to create a payment against it before it is active, the request will fail. Your MCP implementation needs to expose the `events` resource so the AI agent can poll for state changes, or you must build webhooks into your agent orchestration layer.

### Strict Rate Limiting (No Forgiveness)
GoCardless enforces strict rate limits on their API. It is critical to understand how this is handled at the infrastructure layer: **Truto does not retry, throttle, or apply backoff on rate limit errors.** When the GoCardless API returns an HTTP 429, Truto passes that error directly back to the caller. Truto normalizes the upstream rate limit information into standardized headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`) per the IETF spec. Do not expect the integration platform to absorb these spikes - the caller (your LangChain/agent framework or ChatGPT) is entirely responsible for implementing retry and backoff logic when these headers are received.

## How to Create the GoCardless MCP Server

Truto dynamically generates MCP tools based on the GoCardless API documentation and resources. You can spin up an MCP server scoped to a specific GoCardless account in seconds.

### Method 1: Via the Truto UI

1. Log into your Truto dashboard and navigate to **Integrated Accounts**.
2. Select your connected GoCardless account (or connect a new one using the OAuth flow).
3. Click the **MCP Servers** tab.
4. Click **Create MCP Server**.
5. Select your desired configuration (e.g., allow `read` and `write` methods, filter by specific tags like `payments` or `mandates`).
6. Copy the generated MCP server URL (it will look like `https://api.truto.one/mcp/<token>`). Treat this URL as a secret.

### Method 2: Via the Truto API

You can programmatically generate MCP servers for your end-users. This is ideal if you are [deploying AI agents dynamically across hundreds of tenants](https://truto.one/how-to-architect-a-multi-tenant-mcp-server-for-enterprise-b2b-saas/).

```bash
curl -X POST https://api.truto.one/integrated-account/<INTEGRATED_ACCOUNT_ID>/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ChatGPT GoCardless Payments Agent",
    "config": {
      "methods": ["read", "write", "custom"],
      "tags": ["customers", "mandates", "payments", "subscriptions"]
    }
  }'
```

The API will return a JSON response containing the secure `url`. The cryptographic token in the URL handles routing and authentication automatically.

## Connecting the MCP Server to ChatGPT

Once you have your Truto MCP server URL, connecting it to your AI environment is straightforward.

### Method A: Via the ChatGPT UI

If you are using ChatGPT Pro, Plus, Business, Enterprise, or Education, you can connect the MCP server directly in the browser:

1. Open ChatGPT and navigate to **Settings -> Apps -> Advanced settings**.
2. Toggle **Developer mode** to ON.
3. Under the **MCP servers / Custom connectors** section, click **Add new**.
4. Enter a name (e.g., "GoCardless Automation").
5. Paste the Truto MCP URL into the **Server URL** field.
6. Click **Save**. ChatGPT will immediately ping the `/initialize` endpoint, discover the GoCardless tools, and make them available in your chat context.

### Method B: Via Manual Config File (SSE Transport)

If you are running a local agent, Claude Desktop, or a custom LangChain implementation, you can configure the server using a standard JSON config file. Because Truto MCP servers operate over standard HTTP JSON-RPC, you use the official SSE server wrapper to handle the transport.

```json
{
  "mcpServers": {
    "gocardless": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://api.truto.one/mcp/<YOUR_TRUTO_TOKEN>"
      ]
    }
  }
}
```

## GoCardless Hero Tools for AI Agents

Truto automatically exposes the entire GoCardless API surface as structured tools. Here are the highest-leverage operations your AI agent will use to orchestrate billing.

### create_a_go_cardless_customer
This is the foundational tool for all GoCardless operations. It creates a customer record with the contact details required for Direct Debit mandates. The LLM must collect `given_name`, `family_name`, and `email`.

> "I have a new client, Sarah Connor (sarah@example.com). Please create a customer profile for her in GoCardless so we can set up her billing."

### create_a_go_cardless_mandate
Creates a mandate against a customer bank account. The LLM uses the `links` object to tie the mandate to a specific `customer_bank_account` ID.

> "Create a new Bacs Direct Debit mandate for the bank account ID BA123456. Ensure the reference is set to 'Q3-RETAINER'."

### create_a_go_cardless_subscription
Automates recurring payments by creating a subscription against an active mandate. The LLM handles the complex logic of setting the `interval_unit` (e.g., monthly, yearly) and the `day_of_month`.

> "Set up a monthly subscription for mandate MD98765. Charge them £500 (GBP) on the 1st of every month starting next month."

### create_a_go_cardless_payment
Executes a one-off charge against a Direct Debit mandate. The LLM must supply the amount in the lowest currency denomination (e.g., pence or cents).

> "We need to charge John Doe £150 for the ad-hoc consulting hours last week. Please create a one-off payment against his active mandate."

### go_cardless_subscriptions_pause
Pauses an active subscription so no further payments are created until it is explicitly resumed. This is crucial for automated account management when a client requests a temporary hold.

> "Pause the monthly retainer subscription for Acme Corp (Subscription ID SB12345) immediately. They are pausing services for 60 days."

### create_a_go_cardless_refund
Initiates a full or partial refund for a specific payment back to the customer. The LLM must reference the original payment ID.

> "The client was accidentally double-charged on payment PM12345. Please issue a full refund for that transaction."

### list_all_go_cardless_events
Exposes the GoCardless event log. This allows the LLM to poll for state changes (e.g., checking if a payment failed or a mandate was successfully activated) without requiring an inbound webhook receiver.

> "Check the recent events for payment PM99999. Has it been confirmed by the bank yet, or is it still pending submission?"

To view the complete inventory of available GoCardless tools, JSON schemas, and parameter requirements, visit the [GoCardless integration page](https://truto.one/integrations/detail/gocardless).

## Workflows in Action

When you connect GoCardless to ChatGPT via Truto, the LLM can chain these tools together to execute complex, multi-step financial operations autonomously.

### Scenario 1: Onboarding a New Retainer Client

When a sales representative closes a deal, they can ask the AI agent to orchestrate the entire billing setup.

> "We just closed a deal with Wayne Enterprises. The contact is Bruce Wayne (bruce@wayne.com). Set him up in GoCardless, create a bank account profile using the sort code 20-00-00 and account 12345678, generate a mandate, and create a £5000 monthly subscription starting immediately."

**How the agent executes this:**
1. Calls `create_a_go_cardless_customer` with Bruce's details. Returns `CU123`.
2. Calls `create_a_go_cardless_customer_bank_account` using `links.customer: "CU123"` and the provided local bank details. Returns `BA123`.
3. Calls `create_a_go_cardless_mandate` using `links.customer_bank_account: "BA123"`. Returns `MD123`.
4. Calls `create_a_go_cardless_subscription` for £5000 GBP, `interval_unit: "monthly"`, passing `links.mandate: "MD123"`.

```mermaid
sequenceDiagram
    participant User as User Prompt
    participant ChatGPT as ChatGPT
    participant Truto as Truto MCP Server
    participant GC as GoCardless API

    User->>ChatGPT: "Set up Bruce Wayne..."
    ChatGPT->>Truto: Call create_a_go_cardless_customer
    Truto->>GC: POST /customers
    GC-->>Truto: Customer ID (CU123)
    Truto-->>ChatGPT: Result: CU123
    
    ChatGPT->>Truto: Call create_a_go_cardless_customer_bank_account
    Truto->>GC: POST /customer_bank_accounts (linked to CU123)
    GC-->>Truto: Bank Account ID (BA123)
    Truto-->>ChatGPT: Result: BA123
    
    ChatGPT->>Truto: Call create_a_go_cardless_mandate
    Truto->>GC: POST /mandates (linked to BA123)
    GC-->>Truto: Mandate ID (MD123)
    Truto-->>ChatGPT: Result: MD123
    
    ChatGPT->>Truto: Call create_a_go_cardless_subscription
    Truto->>GC: POST /subscriptions (linked to MD123)
    GC-->>Truto: Subscription ID (SB123)
    Truto-->>ChatGPT: Success response
    ChatGPT-->>User: "Bruce Wayne is set up and the £5000 monthly subscription is active."
```

### Scenario 2: Handling a Failed Payment Alert

An account manager notices a customer complained about a service interruption due to a failed payment and asks the AI to investigate and resolve it.

> "Check the status of the last payment for customer CU987. If it failed, check the mandate status. If the mandate is still active, retry the payment."

**How the agent executes this:**
1. Calls `list_all_go_cardless_payments` filtered by `customer: "CU987"`. Identifies payment `PM777` has a `status` of `failed`.
2. Calls `get_single_go_cardless_payment_by_id` to inspect the failure reason and extract the mandate ID `MD777`.
3. Calls `get_single_go_cardless_mandate_by_id` for `MD777` and verifies the status is `active`.
4. Calls `go_cardless_payments_retry` passing `payment_id: "PM777"` to resubmit the charge to the bank.

The LLM then reports back to the user that the payment failed due to insufficient funds, but because the mandate is still active, the retry process has been successfully initiated.

## Security and Access Control

Exposing financial infrastructure to an LLM requires strict boundaries. Truto provides several mechanisms to lock down your GoCardless MCP servers:

*   **Method Filtering:** Restrict the server to only `read` operations if you want an AI agent that can audit payments and events but cannot initiate charges or refunds.
*   **Tag Filtering:** Limit the server to specific resource tags. For example, you can expose `customers` and `subscriptions` while explicitly hiding `refunds` and `payouts`.
*   **Require API Token Auth:** By setting `require_api_token_auth: true`, the MCP URL alone is not enough to execute tools. The calling client must also pass a valid Truto API token in the Authorization header.
*   **Expiration (TTL):** Set an `expires_at` timestamp when creating the MCP server. This is perfect for granting a temporary AI contractor access to run a specific audit workflow. Once expired, the server and its underlying storage are completely destroyed.

## Strategic Wrap-Up

Building a custom MCP server for GoCardless means taking on the burden of translating LLM intent into a highly relational, state-driven API. Every time GoCardless updates a schema, or every time your LLM hallucinates an endpoint path, your integration breaks.

By using Truto, you eliminate the integration build phase entirely. Truto derives tool definitions directly from GoCardless's documentation and API schemas, ensuring your AI agents always have accurate, up-to-date tools. You maintain complete control over access and security, while offloading the infrastructure maintenance.

Stop writing custom integration code. Generate your GoCardless MCP server today and focus on building intelligent billing workflows.

> Ready to connect GoCardless to your AI agents? Get a demo of Truto's managed MCP infrastructure.
>
> [Talk to us](https://truto.one/book-a-demo/)
